Class ClaimsSet
java.lang.Object
com.nimbusds.openid.connect.sdk.claims.ClaimsSet
- All Implemented Interfaces:
net.minidev.json.JSONAware
- Direct Known Subclasses:
Address,Birthplace,CIBASignedRequestClaimsSet,CommonClaimsSet,PersonClaims
Claims set with basic getters and setters, serialisable to a JSON object.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanGets the audience.getBooleanClaim(String name) Gets a boolean-based claim.Gets a claim.<T> TGets a claim that casts to the specified class.getDateClaim(String name) Gets a date / time based claim, represented as the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date / time.Gets the issuer.net.minidev.json.JSONObjectgetJSONObjectClaim(String name) Gets a JSON object based claim.<T> Map<com.nimbusds.langtag.LangTag,T> getLangTaggedClaim(String name, Class<T> clazz) Returns a map of all instances, including language-tagged, of a claim with the specified base name.getNumberClaim(String name) Gets a number-based claim.Gets the names of the standard top-level claims.getStringClaim(String name) Gets a string-based claim.getStringClaim(String name, com.nimbusds.langtag.LangTag langTag) Gets a string-based claim with an optional language tag.getStringListClaim(String name) Gets a string list based claim.getURIClaim(String name) Gets an URI string based claim.getURLClaim(String name) Gets an URL string based claim.inthashCode()voidPuts all claims from the specified other claims set.voidPuts all claims from the specified map.voidsetAudience(Audience aud) Sets the audience.voidsetAudience(List<Audience> audList) Sets the audience list.voidSets a claim.voidSets a claim with an optional language tag.voidsetDateClaim(String name, Date value) Sets a date / time based claim, represented as the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date / time.voidSets the issuer.voidsetURIClaim(String name, URI value) Sets an URI string based claim.voidsetURLClaim(String name, URL value) Sets an URL string based claim.net.minidev.json.JSONObjectGets the JSON object representation of this claims set.com.nimbusds.jwt.JWTClaimsSetGets the JSON Web Token (JWT) claims set for this claim set.
-
Field Details
-
ISS_CLAIM_NAME
The issuer claim name.- See Also:
-
AUD_CLAIM_NAME
The audience claim name.- See Also:
-
claims
The JSON object representation of the claims set.
-
-
Constructor Details
-
ClaimsSet
public ClaimsSet()Creates a new empty claims set. -
ClaimsSet
Creates a new claims set from the specified JSON object.- Parameters:
jsonObject- The JSON object. Must not benull.
-
-
Method Details
-
getStandardClaimNames
Gets the names of the standard top-level claims.- Returns:
- The names of the standard top-level claims (read-only set).
-
putAll
Puts all claims from the specified other claims set.- Parameters:
other- The other claims set. Must not benull.
-
putAll
Puts all claims from the specified map.- Parameters:
claims- The claims to put. Must not benull.
-
getClaim
Gets a claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified.
-
getClaim
Gets a claim that casts to the specified class.- Parameters:
name- The claim name. Must not benull.clazz- The Java class that the claim value should cast to. Must not benull.- Returns:
- The claim value,
nullif not specified or casting failed.
-
getLangTaggedClaim
Returns a map of all instances, including language-tagged, of a claim with the specified base name.Example JSON serialised claims set:
{ "month" : "January", "month#de" : "Januar" "month#es" : "enero", "month#it" : "gennaio" }The "month" claim instances as java.util.Map:
null = "January" (no language tag) "de" = "Januar" "es" = "enero" "it" = "gennaio"
- Parameters:
name- The claim name. Must not benull.clazz- The Java class that the claim values should cast to. Must not benull.- Returns:
- The matching language-tagged claim values, empty map if
none. A
nullkey indicates the value has no language tag (corresponds to the base name).
-
setClaim
Sets a claim.- Parameters:
name- The claim name, with an optional language tag. Must not benull.value- The claim value. Should serialise to a JSON entity. Ifnullany existing claim with the same name will be removed.
-
setClaim
Sets a claim with an optional language tag.- Parameters:
name- The claim name. Must not benull.value- The claim value. Should serialise to a JSON entity. Ifnullany existing claim with the same name and language tag (if any) will be removed.langTag- The language tag of the claim value,nullif not tagged.
-
getStringClaim
Gets a string-based claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or casting failed.
-
getStringClaim
Gets a string-based claim with an optional language tag.- Parameters:
name- The claim name. Must not benull.langTag- The language tag of the claim value,nullto get the non-tagged value.- Returns:
- The claim value,
nullif not specified or casting failed.
-
getBooleanClaim
Gets a boolean-based claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or casting failed.
-
getNumberClaim
Gets a number-based claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or casting failed.
-
getURLClaim
Gets an URL string based claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or parsing failed.
-
setURLClaim
Sets an URL string based claim.- Parameters:
name- The claim name. Must not benull.value- The claim value. Ifnullany existing claim with the same name will be removed.
-
getURIClaim
Gets an URI string based claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or parsing failed.
-
setURIClaim
Sets an URI string based claim.- Parameters:
name- The claim name. Must not benull.value- The claim value. Ifnullany existing claim with the same name will be removed.
-
getDateClaim
Gets a date / time based claim, represented as the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date / time.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or parsing failed.
-
setDateClaim
Sets a date / time based claim, represented as the number of seconds from 1970-01-01T0:0:0Z as measured in UTC until the date / time.- Parameters:
name- The claim name. Must not benull.value- The claim value. Ifnullany existing claim with the same name will be removed.
-
getStringListClaim
Gets a string list based claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or parsing failed.
-
getJSONObjectClaim
Gets a JSON object based claim.- Parameters:
name- The claim name. Must not benull.- Returns:
- The claim value,
nullif not specified or parsing failed.
-
getIssuer
Gets the issuer. Corresponds to theissclaim.- Returns:
- The issuer,
nullif not specified.
-
setIssuer
Sets the issuer. Corresponds to theissclaim.- Parameters:
iss- The issuer,nullif not specified.
-
getAudience
Gets the audience. Corresponds to theaudclaim.- Returns:
- The audience,
nullif not specified.
-
setAudience
Sets the audience. Corresponds to theaudclaim.- Parameters:
aud- The audience,nullif not specified.
-
setAudience
Sets the audience list. Corresponds to theaudclaim.- Parameters:
audList- The audience list,nullif not specified.
-
toJSONObject
Gets the JSON object representation of this claims set.Example:
{ "country" : "USA", "country#en" : "USA", "country#de_DE" : "Vereinigte Staaten", "country#fr_FR" : "Etats Unis" }- Returns:
- The JSON object representation.
-
toJSONString
- Specified by:
toJSONStringin interfacenet.minidev.json.JSONAware
-
toJWTClaimsSet
Gets the JSON Web Token (JWT) claims set for this claim set.- Returns:
- The JWT claims set.
- Throws:
ParseException- If the conversion to a JWT claims set fails.
-
equals
-
hashCode
-