@@ -22,45 +22,45 @@ |
||
| 22 | 22 | // Will close the session if the user session is ephemeral. |
| 23 | 23 | // Happens when the user logs in via the login flow v2. |
| 24 | 24 | class FlowV2EphemeralSessionsMiddleware extends Middleware { |
| 25 | - public function __construct( |
|
| 26 | - private ISession $session, |
|
| 27 | - private IUserSession $userSession, |
|
| 28 | - private ControllerMethodReflector $reflector, |
|
| 29 | - private LoggerInterface $logger, |
|
| 30 | - ) { |
|
| 31 | - } |
|
| 25 | + public function __construct( |
|
| 26 | + private ISession $session, |
|
| 27 | + private IUserSession $userSession, |
|
| 28 | + private ControllerMethodReflector $reflector, |
|
| 29 | + private LoggerInterface $logger, |
|
| 30 | + ) { |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - public function beforeController(Controller $controller, string $methodName) { |
|
| 34 | - if (!$this->session->get(ClientFlowLoginV2Controller::EPHEMERAL_NAME)) { |
|
| 35 | - return; |
|
| 36 | - } |
|
| 33 | + public function beforeController(Controller $controller, string $methodName) { |
|
| 34 | + if (!$this->session->get(ClientFlowLoginV2Controller::EPHEMERAL_NAME)) { |
|
| 35 | + return; |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - if ( |
|
| 39 | - $controller instanceof ClientFlowLoginV2Controller |
|
| 40 | - && ($methodName === 'grantPage' || $methodName === 'generateAppPassword') |
|
| 41 | - ) { |
|
| 42 | - return; |
|
| 43 | - } |
|
| 38 | + if ( |
|
| 39 | + $controller instanceof ClientFlowLoginV2Controller |
|
| 40 | + && ($methodName === 'grantPage' || $methodName === 'generateAppPassword') |
|
| 41 | + ) { |
|
| 42 | + return; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - if ($controller instanceof TwoFactorChallengeController |
|
| 46 | - || $controller instanceof ALoginSetupController) { |
|
| 47 | - return; |
|
| 48 | - } |
|
| 45 | + if ($controller instanceof TwoFactorChallengeController |
|
| 46 | + || $controller instanceof ALoginSetupController) { |
|
| 47 | + return; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - $reflectionMethod = new ReflectionMethod($controller, $methodName); |
|
| 51 | - if (!empty($reflectionMethod->getAttributes(PublicPage::class))) { |
|
| 52 | - return; |
|
| 53 | - } |
|
| 50 | + $reflectionMethod = new ReflectionMethod($controller, $methodName); |
|
| 51 | + if (!empty($reflectionMethod->getAttributes(PublicPage::class))) { |
|
| 52 | + return; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - if ($this->reflector->hasAnnotation('PublicPage')) { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 55 | + if ($this->reflector->hasAnnotation('PublicPage')) { |
|
| 56 | + return; |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | - $this->logger->info('Closing user and PHP session for ephemeral session', [ |
|
| 60 | - 'controller' => $controller::class, |
|
| 61 | - 'method' => $methodName, |
|
| 62 | - ]); |
|
| 63 | - $this->userSession->logout(); |
|
| 64 | - $this->session->close(); |
|
| 65 | - } |
|
| 59 | + $this->logger->info('Closing user and PHP session for ephemeral session', [ |
|
| 60 | + 'controller' => $controller::class, |
|
| 61 | + 'method' => $methodName, |
|
| 62 | + ]); |
|
| 63 | + $this->userSession->logout(); |
|
| 64 | + $this->session->close(); |
|
| 65 | + } |
|
| 66 | 66 | } |