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 OpenID claim request.Related specifications:
- OpenID Connect Core 1.0, section 5.5.1.
- OpenID Connect for Identity Assurance 1.0.
-
-
Constructor Summary
Constructors Constructor Description Entry(String claimName)Creates a new individual claim request.Entry(String claimName, com.nimbusds.langtag.LangTag langTag)Deprecated.Entry(String claimName, ClaimRequirement requirement)Deprecated.Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, String value)Deprecated.Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, List<String> values)Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Object>getAdditionalInformation()Returns the additional information for the claim.StringgetClaimName()Returns the claim name.StringgetClaimName(boolean withLangTag)Returns the claim name, optionally with the language tag appended.ClaimRequirementgetClaimRequirement()Returns the claim requirement.com.nimbusds.langtag.LangTaggetLangTag()Returns the optional language tag for the claim.StringgetPurpose()Returns the optional purpose for the requested claim.StringgetValue()Returns the requested value for the claim.List<String>getValues()Returns 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.JSONObjecttoJSONObject(Collection<ClaimsRequest.Entry> entries)Returns the JSON object representation of the specified collection of individual claim requests.ClaimsRequest.EntrywithAdditionalInformation(Map<String,Object> additionalInformation)Returns a new claim entry with the specified additional information for the claim.ClaimsRequest.EntrywithClaimRequirement(ClaimRequirement requirement)Returns a new claim entry with the specified requirement.ClaimsRequest.EntrywithLangTag(com.nimbusds.langtag.LangTag langTag)Returns a new claim entry with the specified language tag for the claim.ClaimsRequest.EntrywithPurpose(String purpose)Returns a new claim entry with the specified purpose for the requested claim.ClaimsRequest.EntrywithValue(String value)Returns a new claim entry with the specified requested value for the claim.ClaimsRequest.EntrywithValues(List<String> values)Returns a new claim entry with the specified requested values for the claim.
-
-
-
Constructor Detail
-
Entry
public Entry(String claimName)
Creates a new individual claim request. The claim requirement is set to voluntary (the default) and no expected value(s) or other parameters are specified.- Parameters:
claimName- The claim name. Must not benull.
-
Entry
@Deprecated public Entry(String claimName, com.nimbusds.langtag.LangTag langTag)
Deprecated.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
@Deprecated public Entry(String claimName, ClaimRequirement requirement)
Deprecated.Creates a new individual claim request.- Parameters:
claimName- The claim name. Must not benull.requirement- The claim requirement. Must not benull.
-
Entry
@Deprecated public Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, String value)
Deprecated.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
@Deprecated public Entry(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, List<String> values)
Deprecated.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()
Returns the claim name.- Returns:
- The claim name.
-
getClaimName
public String getClaimName(boolean withLangTag)
Returns the claim name, optionally with the language tag appended.Example with language tag:
name#de-DE
- Parameters:
withLangTag- Iftruethe language tag will be appended to the name (if any), else not.- Returns:
- The claim name, with optionally appended language tag.
-
withClaimRequirement
public ClaimsRequest.Entry withClaimRequirement(ClaimRequirement requirement)
Returns a new claim entry with the specified requirement.- Parameters:
requirement- The claim requirement.- Returns:
- The new entry.
-
getClaimRequirement
public ClaimRequirement getClaimRequirement()
Returns the claim requirement.- Returns:
- The claim requirement.
-
withLangTag
public ClaimsRequest.Entry withLangTag(com.nimbusds.langtag.LangTag langTag)
Returns a new claim entry with the specified language tag for the claim.- Parameters:
langTag- The language tag,nullif not specified.- Returns:
- The new entry.
-
getLangTag
public com.nimbusds.langtag.LangTag getLangTag()
Returns the optional language tag for the claim.- Returns:
- The language tag,
nullif not specified.
-
withValue
public ClaimsRequest.Entry withValue(String value)
Returns a new claim entry with the specified requested value for the claim.- Parameters:
value- The value,nullif not specified.- Returns:
- The new entry.
-
getValue
public String getValue()
Returns the requested value for the claim.- Returns:
- The value,
nullif not specified.
-
withValues
public ClaimsRequest.Entry withValues(List<String> values)
Returns a new claim entry with the specified requested values for the claim.- Parameters:
values- The values,nullif not specified.- Returns:
- The new entry.
-
getValues
public List<String> getValues()
Returns the optional values for the claim.- Returns:
- The values,
nullif not specified.
-
withPurpose
public ClaimsRequest.Entry withPurpose(String purpose)
Returns a new claim entry with the specified purpose for the requested claim.- Parameters:
purpose- The purpose,nullif not specified.- Returns:
- The new entry.
-
getPurpose
public String getPurpose()
Returns the optional purpose for the requested claim.- Returns:
- The purpose,
nullif not specified.
-
withAdditionalInformation
public ClaimsRequest.Entry withAdditionalInformation(Map<String,Object> additionalInformation)
Returns a new claim entry with the specified 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" } } }- Parameters:
additionalInformation- The additional information,nullif not specified.- Returns:
- The new entry.
-
getAdditionalInformation
public Map<String,Object> getAdditionalInformation()
Returns the 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,
nullif 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.
-
-