Skip to content

Commit

Permalink
covered use case
Browse files Browse the repository at this point in the history
  • Loading branch information
antonio.torre committed May 29, 2024
1 parent fc0495b commit d51969a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ void givenInvalidSubjectTokenIssuerThenInvalidTokenIssuerException() throws Exce
validateExternalTokenService.validate(ValidateExternalTokenService.ALLOWED_CLIENT_ID, ValidateExternalTokenService.ALLOWED_GRANT_TYPE, subjectToken, "UNEXPECTED_SUBECJECT_ISSUER", ValidateExternalTokenService.ALLOWED_SUBJECT_TOKEN_TYPE, ValidateExternalTokenService.ALLOWED_SCOPE));
}

@Test
void givenInvalidSubjectTypeThenInvalidTokenException() throws Exception {
String subjectToken = utils.generateJWK(EXPIRES_AT);
Map<String, String> claimsMap = createJWKClaims(ALLOWED_SUBECJECT_ISSUER, ALLOWED_AUDIENCE);

String wireMockUrl = utils.getUrlJwkProvider();
when(jwtValidator.validate(subjectToken, wireMockUrl)).thenReturn(claimsMap);

assertThrows(InvalidTokenException.class, () ->
validateExternalTokenService.validate(ValidateExternalTokenService.ALLOWED_CLIENT_ID, ValidateExternalTokenService.ALLOWED_GRANT_TYPE, subjectToken, ALLOWED_SUBECJECT_ISSUER, "UNEXPECTED_SUBJECT_TOKEN_TYPE", ValidateExternalTokenService.ALLOWED_SCOPE));
}

@Test
void givenInvalidScopeThenInvalidExchangeRequestException() throws Exception {
String subjectToken = utils.generateJWK(EXPIRES_AT);
Expand Down

0 comments on commit d51969a

Please sign in to comment.