Class JwtClaimsSet

java.lang.Object
com.revetsec.jose.JwtClaimsSet

@Immutable public final class JwtClaimsSet extends Object
An immutable JWT claims set for signing (RFC 7519 section 4), with typed registered claims and JSON custom claims. This is application-supplied content; 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