Class CWTClaimsSetBuilder
java.lang.Object
com.authlete.cwt.CWTClaimsSetBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSet the "aud (3)" claim.build()
Build an instance of theCWTClaimsSet
class.cti
(byte[] identifier) Set the "cti (7)" claim.Set the "cti (7)" claim.exp
(long expirationTime) Set the "exp (4)" claim.Set the "exp (4)" claim.iat
(long issuedAt) Set the "iat (6)" claim.Set the "iat (6)" claim.Set the "iss (1)" claim.nbf
(long notBefore) Set the "nbf (5)" claim.Set the "nbf (5)" claim.nonce
(byte[] nonce) Set the "Nonce (10)" claim.Set the "Nonce (10)" claim.Add a claim.Set the "sub (2)" claim.
-
Constructor Details
-
CWTClaimsSetBuilder
public CWTClaimsSetBuilder()
-
-
Method Details
-
put
Add a claim.- Parameters:
key
- The key of the claim. A pre-defined numeric claim key (e.g.CWTClaims.ISS
) or a string name.value
- The value of the claim.- Returns:
this
object.
-
iss
Set the "iss (1)" claim.- Parameters:
issuer
- The value of theiss
claim.- Returns:
this
object.
-
sub
Set the "sub (2)" claim.- Parameters:
subject
- The value of thesub
claim.- Returns:
this
object.
-
aud
Set the "aud (3)" claim.- Parameters:
audience
- The value of theaud
claim.- Returns:
this
object.
-
exp
Set the "exp (4)" claim.- Parameters:
expirationTime
- The value of theexp
claim.- Returns:
this
object.
-
exp
Set the "exp (4)" claim.- Parameters:
expirationTime
- The value of theexp
claim. A time expressed in seconds elapsed since the Unix epoch.- Returns:
this
object.
-
nbf
Set the "nbf (5)" claim.- Parameters:
notBefore
- The value of thenbf
claim.- Returns:
this
object.
-
nbf
Set the "nbf (5)" claim.- Parameters:
notBefore
- The value of thenbf
claim. A time expressed in seconds elapsed since the Unix epoch.- Returns:
this
object.
-
iat
Set the "iat (6)" claim.- Parameters:
issuedAt
- The value of theiat
claim.- Returns:
this
object.
-
iat
Set the "iat (6)" claim.- Parameters:
issuedAt
- The value of theiat
claim. A time expressed in seconds elapsed since the Unix epoch.- Returns:
this
object.
-
cti
Set the "cti (7)" claim.- Parameters:
identifier
- The value of thecti
claim (CWT ID). The UTF-8 byte sequence of the given string is used as the actual value of the claim.- Returns:
this
object.
-
cti
Set the "cti (7)" claim.- Parameters:
identifier
- The value of thecti
claim (CWT ID).- Returns:
this
object.
-
nonce
Set the "Nonce (10)" claim.- Parameters:
nonce
- The value of theNonce
claim. The UTF-8 byte sequence of the given string is used as the actual value of the claim.- Returns:
this
object.
-
nonce
Set the "Nonce (10)" claim.- Parameters:
nonce
- The value of theNonce
claim.- Returns:
this
object.
-
build
Build an instance of theCWTClaimsSet
class.- Returns:
- An instance of the
CWTClaimsSet
class.
-