Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class TokenResource {
@Inject
UserService userService;


@GET
@Produces("application/json")
@Operation(hidden = true)
Expand All @@ -41,16 +42,18 @@ public String getUserName() {
}

/**
* Performs a local logout using the standard 'Clear-Site-Data' header.
* This feature is available only in secure contexts (HTTPS)
* https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Clear-Site-Data
* Performs logout based on the authentication provider:
* - For AWS Cognito: redirects to /logout endpoint to trigger Cognito logout
* - For Keycloak and OpenShift OAuth: uses Clear-Site-Data header
*/
@POST
@Path("/logout")
@Produces(MediaType.TEXT_HTML)
@Operation(hidden = true)
@PermitAll
public Response logout() {
// Use Clear-Site-Data header to clear cookies and storage
// Works for all OIDC providers (Cognito, Keycloak, OpenShift OAuth)
return Response.ok(LOGGED_OUT_HTML)
.header("Clear-Site-Data", "\"cookies\", \"storage\"")
.build();
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ quarkus.oidc.authentication.java-script-auto-redirect=false
# ==============================================================================

# Allow logout for all authenticated users (even without roles)
quarkus.http.auth.permission.logout.paths=/api/v1/user/logout
quarkus.http.auth.permission.logout.policy=permit
# Named "auth-logout" to be processed before "default" permission (alphabetical order)
quarkus.http.auth.permission.auth-logout.paths=/api/v1/user/logout,/q/oidc/logout
quarkus.http.auth.permission.auth-logout.policy=permit


# Allow health endpoints (for monitoring)
Expand Down