Class JwtClaimsSet
JwtClaims instead represents claims that passed validation.
Every registered claim is optional. No clock, expiration, audience or token-profile policy is supplied implicitly,
and no ordering is required between the time claims. Applications choose those values for their token's purpose.
NumericDates preserve the supplied Instant's nanoseconds and use the same years -9999 through 9999 range
that Revetsec accepts when reading JWTs. Audiences are serialized as a non-empty JSON array, even for one audience.
Registered setters replace earlier values, and null clears them. Custom claims add one name per call and
reject duplicates and registered names. Every JwtClaimsSet.Builder.build() returns an independent snapshot, so the
builder can be reused. No serialization is performed while building; the signer's output limits apply when signing.
Claims can carry personal data, so toString() shows none of them. Instances compare by reference.
- Since:
- 1.0.0
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilds an outbound claims set. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull JwtClaimsSet.Builderbuilder()Returns a builder with no claims.Returns the audiences (aud).Returns a claim's JSON value, registered or not.Returns every claim's name, registered claims first and then custom claims in insertion order.Returns the expiration time (exp).Returns the issue time (iat).Returns the issuer (iss).getJwtId()Returns the JWT ID (jti).Returns the time before which the token is not valid (nbf).Returns the subject (sub).Returns every claim as a JSON object, which can carry personal data.toString()Describes this claims set without any claim.
-
Method Details
-
builder
Returns a builder with no claims.- Returns:
- a new builder
- Since:
- 1.0.0
-
getIssuer
-
getSubject
Returns the subject (sub).- Returns:
- the subject, or empty if absent
- Since:
- 1.0.0
-
getAudiences
Returns the audiences (aud).- Returns:
- the unmodifiable audiences in order, or an empty list if absent
- Since:
- 1.0.0
-
getExpiresAt
Returns the expiration time (exp).- Returns:
- the instant, or empty if absent
- Since:
- 1.0.0
-
getIssuedAt
Returns the issue time (iat).- Returns:
- the instant, or empty if absent
- Since:
- 1.0.0
-
getNotBefore
Returns the time before which the token is not valid (nbf).- Returns:
- the instant, or empty if absent
- Since:
- 1.0.0
-
getJwtId
-
getClaim
-
getClaimNames
Returns every claim's name, registered claims first and then custom claims in insertion order.- Returns:
- the unmodifiable claim names
- Since:
- 1.0.0
-
toJsonObject
Returns every claim as a JSON object, which can carry personal data.- Returns:
- the immutable claims set
- Since:
- 1.0.0
-
toString
-