@Test public void tokenIssuerWithoutHttpSchemeMatchesIdentityProviderUrl() { when(token.getClaimAsString(ISSUER)).thenReturn("subdomain.accounts400.ondemand.com"); ValidationResult validationResult = cut.validate(token); assertThat(validationResult.isErroneous(), is(true)); assertThat(validationResult.getErrorDescription(), startsWith( "Issuer is not trusted because 'iss' claim 'subdomain.accounts400.ondemand.com' does not provide a valid URI (missing http scheme).")); }
@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);  }