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 the userinfo and id_token elements in a claims 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.
  • Constructor Details

    • ClaimsSetRequest

      Creates a new empty OpenID Connect claims set request.
    • ClaimsSetRequest

      Creates a new OpenID Connect claims set request.
      Parameters:
      entries - The request entries, empty collection if none. Must not be null.
  • Method Details

    • add

      public ClaimsSetRequest add(String claimName)
      Adds the specified claim to the request, using default settings. Shorthand for add(Entry).
      Parameters:
      claimName - The claim name. Must not be null.
      Returns:
      The updated claims set request.
    • add

      Adds the specified claim to the request.
      Parameters:
      entry - The individual claim request. Must not be null.
      Returns:
      The updated claims set request.
    • 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 - If true 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 be null.
      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 be null.
      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 be null.
      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 be null.
      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 interface net.minidev.json.JSONAware
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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 be null.
      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 be null.
      Returns:
      The claims set request.
      Throws:
      ParseException - If parsing failed.