Class ClaimsSetRequest
- java.lang.Object
-
- com.nimbusds.openid.connect.sdk.claims.ClaimsSetRequest
-
- All Implemented Interfaces:
net.minidev.json.JSONAware
- Direct Known Subclasses:
VerifiedClaimsSetRequest,VerifiedClaimsSetRequest
@Immutable public class ClaimsSetRequest extends Object implements net.minidev.json.JSONAware
OpenID Connect claims set request, intended to represent theuserinfoandid_tokenelements in aclaimsrequest parameter.Example:
{ "given_name": {"essential": true}, "nickname": null, "email": {"essential": true}, "email_verified": {"essential": true}, "picture": null, "http://example.info/claims/groups": null }Related specifications:
- OpenID Connect Core 1.0, section 5.5.
- OpenID Connect for Identity Assurance 1.0.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClaimsSetRequest.EntryIndividual OpenID claim request.
-
Constructor Summary
Constructors Constructor Description ClaimsSetRequest()Creates a new empty OpenID Connect claims set request.ClaimsSetRequest(Collection<ClaimsSetRequest.Entry> entries)Creates a new OpenID Connect claims set request.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClaimsSetRequestadd(ClaimsSetRequest.Entry entry)Adds the specified claim to the request.ClaimsSetRequestadd(String claimName)Adds the specified claim to the request, using default settings.ClaimsSetRequestdelete(String claimName)Deletes the specified claim from this request, in all existing language tag variations if any.ClaimsSetRequestdelete(String claimName, com.nimbusds.langtag.LangTag langTag)Deletes the specified claim from this request.ClaimsSetRequest.Entryget(String claimName)Gets the specified claim entry from this request.ClaimsSetRequest.Entryget(String claimName, com.nimbusds.langtag.LangTag langTag)Gets the specified claim entry from this request.Set<String>getClaimNames(boolean withLangTag)Gets the names of the requested claims.Collection<ClaimsSetRequest.Entry>getEntries()Gets the request entries.static ClaimsSetRequestparse(String json)Parses an OpenID Connect claims set request from the specified JSON object string representation.static ClaimsSetRequestparse(net.minidev.json.JSONObject jsonObject)Parses an OpenID Connect claims set request from the specified JSON object representation.net.minidev.json.JSONObjecttoJSONObject()Returns the JSON object representation of this claims set request.StringtoJSONString()StringtoString()
-
-
-
Constructor Detail
-
ClaimsSetRequest
public ClaimsSetRequest()
Creates a new empty OpenID Connect claims set request.
-
ClaimsSetRequest
public ClaimsSetRequest(Collection<ClaimsSetRequest.Entry> entries)
Creates a new OpenID Connect claims set request.- Parameters:
entries- The request entries, empty collection if none. Must not benull.
-
-
Method Detail
-
add
public ClaimsSetRequest add(String claimName)
Adds the specified claim to the request, using default settings. Shorthand foradd(Entry).- Parameters:
claimName- The claim name. Must not benull.- Returns:
- The updated claims set request.
-
add
public ClaimsSetRequest add(ClaimsSetRequest.Entry entry)
Adds the specified claim to the request.- Parameters:
entry- The individual claim request. Must not benull.- Returns:
- The updated claims set request.
-
getEntries
public Collection<ClaimsSetRequest.Entry> getEntries()
Gets the request entries.- Returns:
- The request entries, empty collection if none.
-
getClaimNames
public Set<String> getClaimNames(boolean withLangTag)
Gets the names of the requested claims.- Parameters:
withLangTag- Iftruethe language tags, if any, will be appended to the names, else not.- Returns:
- The claim names, as an unmodifiable set, empty set if none.
-
get
public ClaimsSetRequest.Entry get(String claimName)
Gets the specified claim entry from this request.- Parameters:
claimName- The claim name. Must not benull.- Returns:
- The claim entry,
nullif not found.
-
get
public ClaimsSetRequest.Entry get(String claimName, com.nimbusds.langtag.LangTag langTag)
Gets the specified claim entry from this request.- Parameters:
claimName- The claim name. Must not benull.langTag- The associated language tag,nullif none.- Returns:
- The claim entry,
nullif not found.
-
delete
public ClaimsSetRequest delete(String claimName, com.nimbusds.langtag.LangTag langTag)
Deletes the specified claim from this request.- Parameters:
claimName- The claim name. Must not benull.langTag- The associated language tag,nullif none.- Returns:
- The updated claims set request.
-
delete
public ClaimsSetRequest delete(String claimName)
Deletes the specified claim from this request, in all existing language tag variations if any.- Parameters:
claimName- The claim name. Must not benull.- Returns:
- The updated claims set request.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Returns the JSON object representation of this claims set request.Example:
{ "given_name": {"essential": true}, "nickname": null, "email": {"essential": true}, "email_verified": {"essential": true}, "picture": null, "http://example.info/claims/groups": null }- Returns:
- The JSON object, empty if no claims are specified.
-
toJSONString
public String toJSONString()
- Specified by:
toJSONStringin interfacenet.minidev.json.JSONAware
-
parse
public static ClaimsSetRequest parse(net.minidev.json.JSONObject jsonObject) throws ParseException
Parses an OpenID Connect claims set request from the specified JSON object representation.- Parameters:
jsonObject- The JSON object to parse. Must not benull.- Returns:
- The claims set request.
- Throws:
ParseException- If parsing failed.
-
parse
public static ClaimsSetRequest parse(String json) throws ParseException
Parses an OpenID Connect claims set request from the specified JSON object string representation.- Parameters:
json- The JSON object string to parse. Must not benull.- Returns:
- The claims set request.
- Throws:
ParseException- If parsing failed.
-
-