Package org.forgerock.json.jose.builders
Class JwtClaimsSetBuilder
- java.lang.Object
-
- org.forgerock.json.jose.builders.JwtClaimsSetBuilder
-
public class JwtClaimsSetBuilder extends Object
An implementation of a JWT Claims Set builder that provides a fluent builder pattern to creating JWT Claims Sets.See
JwtClaimsSet
for information on the JwtClaimsSet object that this builder creates.- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description JwtClaimsSetBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JwtClaimsSetBuilder
aud(List<String> aud)
Sets the JWT's intended audience list in the Claims Set.JwtClaimsSet
build()
Creates a JwtClaimsSet instance from the claims set in this builder.JwtClaimsSetBuilder
claim(String key, Object claim)
Adds a custom claim to the JWT Claims Set.JwtClaimsSetBuilder
claims(Map<String,Object> claims)
Sets all of the claims the JWT Claims Set with the values contained in the specified map.JwtClaimsSetBuilder
exp(Date exp)
Sets the expiration time of the JWT in the Claims Set.JwtClaimsSetBuilder
iat(Date iat)
Sets the time the JWT was issued at, in the Claims Set.JwtClaimsSetBuilder
iss(String iss)
Sets the issuer this JWT was issued by.JwtClaimsSetBuilder
iss(URI iss)
Sets the issuer this JWT was issued by.JwtClaimsSetBuilder
jti(String jti)
Sets the unique ID of the JWT.JwtClaimsSetBuilder
nbf(Date nbf)
Sets the time the JWT is not allowed to be processed before, in the Claims Set.JwtClaimsSetBuilder
sub(String sub)
Sets the subject this JWT is issued to.JwtClaimsSetBuilder
sub(URI sub)
Sets the subject this JWT is issued to.JwtClaimsSetBuilder
typ(JwtType typ)
Sets the type of the contents of the Claims Set.
-
-
-
Method Detail
-
claim
public JwtClaimsSetBuilder claim(String key, Object claim)
Adds a custom claim to the JWT Claims Set.- Parameters:
key
- The claim name.claim
- The claim value.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setClaim(String, Object)
-
claims
public JwtClaimsSetBuilder claims(Map<String,Object> claims)
Sets all of the claims the JWT Claims Set with the values contained in the specified map.- Parameters:
claims
- The Map to use to set the claims.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setClaims(java.util.Map)
-
typ
public JwtClaimsSetBuilder typ(JwtType typ)
Sets the type of the contents of the Claims Set.- Parameters:
typ
- The Claims Set content type.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.getType()
-
jti
public JwtClaimsSetBuilder jti(String jti)
Sets the unique ID of the JWT.- Parameters:
jti
- The JWT's ID.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setJwtId(String)
-
iss
public JwtClaimsSetBuilder iss(String iss)
Sets the issuer this JWT was issued by.- Parameters:
iss
- The JWT's issuer.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setIssuer(String)
-
iss
public JwtClaimsSetBuilder iss(URI iss)
Sets the issuer this JWT was issued by.- Parameters:
iss
- The JWT's issuer.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setIssuer(java.net.URI)
-
sub
public JwtClaimsSetBuilder sub(String sub)
Sets the subject this JWT is issued to.- Parameters:
sub
- The JWT's subject.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setSubject(String)
-
sub
public JwtClaimsSetBuilder sub(URI sub)
Sets the subject this JWT is issued to.- Parameters:
sub
- The JWT's subject.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setSubject(java.net.URI)
-
aud
public JwtClaimsSetBuilder aud(List<String> aud)
Sets the JWT's intended audience list in the Claims Set.- Parameters:
aud
- The JWT's audience.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.addAudience(String)
-
iat
public JwtClaimsSetBuilder iat(Date iat)
Sets the time the JWT was issued at, in the Claims Set.- Parameters:
iat
- The JWT's issued at time.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setIssuedAtTime(java.util.Date)
-
nbf
public JwtClaimsSetBuilder nbf(Date nbf)
Sets the time the JWT is not allowed to be processed before, in the Claims Set.- Parameters:
nbf
- The JWT's not before time.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setNotBeforeTime(java.util.Date)
-
exp
public JwtClaimsSetBuilder exp(Date exp)
Sets the expiration time of the JWT in the Claims Set.- Parameters:
exp
- The JWT's expiration time.- Returns:
- This JwtClaimsSetBuilder.
- See Also:
JwtClaimsSet.setExpirationTime(java.util.Date)
-
build
public JwtClaimsSet build()
Creates a JwtClaimsSet instance from the claims set in this builder.- Returns:
- A JwtClaimsSet instance.
-
-