Class UserInfo

All Implemented Interfaces:
net.minidev.json.JSONAware

public class UserInfo extends PersonClaims
UserInfo claims set, serialisable to a JSON object.

Supports normal, aggregated and distributed claims.

Example UserInfo claims set:

 {
   "sub"                : "248289761001",
   "name"               : "Jane Doe",
   "given_name"         : "Jane",
   "family_name"        : "Doe",
   "preferred_username" : "j.doe",
   "email"              : "[email protected]",
   "picture"            : "http://example.com/janedoe/me.jpg"
 }
 

Related specifications:

  • OpenID Connect Core 1.0, sections 5.1 and 5.6.
  • OpenID Connect for Identity Assurance 1.0, section 3.1.
  • Field Details

  • Constructor Details

    • UserInfo

      public UserInfo(Subject sub)
      Creates a new minimal UserInfo claims set.
      Parameters:
      sub - The subject. Must not be null.
    • UserInfo

      public UserInfo(net.minidev.json.JSONObject jsonObject)
      Creates a new UserInfo claims set from the specified JSON object.
      Parameters:
      jsonObject - The JSON object. Must not be null.
      Throws:
      IllegalArgumentException - If the JSON object doesn't contain a subject sub string claim.
    • UserInfo

      public UserInfo(com.nimbusds.jwt.JWTClaimsSet jwtClaimsSet)
      Creates a new UserInfo claims set from the specified JSON Web Token (JWT) claims set.
      Parameters:
      jwtClaimsSet - The JWT claims set. Must not be null.
      Throws:
      IllegalArgumentException - If the JWT claims set doesn't contain a subject sub string claim.
  • Method Details

    • getStandardClaimNames

      public static Set<String> getStandardClaimNames()
      Gets the names of the standard top-level UserInfo claims.
      Returns:
      The names of the standard top-level UserInfo claims (read-only set).
    • putAll

      public void putAll(UserInfo other)
      Puts all claims from the specified other UserInfo claims set. Aggregated and distributed claims are properly merged.
      Parameters:
      other - The other UserInfo. Must have the same subject. Must not be null.
      Throws:
      IllegalArgumentException - If the other UserInfo claims set doesn't have an identical subject, or if the external claims source ID of the other UserInfo matches an existing source ID.
    • getSubject

      public Subject getSubject()
      Gets the UserInfo subject. Corresponds to the sub claim.
      Returns:
      The subject.
    • getVerifiedClaims

      Gets the verified claims. Corresponds to the verified_claims claim from OpenID Connect for Identity Assurance 1.0.
      Returns:
      List of the verified claims sets, null if not specified or parsing failed.
    • setVerifiedClaims

      public void setVerifiedClaims(VerifiedClaimsSet verifiedClaims)
      Sets the verified claims. Corresponds to the verified_claims claim from OpenID Connect for Identity Assurance 1.0.
      Parameters:
      verifiedClaims - The verified claims set, null if not specified.
    • setVerifiedClaims

      public void setVerifiedClaims(List<VerifiedClaimsSet> verifiedClaimsList)
      Sets a list of verified claims with separate verifications. Corresponds to the verified_claims claim from OpenID Connect for Identity Assurance 1.0.
      Parameters:
      verifiedClaimsList - List of the verified claims sets, null if not specified or parsing failed.
    • addAggregatedClaims

      public void addAggregatedClaims(AggregatedClaims aggregatedClaims)
      Adds the specified aggregated claims provided by an external claims source.
      Parameters:
      aggregatedClaims - The aggregated claims instance, if null nothing will be added.
    • getAggregatedClaims

      Gets the included aggregated claims provided by each external claims source.
      Returns:
      The aggregated claims, null if none are found.
    • addDistributedClaims

      public void addDistributedClaims(DistributedClaims distributedClaims)
      Adds the specified distributed claims from an external claims source.
      Parameters:
      distributedClaims - The distributed claims instance, if null nothing will be added.
    • getDistributedClaims

      Gets the included distributed claims provided by each external claims source.
      Returns:
      The distributed claims, null if none are found.
    • parse

      public static UserInfo parse(String json) throws ParseException
      Parses a UserInfo claims set from the specified JSON object string.
      Parameters:
      json - The JSON object string to parse. Must not be null.
      Returns:
      The UserInfo claims set.
      Throws:
      ParseException - If parsing failed.