java.lang.Object
one.jpro.platform.auth.core.jwt.JWTOptions
- All Implemented Interfaces:
Options
Options describing a JWT (JSON Web Token).
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.JWTOptions(JWTOptions other) Copy constructor for JWTOptions. -
Method Summary
Modifier and TypeMethodDescriptionGets the audience claim that identifies the recipients that the JWT is intended for.longGets the size of the cache for storing generated JWTs or validation data.Gets the claims intended for the JWT token.Gets the duration after which the JWT should be considered expired.Gets the issuer claim that identifies the principal that issued the JWT.longGets the leeway for the JWT token's expiration time validation in seconds.Gets the algorithm used to generate a nonce for the JWT token.Gets the subject claim that identifies the principal that is the subject of the JWT.booleanChecks if the "issued at" claim (iat) is being ignored for the JWT validation.setAudience(List<String> audience) Sets the audience claim that identifies the recipients that the JWT is intended for.setCacheSize(long cacheSize) Sets the size of the cache for storing generated JWTs or validation data.Sets the claims for the JWT token.setExpiresIn(Duration expiresIn) Gets the duration after which the JWT should be considered expired.setIgnoreIssuedAt(boolean ignoreIssuedAt) Sets whether the "issued at" claim (iat) should be ignored for the JWT validation.Sets the issuer claim that identifies the principal that issued the JWT.setLeeway(long leeway) Sets the leeway for the JWT token's expiration time validation in seconds.setNonceAlgorithm(String nonceAlgorithm) Sets the algorithm used to generate a nonce for the JWT token.setSubject(String subject) Sets the subject claim that identifies the principal that is the subject of the JWT.org.json.JSONObjecttoJSON()Converts the current JWT options to a JSON object suitable for serialization.
-
Constructor Details
-
JWTOptions
public JWTOptions()Default constructor. -
JWTOptions
Copy constructor for JWTOptions. Initializes a new instance of JWTOptions by copying configuration from another instance.- Parameters:
other- the JWT options to copy
-
-
Method Details
-
getIssuer
Gets the issuer claim that identifies the principal that issued the JWT.- Returns:
- the issuer identifier
-
setIssuer
Sets the issuer claim that identifies the principal that issued the JWT.- Parameters:
issuer- the issuer identifier- Returns:
- the current instance of
JWTOptionsfor method chaining
-
getSubject
Gets the subject claim that identifies the principal that is the subject of the JWT.- Returns:
- the subject identifier
-
setSubject
Sets the subject claim that identifies the principal that is the subject of the JWT.- Parameters:
subject- the subject identifier- Returns:
- the current instance of
JWTOptionsfor method chaining
-
getAudience
Gets the audience claim that identifies the recipients that the JWT is intended for.- Returns:
- the list of audience identifiers
-
setAudience
Sets the audience claim that identifies the recipients that the JWT is intended for.- Parameters:
audience- the list of audience identifiers- Returns:
- the current instance of
JWTOptionsfor method chaining
-
getClaims
Gets the claims intended for the JWT token.- Returns:
- the list of claims
-
setClaims
Sets the claims for the JWT token.- Parameters:
claims- the list of claims to be set for the JWT token- Returns:
- the current instance of
JWTOptionsfor method chaining
-
getLeeway
public long getLeeway()Gets the leeway for the JWT token's expiration time validation in seconds.- Returns:
- the leeway in seconds
-
setLeeway
Sets the leeway for the JWT token's expiration time validation in seconds.- Parameters:
leeway- the leeway in seconds- Returns:
- the current instance of
JWTOptionsfor method chaining
-
isIgnoreIssuedAt
public boolean isIgnoreIssuedAt()Checks if the "issued at" claim (iat) is being ignored for the JWT validation.- Returns:
- true if the "issued at" claim is being ignored; false otherwise
-
setIgnoreIssuedAt
Sets whether the "issued at" claim (iat) should be ignored for the JWT validation.- Parameters:
ignoreIssuedAt- flag indicating whether to ignore the "issued at" claim- Returns:
- the current instance of
JWTOptionsfor method chaining
-
getCacheSize
public long getCacheSize()Gets the size of the cache for storing generated JWTs or validation data.- Returns:
- the cache size
-
setCacheSize
Sets the size of the cache for storing generated JWTs or validation data.- Parameters:
cacheSize- the cache size- Returns:
- the current instance of
JWTOptionsfor method chaining
-
getExpiresIn
Gets the duration after which the JWT should be considered expired.- Returns:
- the
Durationuntil the token expires
-
setExpiresIn
Gets the duration after which the JWT should be considered expired.- Returns:
- the
Durationuntil the token expires
-
getNonceAlgorithm
Gets the algorithm used to generate a nonce for the JWT token.- Returns:
- the nonce algorithm
-
setNonceAlgorithm
Sets the algorithm used to generate a nonce for the JWT token.- Parameters:
nonceAlgorithm- the nonce algorithm- Returns:
- the current instance of
JWTOptionsfor method chaining
-
toJSON
public org.json.JSONObject toJSON()Converts the current JWT options to a JSON object suitable for serialization. This includes all the JWT claim settings and additional options such as leeway, cache size, and expiry duration.
-