You are here

public function LogoutController::logoutError in Shibboleth Authentication 8

Logout error.

Return value

\Drupal\Core\Routing\TrustedRedirectResponse The redirect response.

1 string reference to 'LogoutController::logoutError'
shib_auth.routing.yml in ./shib_auth.routing.yml
shib_auth.routing.yml

File

src/Controller/LogoutController.php, line 50

Class

LogoutController
Class LogoutController.

Namespace

Drupal\shib_auth\Controller

Code

public function logoutError() {

  // Logs the current user out of drupal.
  user_logout();

  // Get shibboleth config settings.
  $config = \Drupal::config('shib_auth.shibbolethsettings');

  // The shibboleth logout URL to redirect to with drupal error appended.
  $logout_url = $config
    ->get('shibboleth_logout_handler_url') . '?return=' . Url::fromRoute('shib_auth.logout_controller_logout_error_page')
    ->toString();

  // Redirect to the shibboleth logout page.
  return new TrustedRedirectResponse($logout_url);
}