From 519e05c8414ccdee3764621a14597a811f20359e Mon Sep 17 00:00:00 2001 From: George Baev Date: Sun, 6 Feb 2022 18:59:42 +0200 Subject: [PATCH] WS2-1205: Respect the CAS "forced login" settings. --- src/EventSubscriber/WebSparkCasSubscriber.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/EventSubscriber/WebSparkCasSubscriber.php b/src/EventSubscriber/WebSparkCasSubscriber.php index 4279afc..0617910 100644 --- a/src/EventSubscriber/WebSparkCasSubscriber.php +++ b/src/EventSubscriber/WebSparkCasSubscriber.php @@ -15,7 +15,7 @@ class WebSparkCasSubscriber extends CasSubscriber { * {@inheritdoc} */ public function handle(GetResponseEvent $event) { - if ($this->isElasticCrawlerRequest()) { + if ($this->isElasticCrawlerRequest() && !$this->isForcedPath()) { return; } @@ -49,4 +49,18 @@ protected function isElasticCrawlerRequest(): bool { return FALSE; } + /** + * Checks if the path is a forced login one. + * + * @see https://stackoverflow.com/a/61921662 + * + * @return bool + * The check result. + */ + protected function isForcedPath() { + $r = new \ReflectionMethod(parent::class, 'handleForcedPath'); + $r->setAccessible(TRUE); + return $r->invoke($this); + } + }