From fe2dc59232f4ac302aec71bff640e909e8a5b74a Mon Sep 17 00:00:00 2001 From: HemantKMehta <70174684+HemantKMehta@users.noreply.github.com> Date: Wed, 2 Feb 2022 18:14:50 +0530 Subject: [PATCH] fix(jans-auth-server): for issue#315 JARM registered redirect uri (#752) This is correction in fix for the issue#315 to ensure registered redirectUri --- .../authorize/ws/rs/AuthorizeRestWebServiceValidator.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeRestWebServiceValidator.java b/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeRestWebServiceValidator.java index 28d9e2dad9d..9fc98b7b998 100644 --- a/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeRestWebServiceValidator.java +++ b/jans-auth-server/server/src/main/java/io/jans/as/server/authorize/ws/rs/AuthorizeRestWebServiceValidator.java @@ -188,7 +188,10 @@ public void validateRequestObject(JwtAuthorizationRequest jwtRequest, RedirectUr Client client = clientService.getClient(jwtRequest.getClientId()); if (redirectUri != null && redirectionUriService.validateRedirectionUri(client, redirectUri) == null) { log.error(" unregistered redirect uri"); - throw redirectUriResponse.createWebException(AuthorizeErrorResponseType.INVALID_REQUEST_OBJECT); + throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST) + .entity(errorResponseFactory.getErrorAsJson(AuthorizeErrorResponseType.INVALID_REQUEST_REDIRECT_URI, + jwtRequest.getState(), "The request has unregistered request_uri")) + .type(MediaType.APPLICATION_JSON_TYPE).build()); } if (jwtRequest.getExp() == null) { log.error("The exp claim is not set"); @@ -351,4 +354,4 @@ public void validatePkce(String codeChallenge, RedirectUriResponse redirectUriRe throw redirectUriResponse.createWebException(AuthorizeErrorResponseType.INVALID_REQUEST); } } -} \ No newline at end of file +}