Class 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 Detail

      • ClaimsSetRequest

        public ClaimsSetRequest()
        Creates a new empty OpenID Connect claims set request.
    • Method Detail

      • 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

        public ClaimsSetRequest add​(ClaimsSetRequest.Entry entry)
        Adds the specified claim to the request.
        Parameters:
        entry - The individual claim request. Must not be null.
        Returns:
        The updated claims set request.
      • getClaimNames

        public Set<StringgetClaimNames​(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
      • 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.