Skip to content

How to get CAS_RESPONSE_CALLBACKS tree value #97

@narutobaka

Description

@narutobaka

Hi

I'm working on installation of this git project : https://github.com/EsupPortail/Esup-Pod
This project use django-cas-client 1.5.2.
I encounter some problems with CAS Auth configuration.

In order to debug I'm looking for a way to get the CAS_RESPONSE_CALLBACKS tree value.

What the best way to do get the tree value return by my CAS server?

If i understand well, in this project in settings.py, I have :

CAS_RESPONSE_CALLBACKS = (
        'pod.authentication.populatedCASbackend.populateUser',
        # function call to add some information to user login by CAS
    )

This call the function populateUser in pod/authentication/populatedCASbackend.py :

def populateUser(tree):
    username_element = tree.find(
        './/{http://www.yale.edu/tp/cas}%s' % AUTH_CAS_USER_SEARCH)
    username = username_element.text
    user, user_created = User.objects.get_or_create(username=username)
    owner, owner_created = Owner.objects.get_or_create(user=user)
    owner.auth_type = 'CAS'
    owner.save()

    if POPULATE_USER == 'CAS':
        #raise Exception(tree)
        populate_user_from_tree(user, owner, tree)
    if POPULATE_USER == 'LDAP' and LDAP_SERVER['url'] != '':
        list_value = []
        for val in USER_LDAP_MAPPING_ATTRIBUTES.values():
            list_value.append(str(val))
        conn = get_ldap_conn()
        if conn is not None:
            entry = get_entry(conn, username, list_value)
            if entry is not None:
                populate_user_from_entry(user, owner, entry)

I try to put raise Exception(tree) in order to force django to show me the tree value in browser, but seems doesn't work.

What the best way to get value of tree CAS_RESPONSE_CALLBACKS ?

cordialy,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions