java.lang.Object
iu.crypt.Jwt
iu.auth.config.OidcIdToken
- All Implemented Interfaces:
WebToken
Extends
Jwt to include OIDC ID token claim validation.-
Field Summary
Fields inherited from class iu.crypt.Jwt
claims, NUMERIC_DATE -
Constructor Summary
ConstructorsConstructorDescriptionOidcIdToken(WebKey.Algorithm alg, OAuthClient client, String nonce, String accessToken, Duration maxAge, JsonObject claims) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic OidcIdTokendecryptAndVerify(String jwt, WebKey issuerKey, WebKey audienceKey, OAuthClient client, String nonce, String accessToken, Duration maxAge) Parses, decrypts, and verifies a JWT encoded withJWS compact serialization.Gets the access token provided with this ID token.Gets the point in time authentication occurred.getEmail()Gets the preferred email address.Gets the full display name.getRoles()Gets the roles that the authenticated user is authorized for.voidvalidateClaims(URI expectedAudience, Duration ttl) Verify JWT registered claims are well-formed and within the allowed time window.static OidcIdTokenverify(String jwt, WebKey issuerKey, OAuthClient client, String nonce, String accessToken, Duration maxAge) Parses and verifies an ID token encoded withJWS compact serialization.Methods inherited from class iu.crypt.Jwt
decryptAndVerify, equals, getAudience, getAuthorizationDetails, getExpires, getIssuedAt, getIssuer, getNonce, getNotBefore, getScope, getSubject, getTokenId, hashCode, isExpired, sign, signAndEncrypt, toString, validate, verify
-
Constructor Details
-
OidcIdToken
public OidcIdToken(WebKey.Algorithm alg, OAuthClient client, String nonce, String accessToken, Duration maxAge, JsonObject claims) Constructor.- Parameters:
alg- Signature algorithm used to verify ID Token authenticityclient- Client to which this token was issuednonce- One-Time number (nonce) value provided with the original authentication requestaccessToken- Access token issued with this ID token.maxAge- Maximum length of time to allow since the user's authentication credentials were last verified.claims- JWT claims
-
-
Method Details
-
verify
public static OidcIdToken verify(String jwt, WebKey issuerKey, OAuthClient client, String nonce, String accessToken, Duration maxAge) Parses and verifies an ID token encoded withJWS compact serialization.- Parameters:
jwt-JWS compact serializationissuerKey- Issuer publicWebKeyclient- Client to which this token was issuednonce- One-Time number (nonce) value provided with the original authentication requestaccessToken- Access token issued with this ID token.maxAge- Maximum length of time to allow since the user's authentication credentials were last verified.- Returns:
OidcIdToken
-
decryptAndVerify
public static OidcIdToken decryptAndVerify(String jwt, WebKey issuerKey, WebKey audienceKey, OAuthClient client, String nonce, String accessToken, Duration maxAge) Parses, decrypts, and verifies a JWT encoded withJWS compact serialization.- Parameters:
jwt-JWSorJWEcompact serializationissuerKey- Issuer publicWebKeyaudienceKey- Audience privateWebKey, ignored if the JWT is not encryptedclient- Client to which this token was issuednonce- One-Time number (nonce) value provided with the original authentication requestaccessToken- Access token issued with this ID token.maxAge- Maximum length of time to allow since the user's authentication credentials were last verified.- Returns:
JsonObjectof token claims
-
validateClaims
Description copied from interface:WebTokenVerify JWT registered claims are well-formed and within the allowed time window.In addition to the rules outlined in RFC-7519 JWT Section 4.1, REQUIRES the following claim values to be present and not empty:
- Specified by:
validateClaimsin interfaceWebToken- Overrides:
validateClaimsin classJwt- Parameters:
expectedAudience- Expected audienceURIttl- Maximum assertion time to live allowed by configuration
-
getFullName
Gets the full display name.- Returns:
- full display name
-
getEmail
Gets the preferred email address.- Returns:
- preferred email address
-
getAuthTime
Gets the point in time authentication occurred.- Returns:
- auth_time claim
-
getRoles
Gets the roles that the authenticated user is authorized for.- Returns:
- authorized roles
-
getAccessToken
Gets the access token provided with this ID token.- Returns:
- access token
-