You are here

function hook_simplesamlphp_auth_pre_login in simpleSAMLphp Authentication 7.3

Allows other modules to perform an additional authentication step prior to logging in given the set of attributes and user object.

Each implementation should take care of displaying errors or redirecting to appropriate error pages, there is no message implementation at hook invocation.

Parameters

$attributes:

$ext_user: The user object for the current user

1 invocation of hook_simplesamlphp_auth_pre_login()
_simplesaml_auth_login_register in ./simplesamlphp_auth.inc
Performs login and/or register actions for SAML authenticated users.

File

./simplesamlphp_auth.api.php, line 66
Hooks for simpleSAMLphp Authentication module.

Code

function hook_simplesamlphp_auth_pre_login($attributes, $ext_user) {

  // Disallow students from logging in with a specific role.
  if ($ext_user['roles'] == '3' && in_array('student', $attributes)) {
    drupal_goto('some-error-page-path');
    exit;
  }
}