Class AccessTokenOptions
java.lang.Object
com.jalios.jcms.authentication.accesstoken.AccessTokenOptions
- Direct Known Subclasses:
AuthKeyHints
Contains all options that may be specified to construct an AccessToken
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected -
Method Summary
Modifier and TypeMethodDescriptionstatic AccessTokenOptions.Builderbuilder()Retrieve a new builder of AccessTokensOptions.Retrieve the author of the token (not the member used to sign in, but the Member who created it)longgetName()Retrieve the name describing the tokenbooleanbooleanCheck if the revokable options was requested, indicating all required steps should be put in place by token implementors to allow revocation of the tokenbooleanCheck if this token is created manually or programmatically.booleanCheck if this token is created manually or programmatically.voidMark 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.voidAn token may be generated only for authorized ip.voidsetMethods(String methods) Parameter to tell wich HTTP methods are allowed for a given token.voidSet 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 Details
-
AccessTokenOptions
public AccessTokenOptions() -
AccessTokenOptions
-
-
Method Details
-
getName
Retrieve the name describing the token- Returns:
- a name or null if it was not specified
-
setName
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
- Returns:
- a filter on allowed HTTP methods
-
setMethods
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
- Returns:
- a Perl 5 regexp for authorized IP.
-
setIpMask
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
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
Retrieve a new builder of AccessTokensOptions.- Returns:
- a new instance of builder
-