diff --git a/simplesamlphp_auth.module b/simplesamlphp_auth.module index 26ea5f8..66298c9 100644 --- a/simplesamlphp_auth.module +++ b/simplesamlphp_auth.module @@ -53,7 +53,7 @@ function simplesamlphp_auth_user_logout($account) { $logout_url = \Drupal::config('simplesamlphp_auth.settings')->get('logout_goto_url'); $simplesaml = \Drupal::service('simplesamlphp_auth.manager'); - // Only interfere if this user was logged in through simplesaml + // Only interfere if this user was logged in through simplesaml. if ($simplesaml->isAuthenticated()) { // Have to destroy the session here as some configurations of // SimpleSAMLphp_auth can create infinite loops. By removing IdP auth before @@ -129,7 +129,7 @@ function simplesamlphp_auth_form_user_register_form_alter(&$form, FormStateInter * @see simplesamlphp_auth_form_user_register_form_alter() * @see simplesamlphp_auth_user_form_submit() */ -function simplesamlphp_auth_user_form_includes(&$form) { +function simplesamlphp_auth_user_form_includes(array &$form) { $form['simplesamlphp_auth_user_enable'] = [ '#type' => 'checkbox', '#title' => t('Enable this user to leverage SAML authentication'), diff --git a/src/EventSubscriber/SimplesamlSubscriber.php b/src/EventSubscriber/SimplesamlSubscriber.php index 3bc47b9..efc40a1 100644 --- a/src/EventSubscriber/SimplesamlSubscriber.php +++ b/src/EventSubscriber/SimplesamlSubscriber.php @@ -107,9 +107,10 @@ class SimplesamlSubscriber implements EventSubscriberInterface { } /** - * Redirect anonymous users from the Drupal login page directly to the external IdP. + * Redirect anonymous users from the Drupal login page directly to the + * external IdP. * - * @param GetResponseEvent $event + * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event * The subscribed event. */ public function login_directly_with_external_IdP(GetResponseEvent $event) { @@ -121,7 +122,8 @@ class SimplesamlSubscriber implements EventSubscriberInterface { // Check if an anonymous user tries to access the Drupal login page. if (\Drupal::currentUser()->isAnonymous() && \Drupal::routeMatch()->getRouteName() == 'user.login') { - // Get the path (default: '/saml_login') from the 'simplesamlphp_auth.saml_login' route. + // Get the path (default: '/saml_login') from the + // 'simplesamlphp_auth.saml_login' route. $saml_login_path = \Drupal::url('simplesamlphp_auth.saml_login'); // Redirect directly to the external IdP. diff --git a/src/Plugin/Block/SimplesamlphpAuthBlock.php b/src/Plugin/Block/SimplesamlphpAuthBlock.php index af40f65..70f9c1a 100644 --- a/src/Plugin/Block/SimplesamlphpAuthBlock.php +++ b/src/Plugin/Block/SimplesamlphpAuthBlock.php @@ -79,7 +79,6 @@ class SimplesamlphpAuthBlock extends BlockBase implements ContainerFactoryPlugin ], ]; - if ($this->simplesamlAuth->isActivated()) { if ($this->simplesamlAuth->isAuthenticated()) { diff --git a/src/Service/SimplesamlphpAuthManager.php b/src/Service/SimplesamlphpAuthManager.php index 3e4df21..8dabc03 100644 --- a/src/Service/SimplesamlphpAuthManager.php +++ b/src/Service/SimplesamlphpAuthManager.php @@ -134,7 +134,7 @@ class SimplesamlphpAuthManager { /** * Returns a SimpleSAML Simple class instance. * - * @return \SimpleSAML\Auth\Simple|NULL + * @return \SimpleSAML\Auth\Simple|null * The SimpleSAML Simple instance. */ protected function getSimpleSamlInstance() { @@ -153,7 +153,7 @@ class SimplesamlphpAuthManager { catch (CriticalConfigurationError $e) { if ($this->currentUser->hasPermission('administer simplesamlphp authentication') && $this->adminContext->isAdminRoute()) { - $this->messenger->addError($this->t('There is a Simplesamlphp configuration problem. ' . $e->getMessage()), 'error'); + $this->messenger->addError($this->t('There is a Simplesamlphp configuration problem. @message', ['@message' => $e->getMessage()]), 'error'); } return NULL; } @@ -163,7 +163,7 @@ class SimplesamlphpAuthManager { /** * Returns a SimpleSAML configuration instance. * - * @return \SimpleSAML\Configuration|NULL + * @return \SimpleSAML\Configuration|null * The SimpleSAML Configuration instance. */ protected function getSimpleSamlConfiguration() { @@ -181,7 +181,7 @@ class SimplesamlphpAuthManager { catch (CriticalConfigurationError $e) { if ($this->currentUser->hasPermission('administer simplesamlphp authentication') && $this->currentUser->isAdminRoute()) { - $this->messenger->addError($this->t('There is a Simplesamlphp configuration problem. ' . $e->getMessage()), 'error'); + $this->messenger->addError($this->t('There is a Simplesamlphp configuration problem. @message', ['@message' => $e->getMessage()]), 'error'); } return NULL; }