Class UserInfo
java.lang.Object
com.nimbusds.openid.connect.sdk.claims.ClaimsSet
com.nimbusds.openid.connect.sdk.claims.PersonClaims
com.nimbusds.openid.connect.sdk.claims.UserInfo
- All Implemented Interfaces:
net.minidev.json.JSONAware
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" : "janedoe@example.com",
"picture" : "http://example.com/janedoe/me.jpg"
}
Related specifications:
- OpenID Connect Core 1.0
- OpenID Connect for Identity Assurance 1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe subject claim name.static final StringThe verified claims claim name.Fields inherited from class com.nimbusds.openid.connect.sdk.claims.PersonClaims
ADDRESS_CLAIM_NAME, ALSO_KNOWN_AS, BIRTH_FAMILY_NAME_CLAIM_NAME, BIRTH_GIVEN_NAME_CLAIM_NAME, BIRTH_MIDDLE_NAME_CLAIM_NAME, BIRTHDATE_CLAIM_NAME, BIRTHPLACE_CLAIM_NAME, EMAIL_CLAIM_NAME, EMAIL_VERIFIED_CLAIM_NAME, FAMILY_NAME_CLAIM_NAME, GENDER_CLAIM_NAME, GIVEN_NAME_CLAIM_NAME, LOCALE_CLAIM_NAME, MIDDLE_NAME_CLAIM_NAME, MSISDN_CLAIM_NAME, NAME_CLAIM_NAME, NATIONALITIES_CLAIM_NAME, NICKNAME_CLAIM_NAME, PHONE_NUMBER_CLAIM_NAME, PHONE_NUMBER_VERIFIED_CLAIM_NAME, PICTURE_CLAIM_NAME, PLACE_OF_BIRTH_CLAIM_NAME, PREFERRED_USERNAME_CLAIM_NAME, PROFILE_CLAIM_NAME, SALUTATION_CLAIM_NAME, TITLE_CLAIM_NAME, UPDATED_AT_CLAIM_NAME, WEBSITE_CLAIM_NAME, ZONEINFO_CLAIM_NAMEFields inherited from class com.nimbusds.openid.connect.sdk.claims.ClaimsSet
AUD_CLAIM_NAME, claims, ISS_CLAIM_NAME -
Constructor Summary
ConstructorsConstructorDescriptionUserInfo(com.nimbusds.jwt.JWTClaimsSet jwtClaimsSet) Creates a new UserInfo claims set from the specified JSON Web Token (JWT) claims set.Creates a new minimal UserInfo claims set.UserInfo(net.minidev.json.JSONObject jsonObject) Creates a new UserInfo claims set from the specified JSON object. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAggregatedClaims(AggregatedClaims aggregatedClaims) Adds the specified aggregated claims provided by an external claims source.voidaddDistributedClaims(DistributedClaims distributedClaims) Adds the specified distributed claims from an external claims source.Gets the included aggregated claims provided by each external claims source.Gets the included distributed claims provided by each external claims source.Gets the names of the standard top-level UserInfo claims.Gets the UserInfo subject.Gets the verified claims.static UserInfoParses a UserInfo claims set from the specified JSON object string.voidPuts all claims from the specified other UserInfo claims set.voidsetVerifiedClaims(VerifiedClaimsSet verifiedClaims) Sets the verified claims.voidsetVerifiedClaims(List<VerifiedClaimsSet> verifiedClaimsList) Sets a list of verified claims with separate verifications.Methods inherited from class com.nimbusds.openid.connect.sdk.claims.PersonClaims
getAddress, getAddress, getAddressEntries, getAlsoKnownAs, getAlsoKnownAs, getAlsoKnownAsEntries, getBirthdate, getBirthFamilyName, getBirthFamilyName, getBirthFamilyNameEntries, getBirthGivenName, getBirthGivenName, getBirthGivenNameEntries, getBirthMiddleName, getBirthMiddleName, getBirthMiddleNameEntries, getBirthplace, getEmailAddress, getEmailVerified, getFamilyName, getFamilyName, getFamilyNameEntries, getGender, getGivenName, getGivenName, getGivenNameEntries, getLocale, getMiddleName, getMiddleName, getMiddleNameEntries, getMSISDN, getName, getName, getNameEntries, getNationalities, getNickname, getNickname, getNicknameEntries, getPhoneNumber, getPhoneNumberVerified, getPicture, getPlaceOfBirth, getPreferredUsername, getProfile, getSalutation, getSalutation, getSalutationEntries, getTitle, getTitle, getTitleEntries, getUpdatedTime, getWebsite, getZoneinfo, setAddress, setAddress, setAlsoKnownAs, setAlsoKnownAs, setBirthdate, setBirthFamilyName, setBirthFamilyName, setBirthGivenName, setBirthGivenName, setBirthMiddleName, setBirthMiddleName, setBirthplace, setEmailAddress, setEmailVerified, setFamilyName, setFamilyName, setGender, setGivenName, setGivenName, setLocale, setMiddleName, setMiddleName, setMSISDN, setName, setName, setNationalities, setNickname, setNickname, setPhoneNumber, setPhoneNumberVerified, setPicture, setPlaceOfBirth, setPreferredUsername, setProfile, setSalutation, setSalutation, setTitle, setTitle, setUpdatedTime, setWebsite, setZoneinfoMethods inherited from class com.nimbusds.openid.connect.sdk.claims.ClaimsSet
equals, getAudience, getBooleanClaim, getClaim, getClaim, getDateClaim, getIssuer, getJSONArrayClaim, getJSONObjectClaim, getLangTaggedClaim, getNumberClaim, getStringClaim, getStringClaim, getStringListClaim, getURIClaim, getURLClaim, hashCode, putAll, putAll, setAudience, setAudience, setClaim, setClaim, setDateClaim, setIssuer, setURIClaim, setURLClaim, toJSONObject, toJSONString, toJWTClaimsSet, toString
-
Field Details
-
SUB_CLAIM_NAME
The subject claim name.- See Also:
-
VERIFIED_CLAIMS_CLAIM_NAME
The verified claims claim name.- See Also:
-
-
Constructor Details
-
UserInfo
Creates a new minimal UserInfo claims set.- Parameters:
sub- The subject. Must not benull.
-
UserInfo
Creates a new UserInfo claims set from the specified JSON object.- Parameters:
jsonObject- The JSON object. Must not benull.- Throws:
IllegalArgumentException- If the JSON object doesn't contain a subjectsubstring claim.
-
UserInfo
Creates a new UserInfo claims set from the specified JSON Web Token (JWT) claims set.- Parameters:
jwtClaimsSet- The JWT claims set. Must not benull.- Throws:
IllegalArgumentException- If the JWT claims set doesn't contain a subjectsubstring claim.
-
-
Method Details
-
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
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 samesubject. Must not benull.- 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
Gets the UserInfo subject. Corresponds to thesubclaim.- Returns:
- The subject.
-
getVerifiedClaims
Gets the verified claims. Corresponds to theverified_claimsclaim from OpenID Connect for Identity Assurance 1.0.- Returns:
- List of the verified claims sets,
nullif not specified or parsing failed.
-
setVerifiedClaims
Sets the verified claims. Corresponds to theverified_claimsclaim from OpenID Connect for Identity Assurance 1.0.- Parameters:
verifiedClaims- The verified claims set,nullif not specified.
-
setVerifiedClaims
Sets a list of verified claims with separate verifications. Corresponds to theverified_claimsclaim from OpenID Connect for Identity Assurance 1.0.- Parameters:
verifiedClaimsList- List of the verified claims sets,nullif not specified or parsing failed.
-
addAggregatedClaims
Adds the specified aggregated claims provided by an external claims source.- Parameters:
aggregatedClaims- The aggregated claims instance, ifnullnothing will be added.
-
getAggregatedClaims
Gets the included aggregated claims provided by each external claims source.- Returns:
- The aggregated claims,
nullif none are found.
-
addDistributedClaims
Adds the specified distributed claims from an external claims source.- Parameters:
distributedClaims- The distributed claims instance, ifnullnothing will be added.
-
getDistributedClaims
Gets the included distributed claims provided by each external claims source.- Returns:
- The distributed claims,
nullif none are found.
-
parse
Parses a UserInfo claims set from the specified JSON object string.- Parameters:
json- The JSON object string to parse. Must not benull.- Returns:
- The UserInfo claims set.
- Throws:
ParseException- If parsing failed.
-