Skip to content

Commit

Permalink
fix(jans-auth-server): validate redirect_uri blank and client redirec…
Browse files Browse the repository at this point in the history
…t uris single item to return by default (#1046)
  • Loading branch information
Milton-Ch committed Mar 15, 2022
1 parent 4d93a49 commit aa139e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public String validateRedirectionUri(@NotNull Client client, String redirectionU
redirectUris = getSectorRedirectUris(sectorIdentifierUri).toArray(new String[0]);
}

if (StringUtils.isBlank(sectorIdentifierUri) && redirectUris != null && redirectUris.length == 1) {
if (StringUtils.isBlank(redirectionUri) && redirectUris != null && redirectUris.length == 1) {
return redirectUris[0];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ public void validateRedirectionUri_sectorIdentifierBlankAndRredirectUrlNull_retu
assertNull(returnValue);
}

@Test
public void validateRedirectionUri_redirectionUriBlankAndOneClientRedirectUri_returnSingleItem() {
final String singleRedirectUri = "https://client.example.com/cb2";
final Client client = getClientForValidateRedirectionUri_sectorIdentifierBlank_redirectURisNull();
client.setRedirectUris(new String[]{ singleRedirectUri });

final String returnValue = redirectionUriService.validateRedirectionUri(client, singleRedirectUri);
assertEquals(singleRedirectUri, returnValue);
}

private Client getClientForValidateRedirectionUri_full() {
final Client client = new Client();
client.setSectorIdentifierUri("https://test.gluu.org/jans-auth/sectoridentifier/a55ede29-8f5a-461d-b06e-76caee8d40b5");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,5 +446,5 @@
"deviceAuthzRequestExpiresIn": 1800,
"deviceAuthzTokenPollInterval": 5,
"deviceAuthzResponseTypeToProcessAuthz": "code",
"redirectUrisRegexEnabled": false
"redirectUrisRegexEnabled": true
}

0 comments on commit aa139e4

Please sign in to comment.