class FirewallSubscriber in Restrict Login or Role Access by IP Address 8.4
Class FirewallSubscriber.
@package Drupal\restrict_by_ip
Hierarchy
- class \Drupal\restrict_by_ip\EventSubscriber\FirewallSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of FirewallSubscriber
1 string reference to 'FirewallSubscriber'
1 service uses FirewallSubscriber
File
- src/
EventSubscriber/ FirewallSubscriber.php, line 15
Namespace
Drupal\restrict_by_ip\EventSubscriberView source
class FirewallSubscriber implements EventSubscriberInterface {
/**
* Drupal\restrict_by_ip\LoginFirewallInterface definition.
*
* @var Drupal\restrict_by_ip\LoginFirewallInterface
*/
protected $loginFirewall;
/**
* Drupal\Core\Session\AccountInterface definition.
*
* @var Drupal\Core\Session\AccountInterface
*/
protected $currentUser;
/**
* Constructor.
*/
public function __construct(LoginFirewallInterface $login_firewall, AccountInterface $current_user) {
$this->loginFirewall = $login_firewall;
$this->currentUser = $current_user;
}
/**
* Registers the methods in this class that should be listeners.
*
* @return array
* An array of event listener definitions.
*/
static function getSubscribedEvents() {
$events['kernel.request'] = [
'loginFirewall',
];
return $events;
}
/**
* This method is called whenever the kernel.request event is
* dispatched.
*
* @param GetResponseEvent $event
*/
public function loginFirewall(GetResponseEvent $event) {
$this->loginFirewall
->execute($this->currentUser);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FirewallSubscriber:: |
protected | property | Drupal\Core\Session\AccountInterface definition. | |
FirewallSubscriber:: |
protected | property | Drupal\restrict_by_ip\LoginFirewallInterface definition. | |
FirewallSubscriber:: |
static | function | Registers the methods in this class that should be listeners. | |
FirewallSubscriber:: |
public | function | This method is called whenever the kernel.request event is dispatched. | |
FirewallSubscriber:: |
public | function | Constructor. |