Class AccessTokenOptions

java.lang.Object
com.jalios.jcms.authentication.accesstoken.AccessTokenOptions
Direct Known Subclasses:
AuthKeyHints

public class AccessTokenOptions extends Object
Contains all options that may be specified to construct an AccessToken
  • Constructor Details

    • AccessTokenOptions

      public AccessTokenOptions()
    • AccessTokenOptions

      protected AccessTokenOptions(AccessTokenOptions.Builder builder)
  • Method Details

    • getName

      public String getName()
      Retrieve the name describing the token
      Returns:
      a name or null if it was not specified
    • setName

      public void setName(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 String getMethods()
      Returns:
      a filter on allowed HTTP methods
    • setMethods

      public void setMethods(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 String getIpMask()
      Returns:
      a Perl 5 regexp for authorized IP.
    • setIpMask

      public void setIpMask(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