|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.nimbusds.jwt.JWTClaimsSet
public class JWTClaimsSet
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 | |
|---|---|
JWTClaimsSet()
Creates a new empty JWT claims set. |
|
| Method Summary | |
|---|---|
String[] |
getAudienceClaim()
Gets the audience ( aud) clam. |
Object |
getCustomClaim(String name)
Gets a custom (non-reserved) 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 JWT claim names. |
String |
getSubjectClaim()
Gets the subject ( sub) claim. |
String |
getTypeClaim()
Gets the type ( typ) claim. |
static JWTClaimsSet |
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 (non-reserved) 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 JWTClaimsSet()
| Method Detail |
|---|
public static Set<String> getReservedNames()
public String getIssuerClaim()
ReadOnlyJWTClaimsSetiss) claim.
getIssuerClaim in interface ReadOnlyJWTClaimsSetnull if not specified.public void setIssuerClaim(String iss)
iss) claim.
iss - The issuer claim, null if not specified.public String getSubjectClaim()
ReadOnlyJWTClaimsSetsub) claim.
getSubjectClaim in interface ReadOnlyJWTClaimsSetnull if not specified.public void setSubjectClaim(String sub)
sub) claim.
sub - The subject claim, null if not specified.public String[] getAudienceClaim()
ReadOnlyJWTClaimsSetaud) clam.
getAudienceClaim in interface ReadOnlyJWTClaimsSetnull if not specified.public void setAudienceClaim(String[] aud)
aud) clam.
aud - The audience claim, null if not specified.public long getExpirationTimeClaim()
ReadOnlyJWTClaimsSetexp) claim.
getExpirationTimeClaim in interface ReadOnlyJWTClaimsSetpublic void setExpirationTimeClaim(long exp)
exp) claim.
exp - The expiration time, -1 if not specified.public long getNotBeforeClaim()
ReadOnlyJWTClaimsSetnbf) claim.
getNotBeforeClaim in interface ReadOnlyJWTClaimsSetpublic void setNotBeforeClaim(long nbf)
nbf) claim.
nbf - The not-before claim, -1 if not specified.public long getIssuedAtClaim()
ReadOnlyJWTClaimsSetiat) claim.
getIssuedAtClaim in interface ReadOnlyJWTClaimsSetpublic void setIssuedAtClaim(long iat)
iat) claim.
iat - The issued-at claim, -1 if not specified.public String getJWTIDClaim()
ReadOnlyJWTClaimsSetjti) claim.
getJWTIDClaim in interface ReadOnlyJWTClaimsSetnull if not specified.public void setJWTIDClaim(String jti)
jti) claim.
jti - The JWT ID claim, null if not specified.public String getTypeClaim()
ReadOnlyJWTClaimsSettyp) claim.
getTypeClaim in interface ReadOnlyJWTClaimsSetnull if not specified.public void setTypeClaim(String typ)
typ) claim.
typ - The type claim, null if not specified.public Object getCustomClaim(String name)
ReadOnlyJWTClaimsSet
getCustomClaim in interface ReadOnlyJWTClaimsSetname - 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()
ReadOnlyJWTClaimsSet
getCustomClaims in interface ReadOnlyJWTClaimsSetpublic void setCustomClaims(Map<String,Object> customClaims)
customClaims - The custom claims, empty map or null if
none.public net.minidev.json.JSONObject toJSONObject()
ReadOnlyJWTClaimsSet
toJSONObject in interface ReadOnlyJWTClaimsSet
public static JWTClaimsSet 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 | |||||||||