com.nimbusds.openid.connect.sdk
Class ClaimsRequest

java.lang.Object
  extended by com.nimbusds.openid.connect.sdk.ClaimsRequest

public class ClaimsRequest
extends Object

Specifies the individual claims to return from the UserInfo endpoint and / or in the ID Token.

Related specifications:

Author:
Vladimir Dzhuvinov

Nested Class Summary
static class ClaimsRequest.Entry
          Individual claim request.
 
Constructor Summary
ClaimsRequest()
          Creates a new empty claims request.
 
Method Summary
 void addIDTokenClaim(ClaimsRequest.Entry entry)
          Adds the specified ID token claim to the request.
 void addIDTokenClaim(String claimName)
          Adds the specified ID token claim to the request.
 void addIDTokenClaim(String claimName, ClaimRequirement requirement)
          Adds the specified ID token claim to the request.
 void addIDTokenClaim(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag)
          Adds the specified ID token claim to the request.
 void addIDTokenClaim(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, List<String> values)
          Adds the specified ID token claim to the request.
 void addIDTokenClaim(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, String value)
          Adds the specified ID token claim to the request.
 void addUserInfoClaim(ClaimsRequest.Entry entry)
          Adds the specified UserInfo claim to the request.
 void addUserInfoClaim(String claimName)
          Adds the specified UserInfo claim to the request.
 void addUserInfoClaim(String claimName, ClaimRequirement requirement)
          Adds the specified UserInfo claim to the request.
 void addUserInfoClaim(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag)
          Adds the specified UserInfo claim to the request.
 void addUserInfoClaim(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, List<String> values)
          Adds the specified UserInfo claim to the request.
 void addUserInfoClaim(String claimName, ClaimRequirement requirement, com.nimbusds.langtag.LangTag langTag, String value)
          Adds the specified UserInfo claim to the request.
 Collection<ClaimsRequest.Entry> getIDTokenClaims()
          Gets the requested ID token claims.
 Collection<ClaimsRequest.Entry> getUserInfoClaims()
          Gets the requested UserInfo claims.
static ClaimsRequest parse(net.minidev.json.JSONObject jsonObject)
          Parses a claims request from the specified JSON object representation.
 ClaimsRequest.Entry removeIDTokenClaim(String claimName, com.nimbusds.langtag.LangTag langTag)
          Removes the specified ID token claim from the request.
 Collection<ClaimsRequest.Entry> removeIDTokenClaims(String claimName)
          Removes the specified ID token claims from the request, in all existing language tag variations.
 ClaimsRequest.Entry removeUserInfoClaim(String claimName, com.nimbusds.langtag.LangTag langTag)
          Removes the specified UserInfo claim from the request.
 Collection<ClaimsRequest.Entry> removeUserInfoClaims(String claimName)
          Removes the specified UserInfo claims from the request, in all existing language tag variations.
 net.minidev.json.JSONObject toJSONObject()
          Returns the JSON object representation of this claims request.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClaimsRequest

public ClaimsRequest()
Creates a new empty claims request.

Method Detail

addIDTokenClaim

public void addIDTokenClaim(String claimName)
Adds the specified ID token claim to the request. It is marked as voluntary and no language tag and value(s) are associated with it.

Parameters:
claimName - The claim name. Must not be null.

addIDTokenClaim

public void addIDTokenClaim(String claimName,
                            ClaimRequirement requirement)
Adds the specified ID token claim to the request. No language tag and value(s) are associated with it.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.

addIDTokenClaim

public void addIDTokenClaim(String claimName,
                            ClaimRequirement requirement,
                            com.nimbusds.langtag.LangTag langTag)
Adds the specified ID token claim to the request. No value(s) are associated with it.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.
langTag - The associated language tag, null if not specified.

addIDTokenClaim

public void addIDTokenClaim(String claimName,
                            ClaimRequirement requirement,
                            com.nimbusds.langtag.LangTag langTag,
                            String value)
Adds the specified ID token claim to the request.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.
langTag - The associated language tag, null if not specified.
value - The expected claim value, null if not specified.

addIDTokenClaim

public void addIDTokenClaim(String claimName,
                            ClaimRequirement requirement,
                            com.nimbusds.langtag.LangTag langTag,
                            List<String> values)
Adds the specified ID token claim to the request.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.
langTag - The associated language tag, null if not specified.
values - The expected claim values, null if not specified.

addIDTokenClaim

public void addIDTokenClaim(ClaimsRequest.Entry entry)
Adds the specified ID token claim to the request.

Parameters:
entry - The individual ID token claim request. Must not be null.

getIDTokenClaims

public Collection<ClaimsRequest.Entry> getIDTokenClaims()
Gets the requested ID token claims.

Returns:
The ID token claims, as an unmodifiable collection, empty set if none.

removeIDTokenClaim

public ClaimsRequest.Entry removeIDTokenClaim(String claimName,
                                              com.nimbusds.langtag.LangTag langTag)
Removes the specified ID token claim from the request.

Parameters:
claimName - The claim name. Must not be null.
langTag - The associated language tag, null if none.
Returns:
The removed ID token claim, null if not found.

removeIDTokenClaims

public Collection<ClaimsRequest.Entry> removeIDTokenClaims(String claimName)
Removes the specified ID token claims from the request, in all existing language tag variations.

Parameters:
claimName - The claim name. Must not be null.
Returns:
The removed ID token claims, as an unmodifiable collection, empty set if none were found.

addUserInfoClaim

public void addUserInfoClaim(String claimName)
Adds the specified UserInfo claim to the request. It is marked as voluntary and no language tag and value(s) are associated with it.

Parameters:
claimName - The claim name. Must not be null.

addUserInfoClaim

public void addUserInfoClaim(String claimName,
                             ClaimRequirement requirement)
Adds the specified UserInfo claim to the request. No language tag and value(s) are associated with it.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.

addUserInfoClaim

public void addUserInfoClaim(String claimName,
                             ClaimRequirement requirement,
                             com.nimbusds.langtag.LangTag langTag)
Adds the specified UserInfo claim to the request. No value(s) are associated with it.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.
langTag - The associated language tag, null if not specified.

addUserInfoClaim

public void addUserInfoClaim(String claimName,
                             ClaimRequirement requirement,
                             com.nimbusds.langtag.LangTag langTag,
                             String value)
Adds the specified UserInfo claim to the request.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.
langTag - The associated language tag, null if not specified.
value - The expected claim value, null if not specified.

addUserInfoClaim

public void addUserInfoClaim(String claimName,
                             ClaimRequirement requirement,
                             com.nimbusds.langtag.LangTag langTag,
                             List<String> values)
Adds the specified UserInfo claim to the request.

Parameters:
claimName - The claim name. Must not be null.
requirement - The claim requirement. Must not be null.
langTag - The associated language tag, null if not specified.
values - The expected claim values, null if not specified.

addUserInfoClaim

public void addUserInfoClaim(ClaimsRequest.Entry entry)
Adds the specified UserInfo claim to the request.

Parameters:
entry - The individual UserInfo claim request. Must not be null.

getUserInfoClaims

public Collection<ClaimsRequest.Entry> getUserInfoClaims()
Gets the requested UserInfo claims.

Returns:
The UserInfo claims, as an unmodifiable collection, empty set if none.

removeUserInfoClaim

public ClaimsRequest.Entry removeUserInfoClaim(String claimName,
                                               com.nimbusds.langtag.LangTag langTag)
Removes the specified UserInfo claim from the request.

Parameters:
claimName - The claim name. Must not be null.
langTag - The associated language tag, null if none.
Returns:
The removed UserInfo claim, null if not found.

removeUserInfoClaims

public Collection<ClaimsRequest.Entry> removeUserInfoClaims(String claimName)
Removes the specified UserInfo claims from the request, in all existing language tag variations.

Parameters:
claimName - The claim name. Must not be null.
Returns:
The removed UserInfo claims, as an unmodifiable collection, empty set if none were found.

toJSONObject

public net.minidev.json.JSONObject toJSONObject()
Returns the JSON object representation of this claims request.

Example:

 {
   "userinfo":
    {
     "given_name": {"essential": true},
     "nickname": null,
     "email": {"essential": true},
     "email_verified": {"essential": true},
     "picture": null,
     "http://example.info/claims/groups": null
    },
   "id_token":
    {
     "auth_time": {"essential": true},
     "acr": {"values": ["urn:mace:incommon:iap:silver"] }
    }
 }
 

Returns:
The corresponding JSON object, empty if no ID token and UserInfo claims are specified.

toString

public String toString()
Overrides:
toString in class Object

parse

public static ClaimsRequest parse(net.minidev.json.JSONObject jsonObject)
Parses a claims request from the specified JSON object representation. Unexpected members in the JSON object are silently ignored.

Parameters:
jsonObject - The JSON object to parse. Must not be null.
Returns:
The claims request.


Copyright © 2013 NimbusDS. All Rights Reserved.