Skip to content

Commit

Permalink
fix(login): Also check legacy annotation for ephemeral sessions
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Feb 27, 2025
1 parent 7bab703 commit 47bd75a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 1 addition & 6 deletions lib/private/AppFramework/DependencyInjection/DIContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,7 @@ public function __construct(string $appName, array $urlParams = [], ?ServerConta
)
);

$dispatcher->registerMiddleware(
new FlowV2EphemeralSessionsMiddleware(
$c->get(ISession::class),
$c->get(IUserSession::class),
)
);
$dispatcher->registerMiddleware($c->get(FlowV2EphemeralSessionsMiddleware::class));

$securityMiddleware = new SecurityMiddleware(
$c->get(IRequest::class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
namespace OC\AppFramework\Middleware;

use OC\AppFramework\Utility\ControllerMethodReflector;
use OC\Core\Controller\ClientFlowLoginV2Controller;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Middleware;
Expand All @@ -20,6 +21,7 @@ class FlowV2EphemeralSessionsMiddleware extends Middleware {
public function __construct(
private ISession $session,
private IUserSession $userSession,
private ControllerMethodReflector $reflector,
) {
}

Expand All @@ -40,6 +42,10 @@ public function beforeController(Controller $controller, string $methodName) {
return;
}

if ($this->reflector->hasAnnotation('PublicPage')) {
return;
}

$this->userSession->logout();
$this->session->close();
}
Expand Down

0 comments on commit 47bd75a

Please sign in to comment.