public static class JWTClaimsSet.Builder extends Object
Example usage:
JWTClaimsSet claimsSet = new JWTClaimsSet.Builder() .subject("joe") .expirationDate(new Date(1300819380 * 1000l) .claim("http://example.com/is_root", true) .build();
Constructor and Description |
---|
Builder()
Creates a new builder.
|
Builder(JWTClaimsSet jwtClaimsSet)
Creates a new builder with the claims from the specified
set.
|
Modifier and Type | Method and Description |
---|---|
JWTClaimsSet.Builder |
audience(List<String> aud)
Sets the audience (
aud ) claim. |
JWTClaimsSet.Builder |
audience(String aud)
Sets a single-valued audience (
aud ) claim. |
JWTClaimsSet |
build()
Builds a new JWT claims set.
|
JWTClaimsSet.Builder |
claim(String name,
Object value)
Sets the specified claim (registered or custom).
|
JWTClaimsSet.Builder |
expirationTime(Date exp)
Sets the expiration time (
exp ) claim. |
JWTClaimsSet.Builder |
issuer(String iss)
Sets the issuer (
iss ) claim. |
JWTClaimsSet.Builder |
issueTime(Date iat)
Sets the issued-at (
iat ) claim. |
JWTClaimsSet.Builder |
jwtID(String jti)
Sets the JWT ID (
jti ) claim. |
JWTClaimsSet.Builder |
notBeforeTime(Date nbf)
Sets the not-before (
nbf ) claim. |
JWTClaimsSet.Builder |
subject(String sub)
Sets the subject (
sub ) claim. |
public Builder()
public Builder(JWTClaimsSet jwtClaimsSet)
jwtClaimsSet
- The JWT claims set to use. Must not be
null
.public JWTClaimsSet.Builder issuer(String iss)
iss
) claim.iss
- The issuer claim, null
if not specified.public JWTClaimsSet.Builder subject(String sub)
sub
) claim.sub
- The subject claim, null
if not specified.public JWTClaimsSet.Builder audience(List<String> aud)
aud
) claim.aud
- The audience claim, null
if not
specified.public JWTClaimsSet.Builder audience(String aud)
aud
) claim.aud
- The audience claim, null
if not
specified.public JWTClaimsSet.Builder expirationTime(Date exp)
exp
) claim.exp
- The expiration time, null
if not
specified.public JWTClaimsSet.Builder notBeforeTime(Date nbf)
nbf
) claim.nbf
- The not-before claim, null
if not
specified.public JWTClaimsSet.Builder issueTime(Date iat)
iat
) claim.iat
- The issued-at claim, null
if not
specified.public JWTClaimsSet.Builder jwtID(String jti)
jti
) claim.jti
- The JWT ID claim, null
if not specified.public JWTClaimsSet.Builder claim(String name, Object value)
name
- The name of the claim to set. Must not be
null
.value
- The value of the claim to set, null
if
not specified. Should map to a JSON entity.public JWTClaimsSet build()
Copyright © 2017 Connect2id Ltd.. All rights reserved.