Class AccessTokenOptions.Builder
- java.lang.Object
-
- com.jalios.jcms.authentication.accesstoken.AccessTokenOptions.Builder
-
- Enclosing class:
- AccessTokenOptions
public static class AccessTokenOptions.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccessTokenOptions.Builder
author(Member author)
Set the author of the token (not the member used to sign in, but the Member who created it)AccessTokenOptions
build()
Build a new AccessTokenOptions.AccessTokenOptions.Builder
expiresIn(java.time.Duration duration)
Require expiration of token in specified duration.AccessTokenOptions.Builder
expiresOn(long expirationTime)
Require expiration of token at specified timeAccessTokenOptions.Builder
ipMask(java.lang.String ipMask)
Set the regular expression to check client IP authorized use with the tokenAccessTokenOptions.Builder
methods(java.lang.String... methods)
Set the method authorized for use with the tokenAccessTokenOptions.Builder
name(java.lang.String name)
Set the name describing the tokenAccessTokenOptions.Builder
neverExpires()
Require a token without expiration.AccessTokenOptions.Builder
prefixMode(boolean prefixMode)
Tells if an token has to be generated for only a given URL (default behaviour), or a range of URL beginning with a given prefix (prefix mode).AccessTokenOptions.Builder
revokable()
Indicate that this token is created to be revokable.AccessTokenOptions.Builder
revokable(boolean revokable)
Indicate wether this token is created to be revokable or not.AccessTokenOptions.Builder
technical(boolean technical)
Set wether token is created manually or programmaticallyAccessTokenOptions.Builder
userCreated()
Indicate this token is created manually by a user action in the token manager UI.
-
-
-
Method Detail
-
name
public AccessTokenOptions.Builder name(java.lang.String name)
Set the name describing the token- Parameters:
name
- the name of the token- Returns:
- this for method chaining
-
prefixMode
public AccessTokenOptions.Builder prefixMode(boolean prefixMode)
Tells if an token has to be generated for only a given URL (default behaviour), or a range of URL beginning with a given prefix (prefix mode).- Parameters:
prefixMode
- true to enable prefix mode, false to allow exact URL- Returns:
- this for method chaining
-
expiresOn
public AccessTokenOptions.Builder expiresOn(long expirationTime)
Require expiration of token at specified time- Parameters:
expirationTime
- epoch time- Returns:
- this for method chaining
-
expiresIn
public AccessTokenOptions.Builder expiresIn(java.time.Duration duration)
Require expiration of token in specified duration.- Parameters:
duration
- a duration- Returns:
- this for method chaining
-
neverExpires
public AccessTokenOptions.Builder neverExpires()
Require a token without expiration.- Returns:
- this for method chaining
-
methods
public AccessTokenOptions.Builder methods(java.lang.String... methods)
Set the method authorized for use with the token- Parameters:
methods
- some HTTP method name, upper case (GET, POST, PUT, DELETE)- Returns:
- this for method chaining
-
ipMask
public AccessTokenOptions.Builder ipMask(java.lang.String ipMask)
Set the regular expression to check client IP authorized use with the token- Parameters:
ipMask
- a regular expression- Returns:
- this for method chaining
-
revokable
public AccessTokenOptions.Builder revokable(boolean revokable)
Indicate wether this token is created to be revokable or not.- Returns:
- this for method chaining
-
revokable
public AccessTokenOptions.Builder revokable()
Indicate that this token is created to be revokable.- Returns:
- this for method chaining
-
author
public AccessTokenOptions.Builder author(Member author)
Set the author of the token (not the member used to sign in, but the Member who created it)- Parameters:
author
- a Member- Returns:
- this for method chaining
-
userCreated
public AccessTokenOptions.Builder userCreated()
Indicate this token is created manually by a user action in the token manager UI.- Returns:
- this for method chaining
-
technical
public AccessTokenOptions.Builder technical(boolean technical)
Set wether token is created manually or programmatically- Parameters:
technical
- true if token is being created automatically by a program (default value), false if token was created manually by a user action in the token manager UI.- Returns:
- this for method chaining
-
build
public AccessTokenOptions build()
Build a new AccessTokenOptions.- Returns:
- a new AccessTokenOptions instance.
-
-