You are here

function cas_phpcas_attributes in CAS 7

Same name and namespace in other branches
  1. 6.3 cas.module \cas_phpcas_attributes()

Get the CAS attributes of the current CAS user.

Ensures that phpCAS is properly initialized before getting the attributes.

Parameters

$cas_name: If provided, ensure that the currently logged in CAS user matches this CAS username.

Return value

An associative array of CAS attributes.

See also

phpCAS::getAttributes()

1 call to cas_phpcas_attributes()
cas_login_check in ./cas.module
Checks to see if the user needs to be logged in.

File

./cas.module, line 1317
Enables users to authenticate via a Central Authentication Service (CAS) Cas will currently work if the auto registration is turned on and will create user accounts automatically.

Code

function cas_phpcas_attributes($cas_name = NULL) {
  if (isset($cas_name) && $cas_name != cas_current_user()) {

    // Attributes cannot be extracted for other users, since they are
    // stored in the session variable.
    return array();
  }
  cas_phpcas_init();
  if (phpCAS::isAuthenticated()) {
    if (method_exists('phpCAS', 'getAttributes')) {
      return phpCAS::getAttributes();
    }
  }
  return array();
}