diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module index 43fc5c9..2296969 100644 --- a/simplesamlphp_auth.module +++ b/simplesamlphp_auth.module @@ -51,6 +51,11 @@ function simplesamlphp_auth_help($route_name) { * Implements hook_user_logout(). */ function simplesamlphp_auth_user_logout(AccountInterface $account) { + // If this is the masquerade module, skip the logout. + if (\Drupal::moduleHandler()->moduleExists('masquerade') && \Drupal::service('masquerade')->isMasquerading()) { + return; + } + $logout_url = \Drupal::config('simplesamlphp_auth.settings')->get('logout_goto_url'); /** @var \Drupal\simplesamlphp_auth\Service\SimplesamlphpAuthManager $simplesaml */ $simplesaml = \Drupal::service('simplesamlphp_auth.manager'); diff --git a/src/EventSubscriber/SimplesamlSubscriber.php b/src/EventSubscriber/SimplesamlSubscriber.php index cd14e7e..4d06565 100644 --- a/src/EventSubscriber/SimplesamlSubscriber.php +++ b/src/EventSubscriber/SimplesamlSubscriber.php @@ -94,6 +94,11 @@ class SimplesamlSubscriber implements EventSubscriberInterface { return; } + // If this is the masquerade module, skip the logout. + if (\Drupal::moduleHandler()->moduleExists('masquerade') && \Drupal::service('masquerade')->isMasquerading()) { + return; + } + if ($this->config->get('allow.default_login')) { $allowed_uids = explode(',', $this->config->get('allow.default_login_users'));