Top Description Fields Methods
jakarta.security.enterprise.identitystore.openid

public Interface JwtClaims

extends Claims
Imports
java.time.Clock, .Duration, .Instant, java.util.Collections, .List, .Optional, .OptionalDouble, .OptionalInt, .OptionalLong

Standard JWT claims. A token typically.

Field Summary

Modifier and TypeField and Description
public static final JwtClaims
NONE

Singleton instance representing no claims

Method Summary

Modifier and TypeMethod and Description
public default List<String>

Returns:

non-null set representing the values of aud claim
getAudience
()

The recipients that the JWT is intended for.

public default Optional<Instant>

Returns:

value of exp claim
getExpirationTime
()

Expiration time on or after which the JWT MUST NOT be accepted for processing.

public default Optional<Instant>

Returns:

value of exp claim
getIssuedAt
()

The time at which the JWT was issued.

public default Optional<String>

Returns:

value of iss claim
getIssuer
()

The principal that issued the JWT

public default Optional<String>

Returns:

value of jti claim
getJwtId
()

Unique identifier for the JWT

public default Optional<Instant>
getNotBeforeTime()

The time before which the JWT MUST NOT be accepted for processing.

public default Optional<String>

Returns:

value of sub claim
getSubject
()

The principal that is the subject of the JWT.

public default boolean
isBeforeValidity(Clock
Clock representing reference time of checking
clock
,
boolean
indication, whether the claim is required, i. e. whether token without nbf is considered before validity
required
,
Duration
allowed clock skew to account for drift between provider and us
skew
)

Check if JWT is before its defined validity

public default boolean

Returns:

true when current time is past expiration time, or exp claim is not present and required is true
isExpired
(Clock
Clock representing reference time of checking
clock
,
boolean
indication whether the claim is required, i. e. whether token with claim is considered expired
required
,
Duration
allowed clock skew to account for drift between provider and us
skew
)

Check if JWT is expired

public default boolean

Returns:

true if exp token is present and within limits and nbf is within limits when present
isValid
()

Check JWT validity against current time with 1MIN clock skew.

Inherited from jakarta.security.enterprise.identitystore.openid.Claims:
getArrayStringClaimgetDoubleClaimgetIntClaimgetLongClaimgetNestedgetNumericDateClaimgetStringClaim

Field Detail

NONEback to summary
public static final JwtClaims NONE

Singleton instance representing no claims

Method Detail

getAudienceback to summary
public default List<String> getAudience()

The recipients that the JWT is intended for. To ease work with the field, audience is always represented as list, also in special cases -- it is singleton list when it was a string in the token, and empty set if it was not present.

Returns:List<String>

non-null set representing the values of aud claim

getExpirationTimeback to summary
public default Optional<Instant> getExpirationTime()

Expiration time on or after which the JWT MUST NOT be accepted for processing.

Returns:Optional<Instant>

value of exp claim

getIssuedAtback to summary
public default Optional<Instant> getIssuedAt()

The time at which the JWT was issued.

Returns:Optional<Instant>

value of exp claim

getIssuerback to summary
public default Optional<String> getIssuer()

The principal that issued the JWT

Returns:Optional<String>

value of iss claim

getJwtIdback to summary
public default Optional<String> getJwtId()

Unique identifier for the JWT

Returns:Optional<String>

value of jti claim

getNotBeforeTimeback to summary
public default Optional<Instant> getNotBeforeTime()

The time before which the JWT MUST NOT be accepted for processing.

getSubjectback to summary
public default Optional<String> getSubject()

The principal that is the subject of the JWT. The claims in a JWT are normally statements about the subject.

Returns:Optional<String>

value of sub claim

isBeforeValidityback to summary
public default boolean isBeforeValidity(Clock clock, boolean required, Duration skew)

Check if JWT is before its defined validity

Parameters
clock:Clock

Clock representing reference time of checking

required:boolean

indication, whether the claim is required, i. e. whether token without nbf is considered before validity

skew:Duration

allowed clock skew to account for drift between provider and us

isExpiredback to summary
public default boolean isExpired(Clock clock, boolean required, Duration skew)

Check if JWT is expired

Parameters
clock:Clock

Clock representing reference time of checking

required:boolean

indication whether the claim is required, i. e. whether token with claim is considered expired

skew:Duration

allowed clock skew to account for drift between provider and us

Returns:boolean

true when current time is past expiration time, or exp claim is not present and required is true

isValidback to summary
public default boolean isValid()

Check JWT validity against current time with 1MIN clock skew.

Returns:boolean

true if exp token is present and within limits and nbf is within limits when present