Skip to content

Commit

Permalink
Merge pull request #169 from gbourant/main
Browse files Browse the repository at this point in the history
add redirect uri parameter to makeLogoutResponse method
  • Loading branch information
FroMage authored Sep 15, 2023
2 parents edb2d35 + b36738e commit 3288f64
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,15 @@ public static String getUserId(Principal principal) {
}

public Response makeLogoutResponse() {
try {
return this.makeLogoutResponse(new URI("/"));
} catch (URISyntaxException e) {
// can't happen
throw new RuntimeException(e);
}
}

public Response makeLogoutResponse(URI redirectUri) {
Set<String> tenants = tenantProvider.getTenants();
List<NewCookie> cookies = new ArrayList<>(tenants.size() + 1);
// Default tenant
Expand All @@ -113,11 +122,6 @@ public Response makeLogoutResponse() {
}
// Manual
cookies.add(new NewCookie(jwtCookie, null, "/", null, null, 0, false, true));
try {
return Response.seeOther(new URI("/")).cookie(cookies.toArray(new NewCookie[0])).build();
} catch (URISyntaxException e) {
// can't happen
throw new RuntimeException(e);
}
return Response.seeOther(redirectUri).cookie(cookies.toArray(new NewCookie[0])).build();
}
}

0 comments on commit 3288f64

Please sign in to comment.