Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(login): Also check legacy annotation for ephemeral sessions
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Mar 3, 2025
commit ab01b76a194d562e630549a3938c2da8e157d372
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