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 theuserinfo
andid_token
elements in aclaims
request 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 class
ClaimsSetRequest.Entry
Individual 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 ClaimsSetRequest
add(ClaimsSetRequest.Entry entry)
Adds the specified claim to the request.ClaimsSetRequest
add(String claimName)
Adds the specified claim to the request, using default settings.ClaimsSetRequest
delete(String claimName)
Deletes the specified claim from this request, in all existing language tag variations if any.ClaimsSetRequest
delete(String claimName, com.nimbusds.langtag.LangTag langTag)
Deletes the specified claim from this request.ClaimsSetRequest.Entry
get(String claimName)
Gets the specified claim entry from this request.ClaimsSetRequest.Entry
get(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 ClaimsSetRequest
parse(String json)
Parses an OpenID Connect claims set request from the specified JSON object string representation.static ClaimsSetRequest
parse(net.minidev.json.JSONObject jsonObject)
Parses an OpenID Connect claims set request from the specified JSON object representation.net.minidev.json.JSONObject
toJSONObject()
Returns the JSON object representation of this claims set request.String
toJSONString()
String
toString()
-
-
-
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
- Iftrue
the 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,
null
if 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,null
if none.- Returns:
- The claim entry,
null
if 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,null
if 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:
toJSONString
in 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.
-
-