fix(session): log when ephemeral sessions are closed

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2025-07-23 07:52:06 +02:00
parent 4317bb7594
commit 084a2e8859
No known key found for this signature in database
GPG key ID: CC42AC2A7F0E56D8

View file

@ -15,6 +15,7 @@ use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Middleware;
use OCP\ISession;
use OCP\IUserSession;
use Psr\Log\LoggerInterface;
use ReflectionMethod;
// Will close the session if the user session is ephemeral.
@ -24,6 +25,7 @@ class FlowV2EphemeralSessionsMiddleware extends Middleware {
private ISession $session,
private IUserSession $userSession,
private ControllerMethodReflector $reflector,
private LoggerInterface $logger,
) {
}
@ -52,6 +54,10 @@ class FlowV2EphemeralSessionsMiddleware extends Middleware {
return;
}
$this->logger->info('Closing user and PHP session for ephemeral session', [
'controller' => $controller::class,
'method' => $methodName,
]);
$this->userSession->logout();
$this->session->close();
}