Package com.nimbusds.openid.connect.sdk
Class ClaimsRequest.Entry
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.ClaimsRequest.Entry
-
- Enclosing class:
- ClaimsRequest
@Immutable public static class ClaimsRequest.Entry extends Object
Individual claim request.Related specifications:
- OpenID Connect Core 1.0, section 5.5.1.
-
-
Constructor Summary
Constructors Constructor Description Entry(String claimName, com.nimbusds.langtag.LangTag langTag)
Creates a new individual claim request.Entry(String claimName, ClaimRequirement requirement)
Creates a new individual claim request.Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, String value)
Creates a new individual claim request.Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, List<String> values)
Creates a new individual claim request.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>
getAdditionalInformation()
Gets the optional additional information for the claim.String
getClaimName()
Gets the claim name.String
getClaimName(boolean withLangTag)
Gets the claim name, optionally with the language tag appended.ClaimRequirement
getClaimRequirement()
Gets the claim requirement.com.nimbusds.langtag.LangTag
getLangTag()
Gets the optional language tag for the claim.String
getValue()
Gets the optional value for the claim.List<String>
getValues()
Gets the optional values for the claim.static Collection<ClaimsRequest.Entry>
parseEntries(net.minidev.json.JSONObject jsonObject)
Parses a collection of individual claim requests from the specified JSON object.static net.minidev.json.JSONObject
toJSONObject(Collection<ClaimsRequest.Entry> entries)
Returns the JSON object representation of the specified collection of individual claim requests.
-
-
-
Constructor Detail
-
Entry
public Entry(String claimName, com.nimbusds.langtag.LangTag langTag)
Creates a new individual claim request. The claim requirement is set to voluntary (the default) and no expected value(s) are specified.- Parameters:
claimName
- The claim name. Must not benull
.langTag
- Optional language tag for the claim.
-
Entry
public Entry(String claimName, ClaimRequirement requirement)
Creates a new individual claim request.- Parameters:
claimName
- The claim name. Must not benull
.requirement
- The claim requirement. Must not benull
.
-
Entry
public Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, String value)
Creates a new individual claim request.- Parameters:
claimName
- The claim name. Must not benull
.requirement
- The claim requirement. Must not benull
.langTag
- Optional language tag for the claim.value
- Optional expected value for the claim.
-
Entry
public Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, List<String> values)
Creates a new individual claim request.- Parameters:
claimName
- The claim name. Must not benull
.requirement
- The claim requirement. Must not benull
.langTag
- Optional language tag for the claim.values
- Optional expected values for the claim.
-
-
Method Detail
-
getClaimName
public String getClaimName()
Gets the claim name.- Returns:
- The claim name.
-
getClaimName
public String getClaimName(boolean withLangTag)
Gets the claim name, optionally with the language tag appended.Example with language tag:
name#de-DE
- Parameters:
withLangTag
- Iftrue
the language tag will be appended to the name (if any), else not.- Returns:
- The claim name, with optionally appended language tag.
-
getClaimRequirement
public ClaimRequirement getClaimRequirement()
Gets the claim requirement.- Returns:
- The claim requirement.
-
getLangTag
public com.nimbusds.langtag.LangTag getLangTag()
Gets the optional language tag for the claim.- Returns:
- The language tag,
null
if not specified.
-
getValue
public String getValue()
Gets the optional value for the claim.- Returns:
- The value,
null
if not specified.
-
getValues
public List<String> getValues()
Gets the optional values for the claim.- Returns:
- The values,
null
if not specified.
-
getAdditionalInformation
public Map<String,Object> getAdditionalInformation()
Gets the optional additional information for the claim.Example additional information in the "info" member:
{ "userinfo" : { "email": null, "email_verified": null, "http://example.info/claims/groups" : { "info" : "custom information" } } }
- Returns:
- The additional information,
null
if not specified.
-
toJSONObject
public static net.minidev.json.JSONObject toJSONObject(Collection<ClaimsRequest.Entry> entries)
Returns the JSON object representation of the specified collection of individual claim requests.Example:
{ "given_name": {"essential": true}, "nickname": null, "email": {"essential": true}, "email_verified": {"essential": true}, "picture": null, "http://example.info/claims/groups": null }
- Parameters:
entries
- The entries to serialise. Must not benull
.- Returns:
- The corresponding JSON object, empty if no claims were found.
-
parseEntries
public static Collection<ClaimsRequest.Entry> parseEntries(net.minidev.json.JSONObject jsonObject)
Parses a collection of individual claim requests from the specified JSON object. Request entries that are not understood are silently ignored.- Parameters:
jsonObject
- The JSON object to parse. Must not benull
.- Returns:
- The collection of claim requests.
-
-