You are here

function hook_cas_server_user_attributes in CAS 6.3

Same name and namespace in other branches
  1. 7 cas_server.api.php \hook_cas_server_user_attributes()

Return additional CAS attributes when acting as a CAS server.

This hook allows modules to add additional CAS attributes to the basic response by the CAS Server module.

Parameters

$account: The user being logged in.

$service: The service URL of the site the user is logging in to.

$ticket: The login ticket the user provided.

Return value

An associative array of CAS attributes for the user.

See also

hook_cas_server_user_attributes_alter()

1 function implements hook_cas_server_user_attributes()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

cas_server_cas_server_user_attributes in ./cas_server.module
Implements hook_cas_server_user_attributes().
1 invocation of hook_cas_server_user_attributes()
cas_server_service_validate in ./cas_server.module
serviceValidate method using cas 2.0 Returns data in xml

File

./cas_server.api.php, line 26
Documentation for CAS Server API.

Code

function hook_cas_server_user_attributes($account, $service, $ticket) {
  $attributes = array();

  // Attributes can be single valued...
  $attributes['color'] = 'blue';

  // ... or multi-valued.
  $attributes['friends'] = array(
    'dries',
    'webchick',
  );

  // Or change the response based upon the server.
  if (preg_match("@^http://apple.com/@", $service)) {

    // This data should not be confidential as the service URL is directly
    // supplied by the user and is in no way validated.
    $attributes['friends'] += 'sjobs';
  }
  return $attributes;
}