Skip to content

Commit

Permalink
Merge pull request #8 from vramik/issue-28328
Browse files Browse the repository at this point in the history
Keep `error` and `error_description` query params in login url.
  • Loading branch information
edewit authored Oct 29, 2024
2 parents a163063 + d05c1b9 commit a8fa022
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ private Response redirectToLogin(String path) {
.queryParam(OAuth2Constants.CODE_CHALLENGE, pkceChallenge)
.queryParam(OAuth2Constants.CODE_CHALLENGE_METHOD, OAuth2Constants.PKCE_METHOD_S256);

if (!queryParameters.isEmpty()) {
String error = queryParameters.getFirst(OAuth2Constants.ERROR);
if (error != null) {
uriBuilder.queryParam(OAuth2Constants.ERROR, error);

String errorDescription = queryParameters.getFirst(OAuth2Constants.ERROR_DESCRIPTION);
if (errorDescription != null) {
uriBuilder.queryParam(OAuth2Constants.ERROR_DESCRIPTION, errorDescription);
}
}
}

URI url = uriBuilder.build();

return Response.status(302).location(url).build();
Expand Down

0 comments on commit a8fa022

Please sign in to comment.