You are here

class InitSubscriber in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8

Hierarchy

  • class \Drupal\miniorange_saml\EventSubscriber\InitSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface

Expanded class hierarchy of InitSubscriber

1 string reference to 'InitSubscriber'
miniorange_saml.services.yml in ./miniorange_saml.services.yml
miniorange_saml.services.yml
1 service uses InitSubscriber
init_subscriber in ./miniorange_saml.services.yml
Drupal\miniorange_saml\EventSubscriber\InitSubscriber

File

src/EventSubscriber/InitSubscriber.php, line 12
Contains \Drupal\miniorange_saml\EventSubscriber\InitSubscriber.

Namespace

Drupal\miniorange_saml\EventSubscriber
View source
class InitSubscriber implements EventSubscriberInterface {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    return [
      KernelEvents::REQUEST => [
        'onEvent',
        0,
      ],
    ];
  }
  public function onEvent() {
    global $base_url;
    $relay_state = $base_url . '/' . Url::fromRoute("<current>")
      ->toString();
    $force_auth = \Drupal::config('miniorange_saml.settings')
      ->get('miniorange_saml_force_auth');
    $enable_saml_login = \Drupal::config('miniorange_saml.settings')
      ->get('miniorange_saml_enable_login');
    if ($enable_saml_login) {
      if ($force_auth && !\Drupal::currentUser()
        ->isAuthenticated()) {
        saml_login($relay_state);
      }
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
InitSubscriber::getSubscribedEvents public static function Returns an array of event names this subscriber wants to listen to.
InitSubscriber::onEvent public function