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'
1 service uses InitSubscriber
File
- src/
EventSubscriber/ InitSubscriber.php, line 12 - Contains \Drupal\miniorange_saml\EventSubscriber\InitSubscriber.
Namespace
Drupal\miniorange_saml\EventSubscriberView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InitSubscriber:: |
public static | function | Returns an array of event names this subscriber wants to listen to. | |
InitSubscriber:: |
public | function |