Class JwtClaims.Builder
java.lang.Object
cloud.opencode.base.crypto.jwt.JwtClaims.Builder
- Enclosing class:
JwtClaims
Builder for JwtClaims.
JwtClaims 构建器。
- Since:
- JDK 25, opencode-base-crypto V1.2.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionSets the audience claim.Sets the audience claim with multiple values.build()Builds the JwtClaims instance.Sets a custom claim.Sets multiple claims from a map.expiration(Instant expiration) Sets the expiration time.Sets the expiration time relative to now.Generates a random JWT ID.Sets the issued-at time.Sets the issued-at time to now.Sets the issuer claim.Sets the JWT ID.Sets the not-before time.Sets the subject claim.
-
Method Details
-
issuer
Sets the issuer claim. 设置签发者声明。- Parameters:
issuer- the issuer- Returns:
- this builder
-
subject
Sets the subject claim. 设置主题声明。- Parameters:
subject- the subject- Returns:
- this builder
-
audience
Sets the audience claim. 设置受众声明。- Parameters:
audience- the audience- Returns:
- this builder
-
audience
Sets the audience claim with multiple values. 设置多值受众声明。- Parameters:
audiences- the audiences- Returns:
- this builder
-
expiration
Sets the expiration time. 设置过期时间。- Parameters:
expiration- the expiration instant- Returns:
- this builder
-
expiresIn
Sets the expiration time relative to now. 设置相对于当前时间的过期时间。- Parameters:
duration- the duration from now- Returns:
- this builder
-
notBefore
Sets the not-before time. 设置生效时间。- Parameters:
notBefore- the not-before instant- Returns:
- this builder
-
issuedAtNow
Sets the issued-at time to now. 设置签发时间为当前时间。- Returns:
- this builder
-
issuedAt
Sets the issued-at time. 设置签发时间。- Parameters:
issuedAt- the issued-at instant- Returns:
- this builder
-
jwtId
Sets the JWT ID. 设置 JWT ID。- Parameters:
jwtId- the JWT ID- Returns:
- this builder
-
generateJwtId
Generates a random JWT ID. 生成随机 JWT ID。- Returns:
- this builder
-
claim
Sets a custom claim. 设置自定义声明。- Parameters:
name- the claim namevalue- the claim value- Returns:
- this builder
-
claims
Sets multiple claims from a map. 从映射设置多个声明。- Parameters:
claims- the claims map- Returns:
- this builder
-
build
-