Search code examples
single-sign-onweb2pycasjasig

web2py CAS custom fields


I've setup my web2py application to work with JASIG CAS (CAS 2) as follows in db.py:

from gluon.contrib.login_methods.cas_auth import CasAuth
auth.settings.login_form=CasAuth(
            urlbase = "https://sso.mysite.co.za",
            actions = ['login','serviceValidate','logout'],
            casversion = 2,
            casusername = "cas:user")

My CAS server is configured to pass some custom fields, which I've added as such on the consumer:

auth.settings.extra_fields['auth_user']=[Field('tokens')]

The problem is that the fields are not being populated. Am I missing something?


Solution

  • There were issues on web2py's CAS 2.0 implementation where the XML envelope was inspected but not the actual Attribute structure. I made some changes to a fork and submitted a pull request.

    https://github.com/yusufk/web2py