Class JwtClaimsSet.Builder
- java.lang.Object
-
- org.springframework.security.oauth2.jwt.JwtClaimsSet.Builder
-
- Enclosing class:
- JwtClaimsSet
public static final class JwtClaimsSet.Builder extends java.lang.ObjectA builder forJwtClaimsSet.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JwtClaimsSet.Builderaudience(java.util.List<java.lang.String> audience)Sets the audience(aud)claim, which identifies the recipient(s) that the JWT is intended for.JwtClaimsSetbuild()Builds a newJwtClaimsSet.JwtClaimsSet.Builderclaim(java.lang.String name, java.lang.Object value)Sets the claim.JwtClaimsSet.Builderclaims(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> claimsConsumer)AConsumerto be provided access to the claims allowing the ability to add, replace, or remove.JwtClaimsSet.BuilderexpiresAt(java.time.Instant expiresAt)Sets the expiration time(exp)claim, which identifies the time on or after which the JWT MUST NOT be accepted for processing.JwtClaimsSet.Builderid(java.lang.String jti)Sets the JWT ID(jti)claim, which provides a unique identifier for the JWT.JwtClaimsSet.BuilderissuedAt(java.time.Instant issuedAt)Sets the issued at(iat)claim, which identifies the time at which the JWT was issued.JwtClaimsSet.Builderissuer(java.lang.String issuer)Sets the issuer(iss)claim, which identifies the principal that issued the JWT.JwtClaimsSet.BuildernotBefore(java.time.Instant notBefore)Sets the not before(nbf)claim, which identifies the time before which the JWT MUST NOT be accepted for processing.JwtClaimsSet.Buildersubject(java.lang.String subject)Sets the subject(sub)claim, which identifies the principal that is the subject of the JWT.
-
-
-
Method Detail
-
issuer
public JwtClaimsSet.Builder issuer(java.lang.String issuer)
Sets the issuer(iss)claim, which identifies the principal that issued the JWT.- Parameters:
issuer- the issuer identifier- Returns:
- the
JwtClaimsSet.Builder
-
subject
public JwtClaimsSet.Builder subject(java.lang.String subject)
Sets the subject(sub)claim, which identifies the principal that is the subject of the JWT.- Parameters:
subject- the subject identifier- Returns:
- the
JwtClaimsSet.Builder
-
audience
public JwtClaimsSet.Builder audience(java.util.List<java.lang.String> audience)
Sets the audience(aud)claim, which identifies the recipient(s) that the JWT is intended for.- Parameters:
audience- the audience that this JWT is intended for- Returns:
- the
JwtClaimsSet.Builder
-
expiresAt
public JwtClaimsSet.Builder expiresAt(java.time.Instant expiresAt)
Sets the expiration time(exp)claim, which identifies the time on or after which the JWT MUST NOT be accepted for processing.- Parameters:
expiresAt- the time on or after which the JWT MUST NOT be accepted for processing- Returns:
- the
JwtClaimsSet.Builder
-
notBefore
public JwtClaimsSet.Builder notBefore(java.time.Instant notBefore)
Sets the not before(nbf)claim, which identifies the time before which the JWT MUST NOT be accepted for processing.- Parameters:
notBefore- the time before which the JWT MUST NOT be accepted for processing- Returns:
- the
JwtClaimsSet.Builder
-
issuedAt
public JwtClaimsSet.Builder issuedAt(java.time.Instant issuedAt)
Sets the issued at(iat)claim, which identifies the time at which the JWT was issued.- Parameters:
issuedAt- the time at which the JWT was issued- Returns:
- the
JwtClaimsSet.Builder
-
id
public JwtClaimsSet.Builder id(java.lang.String jti)
Sets the JWT ID(jti)claim, which provides a unique identifier for the JWT.- Parameters:
jti- the unique identifier for the JWT- Returns:
- the
JwtClaimsSet.Builder
-
claim
public JwtClaimsSet.Builder claim(java.lang.String name, java.lang.Object value)
Sets the claim.- Parameters:
name- the claim namevalue- the claim value- Returns:
- the
JwtClaimsSet.Builder
-
claims
public JwtClaimsSet.Builder claims(java.util.function.Consumer<java.util.Map<java.lang.String,java.lang.Object>> claimsConsumer)
AConsumerto be provided access to the claims allowing the ability to add, replace, or remove.- Parameters:
claimsConsumer- aConsumerof the claims
-
build
public JwtClaimsSet build()
Builds a newJwtClaimsSet.- Returns:
- a
JwtClaimsSet
-
-