Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
strehle committed Jul 10, 2023
1 parent e3ea6dd commit f450572
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void setup() throws MalformedURLException {
def.setRelyingPartySecret("clientSecret");
}
oidc.setResponseType("id_token code");
oidc.setAdditionalAuthzParameters(Map.of("token_format", "jwt"));
oauth.setResponseType("code");

configurator = spy(new ExternalOAuthProviderConfigurator(
Expand All @@ -108,6 +109,7 @@ void setup() throws MalformedURLException {
config.setResponseType("id_token");
config.setScopes(List.of("openid", "cloud_controller.read"));


oidcProvider = new IdentityProvider<>();
oidcProvider.setType(OIDC10);
oidcProvider.setConfig(config);
Expand Down Expand Up @@ -330,4 +332,13 @@ void excludeUnreachableOidcProvider() throws OidcMetadataFetchingException {
assertEquals(oauthProvider.getName(), providers.get(0).getName());
verify(configurator, times(1)).overlay(eq(config));
}

@Test
void testGetIdpAuthenticationUrlAndCheckTokenFormatParameter() {
String authzUri = configurator.getIdpAuthenticationUrl(oidc, OIDC10, mockHttpServletRequest);

Map<String, String> queryParams =
UriComponentsBuilder.fromUriString(authzUri).build().getQueryParams().toSingleValueMap();
assertThat(queryParams, hasEntry("token_format", "jwt"));
}
}

0 comments on commit f450572

Please sign in to comment.