Class IDTokenClaimsSet
java.lang.Object
com.nimbusds.openid.connect.sdk.claims.ClaimsSet
com.nimbusds.openid.connect.sdk.claims.CommonClaimsSet
com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSet
- All Implemented Interfaces:
net.minidev.json.JSONAware
ID token claims set, serialisable to a JSON object.
Example ID token claims set:
{
"iss" : "https://server.example.com",
"sub" : "24400320",
"aud" : "s6BhdRkqt3",
"nonce" : "n-0S6_WzA2Mj",
"exp" : 1311281970,
"iat" : 1311280970,
"auth_time" : 1311280969,
"acr" : "urn:mace:incommon:iap:silver",
"at_hash" : "MTIzNDU2Nzg5MDEyMzQ1Ng"
}
Related specifications:
- OpenID Connect Core 1.0, section 2.
- OpenID Connect Front-Channel Logout 1.0, section 3 (draft 02).
- Financial Services – Financial API - Part 2: Read and Write API Security Profile, section 5.1.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe ACR claim name.static final StringThe AMRs claim name.static final StringThe access token hash claim name.static final StringThe subject authentication time claim name.static final StringThe authorised party claim name.static final StringThe authorisation code hash claim name.static final StringThe expiration time claim name.static final StringThe nonce claim name.static final StringThe state hash claim name.static final StringThe session identifier claim name.static final StringThe subject JWK claim name.Fields inherited from class com.nimbusds.openid.connect.sdk.claims.CommonClaimsSet
IAT_CLAIM_NAME, SUB_CLAIM_NAMEFields inherited from class com.nimbusds.openid.connect.sdk.claims.ClaimsSet
AUD_CLAIM_NAME, claims, ISS_CLAIM_NAME -
Constructor Summary
ConstructorsConstructorDescriptionIDTokenClaimsSet(com.nimbusds.jwt.JWTClaimsSet jwtClaimsSet) Creates a new ID token claims set from the specified JSON Web Token (JWT) claims set.Creates a new minimal ID token claims set. -
Method Summary
Modifier and TypeMethodDescriptionGets the access token hash.getACR()Gets the Authentication Context Class Reference (ACR).getAMR()Gets the Authentication Methods References (AMRs).Gets the subject authentication time.Gets the authorised party for the ID token.Gets the authorisation code hash.Gets the ID token expiration time.getNonce()Gets the ID token nonce.Gets the session ID.Gets the names of the standard top-level ID token claims.Gets the state hash.com.nimbusds.jose.jwk.JWKGets the subject's JSON Web Key (JWK) for a self-issued OpenID Connect provider.booleanhasRequiredClaims(ResponseType responseType) Deprecated.booleanhasRequiredClaims(ResponseType responseType, boolean iatAuthzEndpoint) Checks if this ID token claims set contains all required claims for the specified OpenID Connect response type.static IDTokenClaimsSetParses an ID token claims set from the specified JSON object string.static IDTokenClaimsSetparse(net.minidev.json.JSONObject jsonObject) Parses an ID token claims set from the specified JSON object.voidsetAccessTokenHash(AccessTokenHash atHash) Sets the access token hash.voidSets the Authentication Context Class Reference (ACR).voidSets the Authentication Methods References (AMRs).voidsetAuthenticationTime(Date authTime) Sets the subject authentication time.voidSets the authorised party for the ID token.voidsetCodeHash(CodeHash cHash) Sets the authorisation code hash.voidSets the ID token nonce.voidsetSessionID(SessionID sid) Sets the session ID.voidsetStateHash(StateHash sHash) Sets the state hash.voidsetSubjectJWK(com.nimbusds.jose.jwk.JWK subJWK) Sets the subject's JSON Web Key (JWK) for a self-issued OpenID Connect provider.Methods inherited from class com.nimbusds.openid.connect.sdk.claims.CommonClaimsSet
getIssueTime, getSubjectMethods inherited from class com.nimbusds.openid.connect.sdk.claims.ClaimsSet
equals, getAudience, getBooleanClaim, getClaim, getClaim, getDateClaim, getIssuer, getJSONObjectClaim, getLangTaggedClaim, getNumberClaim, getStringClaim, getStringClaim, getStringListClaim, getURIClaim, getURLClaim, hashCode, putAll, putAll, setAudience, setAudience, setClaim, setClaim, setDateClaim, setIssuer, setURIClaim, setURLClaim, toJSONObject, toJSONString, toJWTClaimsSet
-
Field Details
-
EXP_CLAIM_NAME
The expiration time claim name.- See Also:
-
AUTH_TIME_CLAIM_NAME
The subject authentication time claim name.- See Also:
-
NONCE_CLAIM_NAME
The nonce claim name.- See Also:
-
AT_HASH_CLAIM_NAME
The access token hash claim name.- See Also:
-
C_HASH_CLAIM_NAME
The authorisation code hash claim name.- See Also:
-
S_HASH_CLAIM_NAME
The state hash claim name.- See Also:
-
ACR_CLAIM_NAME
The ACR claim name.- See Also:
-
AMR_CLAIM_NAME
The AMRs claim name.- See Also:
-
AZP_CLAIM_NAME
The authorised party claim name.- See Also:
-
SUB_JWK_CLAIM_NAME
The subject JWK claim name.- See Also:
-
SID_CLAIM_NAME
The session identifier claim name.- See Also:
-
-
Constructor Details
-
IDTokenClaimsSet
Creates a new minimal ID token claims set. Note that the ID token may require additional claims to be present depending on the original OpenID Connect authorisation request.- Parameters:
iss- The issuer. Must not benull.sub- The subject. Must not benull.aud- The audience. Must not benull.exp- The expiration time. Must not benull.iat- The issue time. Must not benull.
-
IDTokenClaimsSet
Creates a new ID token claims set from the specified JSON Web Token (JWT) claims set.- Parameters:
jwtClaimsSet- The JWT claims set. Must not benull.- Throws:
ParseException- If the JWT claims set doesn't represent a valid ID token claims set.
-
-
Method Details
-
getStandardClaimNames
Gets the names of the standard top-level ID token claims.- Returns:
- The names of the standard top-level ID token claims (read-only set).
-
hasRequiredClaims
Checks if this ID token claims set contains all required claims for the specified OpenID Connect response type.- Parameters:
responseType- The OpenID Connect response type. Must not benull.iatAuthzEndpoint- Specifies the endpoint where the ID token was issued (required for hybrid flow).trueif the ID token was issued at the authorisation endpoint,falseif the ID token was issued at the token endpoint.- Returns:
trueif the required claims are contained, elsefalse.
-
hasRequiredClaims
Deprecated.UsehasRequiredClaims(ResponseType, boolean)instead.- Parameters:
responseType- The OpenID Connect response type. Must not benull.- Returns:
trueif the required claims are contained, elsefalse.
-
getExpirationTime
Gets the ID token expiration time. Corresponds to theexpclaim.- Returns:
- The expiration time.
-
getAuthenticationTime
Gets the subject authentication time. Corresponds to theauth_timeclaim.- Returns:
- The authentication time,
nullif not specified or parsing failed.
-
setAuthenticationTime
Sets the subject authentication time. Corresponds to theauth_timeclaim.- Parameters:
authTime- The authentication time,nullif not specified.
-
getNonce
Gets the ID token nonce. Corresponds to thenonceclaim.- Returns:
- The nonce,
nullif not specified or parsing failed.
-
setNonce
Sets the ID token nonce. Corresponds to thenonceclaim.- Parameters:
nonce- The nonce,nullif not specified.
-
getAccessTokenHash
Gets the access token hash. Corresponds to theat_hashclaim.- Returns:
- The access token hash,
nullif not specified or parsing failed.
-
setAccessTokenHash
Sets the access token hash. Corresponds to theat_hashclaim.- Parameters:
atHash- The access token hash,nullif not specified.
-
getCodeHash
Gets the authorisation code hash. Corresponds to thec_hashclaim.- Returns:
- The authorisation code hash,
nullif not specified or parsing failed.
-
setCodeHash
Sets the authorisation code hash. Corresponds to thec_hashclaim.- Parameters:
cHash- The authorisation code hash,nullif not specified.
-
getStateHash
Gets the state hash. Corresponds to thes_hashclaim.- Returns:
- The state hash,
nullif not specified or parsing failed.
-
setStateHash
Sets the state hash. Corresponds to thes_hashclaim.- Parameters:
sHash- The state hash,nullif not specified.
-
getACR
Gets the Authentication Context Class Reference (ACR). Corresponds to theacrclaim.- Returns:
- The Authentication Context Class Reference (ACR),
nullif not specified or parsing failed.
-
setACR
Sets the Authentication Context Class Reference (ACR). Corresponds to theacrclaim.- Parameters:
acr- The Authentication Context Class Reference (ACR),nullif not specified.
-
getAMR
Gets the Authentication Methods References (AMRs). Corresponds to theamrclaim.- Returns:
- The Authentication Methods Reference (AMR) list,
nullif not specified or parsing failed.
-
setAMR
Sets the Authentication Methods References (AMRs). Corresponds to theamrclaim.- Parameters:
amr- The Authentication Methods Reference (AMR) list,nullif not specified.
-
getAuthorizedParty
Gets the authorised party for the ID token. Corresponds to theazpclaim.- Returns:
- The authorised party,
nullif not specified or parsing failed.
-
setAuthorizedParty
Sets the authorised party for the ID token. Corresponds to theazpclaim.- Parameters:
azp- The authorised party,nullif not specified.
-
getSubjectJWK
Gets the subject's JSON Web Key (JWK) for a self-issued OpenID Connect provider. Corresponds to thesub_jwkclaim.- Returns:
- The subject's JWK,
nullif not specified or parsing failed.
-
setSubjectJWK
Sets the subject's JSON Web Key (JWK) for a self-issued OpenID Connect provider. Corresponds to thesub_jwkclaim.- Parameters:
subJWK- The subject's JWK (must be public),nullif not specified.
-
parse
Parses an ID token claims set from the specified JSON object.- Parameters:
jsonObject- The JSON object to parse. Must not benull.- Returns:
- The ID token claims set.
- Throws:
ParseException- If parsing failed.
-
parse
Parses an ID token claims set from the specified JSON object string.- Parameters:
json- The JSON object string to parse. Must not benull.- Returns:
- The ID token claims set.
- Throws:
ParseException- If parsing failed.
-
getSessionID
Gets the session ID. Corresponds to thesidclaim.- Returns:
- The session ID,
nullif not specified.
-
setSessionID
Sets the session ID. Corresponds to thesidclaim.- Parameters:
sid- The session ID,nullif not specified.
-