public function LogoutController::logout in Shibboleth Authentication 8
Logout-- kills drupal then Redirects to shibboleth logout page.
Return value
\Drupal\Core\Routing\TrustedRedirectResponse The redirect response.
1 string reference to 'LogoutController::logout'
File
- src/
Controller/ LogoutController.php, line 22
Class
- LogoutController
- Class LogoutController.
Namespace
Drupal\shib_auth\ControllerCode
public function logout() {
// Logs the current user out of drupal.
user_logout();
// Get shibboleth config settings.
$config = \Drupal::config('shib_auth.shibbolethsettings');
// Get shibboleth advanced config settings.
$adv_config = \Drupal::config('shib_auth.advancedsettings');
// The shibboleth logout URL to redirect to.
$logout_url = $config
->get('shibboleth_logout_handler_url');
// Append the return url if it is set in the admin.
if ($adv_config
->get('url_redirect_logout')) {
$logout_url .= '?return=' . $adv_config
->get('url_redirect_logout');
}
// Redirect to the shib logout page.
return new TrustedRedirectResponse($logout_url);
}