Class AccessTokenOptions
- java.lang.Object
-
- com.jalios.jcms.authentication.accesstoken.AccessTokenOptions
-
- Direct Known Subclasses:
AuthKeyHints
public class AccessTokenOptions extends java.lang.ObjectContains all options that may be specified to construct an AccessToken
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAccessTokenOptions.Builder
-
Constructor Summary
Constructors Modifier Constructor Description AccessTokenOptions()protectedAccessTokenOptions(AccessTokenOptions.Builder builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static AccessTokenOptions.Builderbuilder()Retrieve a new builder of AccessTokensOptions.MembergetAuthor()Retrieve the author of the token (not the member used to sign in, but the Member who created it)longgetExpiration()java.lang.StringgetIpMask()java.lang.StringgetMethods()java.lang.StringgetName()Retrieve the name describing the tokenbooleanisPrefixMode()booleanisRevokable()Check if the revokable options was requested, indicating all required steps should be put in place by token implementors to allow revocation of the tokenbooleanisTechnical()Check if this token is created manually or programmatically.booleanisUserCreated()Check if this token is created manually or programmatically.voidrevokable()Mark this token as revokable, indicating all required steps should be put in place by token implementors to allow revocation of the generated token.voidsetExpiration(long expiration)Specify the expiration date of the token, in the epoch standard format.voidsetIpMask(java.lang.String ipMask)An token may be generated only for authorized ip.voidsetMethods(java.lang.String methods)Parameter to tell wich HTTP methods are allowed for a given token.voidsetName(java.lang.String name)Set the name describing the tokenvoidsetPrefixMode(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).
-
-
-
Constructor Detail
-
AccessTokenOptions
public AccessTokenOptions()
-
AccessTokenOptions
protected AccessTokenOptions(AccessTokenOptions.Builder builder)
-
-
Method Detail
-
getName
public java.lang.String getName()
Retrieve the name describing the token- Returns:
- a name or null if it was not specified
-
setName
public void setName(java.lang.String name)
Set the name describing the token- Parameters:
name- a text describing the token
-
isPrefixMode
public boolean isPrefixMode()
- Returns:
- true if the token must be generated for a range of URL given a prefix URL.
-
setPrefixMode
public void setPrefixMode(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-
-
getExpiration
public long getExpiration()
- Returns:
- the expiration date in the epoch format.
-
setExpiration
public void setExpiration(long expiration)
Specify the expiration date of the token, in the epoch standard format.If a negative value is set, the default duration of the token implementation is applied.
If zero is specified, token will never expires.- Parameters:
expiration- the expiration time in epoch standard format
-
getMethods
public java.lang.String getMethods()
- Returns:
- a filter on allowed HTTP methods
-
setMethods
public void setMethods(java.lang.String methods)
Parameter to tell wich HTTP methods are allowed for a given token. A request is allowed if the HTTP method of the request is contained (as a substring) in the "methods" field.- Parameters:
methods-
-
getIpMask
public java.lang.String getIpMask()
- Returns:
- a Perl 5 regexp for authorized IP.
-
setIpMask
public void setIpMask(java.lang.String ipMask)
An token may be generated only for authorized ip. The ipmask field defines a Perl 5 regular expression to restrict the token to a given mask of IP addresses.- Parameters:
ipMask- a Perl 5 regexp for authorized IP.
-
getAuthor
public Member getAuthor()
Retrieve the author of the token (not the member used to sign in, but the Member who created it)- Returns:
- a Member or null if it was not specified
-
isTechnical
public boolean isTechnical()
Check if this token is created manually or programmatically.Opposite of
isUserCreated()- Returns:
- true if token is created automatically by a program, false if token is created manually by a user action in the token manager UI
-
isUserCreated
public boolean isUserCreated()
Check if this token is created manually or programmatically.Opposite of
isTechnical()- Returns:
- true if token is created manually by a user action in the token manager UI, false if token created automatically by a program.
-
revokable
public void revokable()
Mark this token as revokable, indicating all required steps should be put in place by token implementors to allow revocation of the generated token.
-
isRevokable
public boolean isRevokable()
Check if the revokable options was requested, indicating all required steps should be put in place by token implementors to allow revocation of the token- Returns:
- true if token should be revokable false otherwise
-
builder
public static AccessTokenOptions.Builder builder()
Retrieve a new builder of AccessTokensOptions.- Returns:
- a new instance of builder
-
-