Skip to content

Commit

Permalink
fix(jans-auth-server): check alg none to display error JARM issue310 (#…
Browse files Browse the repository at this point in the history
…786)

* fix: check alg none to display error JARM issue310

check the algorithm none and display none algorithm is not allowed in FAPI

* fix: updated the alg none check condition

added proper condition to avoid comparing null object
  • Loading branch information
HemantKMehta authored Feb 9, 2022
1 parent 87bd7fe commit b21a052
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,14 @@ private Response requestAuthorization(
} catch (WebApplicationException e) {
JsonWebResponse jwr = parseRequestToJwr(request);
if (jwr != null) {
String checkForAlg = jwr.getClaims().getClaimAsString("alg"); // to handle Jans Issue#310
if ("none".equals(checkForAlg)) {
throw new WebApplicationException(Response.status(Response.Status.BAD_REQUEST)
.entity(errorResponseFactory.getErrorAsJson(
AuthorizeErrorResponseType.INVALID_REQUEST_OBJECT, "",
"The None algorithm in nested JWT is not allowed for FAPI"))
.type(MediaType.APPLICATION_JSON_TYPE).build());
}
responseMode = ResponseMode.getByValue(jwr.getClaims().getClaimAsString("response_mode"));
if (responseMode == ResponseMode.JWT) {
redirectUriResponse.getRedirectUri().setResponseMode(ResponseMode.JWT);
Expand Down

0 comments on commit b21a052

Please sign in to comment.