@Test public void validationFails_whenTokenIssuerContainsQueryParameters() { when(token.getClaimAsString(ISSUER)).thenReturn("https: ValidationResult validationResult = cut.validate(token); assertThat(validationResult.isErroneous(), is(true)); assertThat(validationResult.getErrorDescription(), startsWith("Issuer is not trusted because")); }
@Override public ValidationResult validate(Token token) { String issuer = token.getClaimAsString(TokenClaims.ISSUER); if (issuer == null || issuer.trim().isEmpty()) { return createInvalid( "Issuer validation can not be performed because Jwt token does not contain 'iss' claim."); } return matchesTokenIssuerUrl(issuer); }
JwtIssuerValidator implements Validator<Token> { @Override public ValidationResult validate(Token token) { String issuer = token.getClaimAsString(TokenClaims.ISSUER); if (issuer == null || issuer.trim().isEmpty()) { return createInvalid( "Issuer validation can not be performed because Jwt token does not contain 'iss' claim."); } return matchesTokenIssuerUrl(issuer); } }
JwtIssuerValidator implements Validator<Token> { @Override public ValidationResult validate(Token token) { String issuer = token.getClaimAsString(TokenClaims.ISSUER); if (issuer == null || issuer.trim().isEmpty()) { return createInvalid( "Issuer validation can not be performed because Jwt token does not contain 'iss' claim."); } return matchesTokenIssuerUrl(issuer); } JwtIssuerValidator(URI url); }
JwtIssuerValidator implements Validator<Token> { @Override public ValidationResult validate(Token token) { String issuer = token.getClaimAsString(TokenClaims.ISSUER); if (issuer == null || issuer.trim().isEmpty()) { return createInvalid( "Issuer validation can not be performed because Jwt token does not contain 'iss' claim."); } return matchesTokenIssuerUrl(issuer); } JwtIssuerValidator(URI url); @Override ValidationResult validate(Token token); }
JwtIssuerValidator implements Validator<Token> { @Override public ValidationResult validate(Token token) { String issuer = token.getClaimAsString(TokenClaims.ISSUER); if (issuer == null || issuer.trim().isEmpty()) { return createInvalid( "Issuer validation can not be performed because Jwt token does not contain 'iss' claim."); } return matchesTokenIssuerUrl(issuer); } JwtIssuerValidator(URI url); @Override ValidationResult validate(Token token);  }