You are here

function _simplesamlphp_auth_get_authname in simpleSAMLphp Authentication 6.2

Same name and namespace in other branches
  1. 6.3 simplesamlphp_auth.module \_simplesamlphp_auth_get_authname()
  2. 7.3 simplesamlphp_auth.module \_simplesamlphp_auth_get_authname()
  3. 7 simplesamlphp_auth.module \_simplesamlphp_auth_get_authname()
  4. 7.2 simplesamlphp_auth.module \_simplesamlphp_auth_get_authname()

Gets the authname attribute from the SAML assertion.

Return value

The authname attribute.

1 call to _simplesamlphp_auth_get_authname()
simplesamlphp_auth_init in ./simplesamlphp_auth.module
Implementation of hook_init().

File

./simplesamlphp_auth.module, line 620
simpleSAMLphp authentication module for Drupal.

Code

function _simplesamlphp_auth_get_authname() {
  global $_simplesamlphp_auth_saml_attributes;
  $authname = '';

  // Check if valid local session exists..
  if (isset($_simplesamlphp_auth_saml_attributes)) {
    _simplesaml_auth_debug(t('_simplesamlphp_auth_get_authname: Valid local session exist'));
    if (isset($_simplesamlphp_auth_saml_attributes[variable_get('simplesamlphp_auth_unique_id', 'eduPersonPrincipalName')])) {
      $authname = $_simplesamlphp_auth_saml_attributes[variable_get('simplesamlphp_auth_unique_id', 'eduPersonPrincipalName')][0];
    }
    else {
      throw new Exception(t('error in simplesamlphp_auth.module: no valid unique id attribute set'));
    }
  }
  return $authname;
}