TokenValidation { public static TokenValidation buildAccessTokenValidator(String tokenJwtValue, KeyInfoService keyInfoService) { AccessTokenValidation validator = new AccessTokenValidation(tokenJwtValue, keyInfoService); validator.checkSignature(); return validator; } private  TokenValidation(String token, KeyInfoService keyInfoService); static TokenValidation buildAccessTokenValidator(String tokenJwtValue, KeyInfoService keyInfoService); static TokenValidation buildRefreshTokenValidator(String tokenJwtValue, KeyInfoService keyInfoService); static TokenValidation buildIdTokenValidator(String tokenJwtValue, SignatureVerifier verifier, KeyInfoService keyInfoService); TokenValidation checkSignature(); TokenValidation checkSignature(SignatureVerifier verifier); TokenValidation checkIssuer(String issuer); TokenValidation checkExpiry(); TokenValidation checkClientAndUser(ClientDetails client, UaaUser user); TokenValidation checkRevocationSignature(List<String> revocableSignatureList); TokenValidation checkAudience(String... clients); TokenValidation checkRevocableTokenStore(RevocableTokenProvisioning revocableTokenProvisioning); Jwt getJwt(); Map<String, Object> getClaims(); TokenValidation checkJti(); ClientDetails getClientDetails(MultitenantClientServices clientDetailsService); UaaUser getUserDetails(UaaUserDatabase userDatabase);  }
@Test public void validate_KeyId_isPresent() { header = map(entry("alg", "HS256")); expectedException.expectMessage("kid claim not found in JWT token header"); TokenValidation.buildAccessTokenValidator(getToken(), new KeyInfoService("https: }
@Test public void validate_KeyId_actuallyExists() { String kid = "garbage"; header.put("kid", kid); expectedException.expectMessage("Token header claim [kid] references unknown signing key : [garbage]"); TokenValidation.buildAccessTokenValidator(getToken(), new KeyInfoService("https: }
@Test public void invalidJwt() { expectedException.expect(InvalidTokenException.class); buildAccessTokenValidator("invalid.jwt.token", new KeyInfoService("https: }