function saml_sp__logout in SAML Service Provider 8.2
Same name and namespace in other branches
- 8.3 saml_sp.pages.inc \saml_sp__logout()
- 7.8 saml_sp.pages.inc \saml_sp__logout()
- 7.2 saml_sp.pages.inc \saml_sp__logout()
- 7.3 saml_sp.pages.inc \saml_sp__logout()
- 4.x saml_sp.pages.inc \saml_sp__logout()
- 3.x saml_sp.pages.inc \saml_sp__logout()
Page callback to initiate the SAML SLO process.
1 string reference to 'saml_sp__logout'
- saml_sp_menu in ./
saml_sp.module - Implements hook_menu().
File
- ./
saml_sp.pages.inc, line 20 - User pages for the SAML Service Provider module.
Code
function saml_sp__logout() {
// Load the IDP to authenticate against.
$idp = saml_sp_drupal_login__get_idp();
// Settings is a OneLogin_Saml2_Settings object.
$settings = saml_sp__get_settings($idp);
$auth = new OneLogin_Saml2_Auth($settings);
// Handle SAML Request / Response and process Single LogOut
$auth
->processSLO();
$errors = $auth
->getErrors();
if (empty($errors)) {
\Drupal::logger('saml_sp')
->notice('Handled SLO Request/Response from SSO.');
}
else {
\Drupal::logger('saml_sp')
->error('Errors in SLO process: %errors', array(
'%errors' => implode(', ', $errors),
));
}
// Redirect user to path defined in RelayState after logout, or to front page
// if it's empty
drupal_set_message(t('You have successfully logged out from all SSO services.'));
drupal_goto($_GET['RelayState']);
}