You are here

class IpBanMiddleware in IP Ban 8

Provides a HTTP middleware to implement IP based banning.

Hierarchy

  • class \Drupal\ip_ban\IpBanMiddleware implements \Symfony\Component\HttpKernel\HttpKernelInterface

Expanded class hierarchy of IpBanMiddleware

1 string reference to 'IpBanMiddleware'
ip_ban.services.yml in ./ip_ban.services.yml
ip_ban.services.yml
1 service uses IpBanMiddleware
ban.middleware in ./ip_ban.services.yml
Drupal\ip_ban\IpBanMiddleware

File

src/IpBanMiddleware.php, line 14

Namespace

Drupal\ip_ban
View source
class IpBanMiddleware implements HttpKernelInterface {

  /**
   * The decorated kernel.
   *
   * @var \Symfony\Component\HttpKernel\HttpKernelInterface
   */
  protected $httpKernel;

  /**
   * The IP ban manager.
   *
   * @var \Drupal\ip_ban\IpBanSetBanInterface
   */
  protected $iPBanManager;

  /**
   * Constructs a BanMiddleware object.
   *
   * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
   *   The decorated kernel.
   * @param \Drupal\ban\IpBanSetBanInterface $manager
   *   The IP Ban manager.
   */
  public function __construct(HttpKernelInterface $http_kernel, IpBanSetBanInterface $manager) {
    $this->httpKernel = $http_kernel;
    $this->iPBanManager = $manager;
  }

  /**
   * {@inheritdoc}
   */
  public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
    $this->iPBanManager
      ->iPBanSetValue();
    $this->iPBanManager
      ->iPBanDetermineAction();
    return $this->httpKernel
      ->handle($request, $type, $catch);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
IpBanMiddleware::$httpKernel protected property The decorated kernel.
IpBanMiddleware::$iPBanManager protected property The IP ban manager.
IpBanMiddleware::handle public function
IpBanMiddleware::__construct public function Constructs a BanMiddleware object.