|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nimbusds.jwt.ClaimsSet
public class ClaimsSet
JSON Web Token (JWT) claims set.
Supports all reserved claims
of the JWT
specification:
The set may also carry custom claims
; these will
be serialised and parsed along the reserved ones.
Constructor Summary | |
---|---|
ClaimsSet()
Creates a new empty claims set. |
Method Summary | |
---|---|
String[] |
getAudienceClaim()
Gets the audience ( aud ) clam. |
Object |
getCustomClaim(String name)
Gets a custom (public or private) claim. |
Map<String,Object> |
getCustomClaims()
Gets the custom (non-reserved) claims. |
long |
getExpirationTimeClaim()
Gets the expiration time ( exp ) claim. |
long |
getIssuedAtClaim()
Gets the issued-at ( iat ) claim. |
String |
getIssuerClaim()
Gets the issuer ( iss ) claim. |
String |
getJWTIDClaim()
Gets the JWT ID ( jti ) claim. |
long |
getNotBeforeClaim()
Gets the not-before ( nbf ) claim. |
static Set<String> |
getReservedNames()
Gets the reserved claim names. |
String |
getSubjectClaim()
Gets the subject ( sub ) claim. |
String |
getTypeClaim()
Gets the type ( typ ) claim. |
static ClaimsSet |
parse(net.minidev.json.JSONObject json)
Parses a JSON Web Token (JWT) claims set from the specified JSON object representation. |
void |
setAudienceClaim(String[] aud)
Sets the audience ( aud ) clam. |
void |
setCustomClaim(String name,
Object value)
Sets a custom (public or private) claim. |
void |
setCustomClaims(Map<String,Object> customClaims)
Sets the custom (non-reserved) claims. |
void |
setExpirationTimeClaim(long exp)
Sets the expiration time ( exp ) claim. |
void |
setIssuedAtClaim(long iat)
Sets the issued-at ( iat ) claim. |
void |
setIssuerClaim(String iss)
Sets the issuer ( iss ) claim. |
void |
setJWTIDClaim(String jti)
Sets the JWT ID ( jti ) claim. |
void |
setNotBeforeClaim(long nbf)
Sets the not-before ( nbf ) claim. |
void |
setSubjectClaim(String sub)
Sets the subject ( sub ) claim. |
void |
setTypeClaim(String typ)
Sets the type ( typ ) claim. |
net.minidev.json.JSONObject |
toJSONObject()
Returns the JSON object representation of the claims set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClaimsSet()
Method Detail |
---|
public static Set<String> getReservedNames()
public String getIssuerClaim()
ReadOnlyClaimsSet
iss
) claim.
getIssuerClaim
in interface ReadOnlyClaimsSet
null
if not specified.public void setIssuerClaim(String iss)
iss
) claim.
iss
- The issuer claim, null
if not specified.public String getSubjectClaim()
ReadOnlyClaimsSet
sub
) claim.
getSubjectClaim
in interface ReadOnlyClaimsSet
null
if not specified.public void setSubjectClaim(String sub)
sub
) claim.
sub
- The subject claim, null
if not specified.public String[] getAudienceClaim()
ReadOnlyClaimsSet
aud
) clam.
getAudienceClaim
in interface ReadOnlyClaimsSet
null
if not specified.public void setAudienceClaim(String[] aud)
aud
) clam.
aud
- The audience claim, null
if not specified.public long getExpirationTimeClaim()
ReadOnlyClaimsSet
exp
) claim.
getExpirationTimeClaim
in interface ReadOnlyClaimsSet
public void setExpirationTimeClaim(long exp)
exp
) claim.
exp
- The expiration time, -1 if not specified.public long getNotBeforeClaim()
ReadOnlyClaimsSet
nbf
) claim.
getNotBeforeClaim
in interface ReadOnlyClaimsSet
public void setNotBeforeClaim(long nbf)
nbf
) claim.
nbf
- The not-before claim, -1 if not specified.public long getIssuedAtClaim()
ReadOnlyClaimsSet
iat
) claim.
getIssuedAtClaim
in interface ReadOnlyClaimsSet
public void setIssuedAtClaim(long iat)
iat
) claim.
iat
- The issued-at claim, -1 if not specified.public String getJWTIDClaim()
ReadOnlyClaimsSet
jti
) claim.
getJWTIDClaim
in interface ReadOnlyClaimsSet
null
if not specified.public void setJWTIDClaim(String jti)
jti
) claim.
jti
- The JWT ID claim, null
if not specified.public String getTypeClaim()
ReadOnlyClaimsSet
typ
) claim.
getTypeClaim
in interface ReadOnlyClaimsSet
null
if not specified.public void setTypeClaim(String typ)
typ
) claim.
typ
- The type claim, null
if not specified.public Object getCustomClaim(String name)
ReadOnlyClaimsSet
getCustomClaim
in interface ReadOnlyClaimsSet
name
- The name of the custom claim. Must not be null
.
null
if not specified.public void setCustomClaim(String name, Object value)
name
- The name of the custom claim. Must not be null
.value
- The value of the custom claim, should map to a valid
JSON entity, null
if not specified.
IllegalArgumentException
- If the specified custom claim name
matches a reserved claim name.public Map<String,Object> getCustomClaims()
ReadOnlyClaimsSet
getCustomClaims
in interface ReadOnlyClaimsSet
public void setCustomClaims(Map<String,Object> customClaims)
customClaims
- The custom claims, empty map or null
if
none.public net.minidev.json.JSONObject toJSONObject()
ReadOnlyClaimsSet
toJSONObject
in interface ReadOnlyClaimsSet
public static ClaimsSet parse(net.minidev.json.JSONObject json) throws ParseException
json
- The JSON object to parse. Must not be null
.
ParseException
- If the specified JSON object doesn't represent
a valid JWT claims set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |