Class AccessTokenOptions

  • Direct Known Subclasses:
    AuthKeyHints

    public class AccessTokenOptions
    extends java.lang.Object
    Contains all options that may be specified to construct an AccessToken
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static AccessTokenOptions.Builder builder()
      Retrieve a new builder of AccessTokensOptions.
      Member getAuthor()
      Retrieve the author of the token (not the member used to sign in, but the Member who created it)
      long getExpiration()  
      java.lang.String getIpMask()  
      java.lang.String getMethods()  
      java.lang.String getName()
      Retrieve the name describing the token
      boolean isPrefixMode()  
      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
      boolean isTechnical()
      Check if this token is created manually or programmatically.
      boolean isUserCreated()
      Check if this token is created manually or programmatically.
      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.
      void setExpiration​(long expiration)
      Specify the expiration date of the token, in the epoch standard format.
      void setIpMask​(java.lang.String ipMask)
      An token may be generated only for authorized ip.
      void setMethods​(java.lang.String methods)
      Parameter to tell wich HTTP methods are allowed for a given token.
      void setName​(java.lang.String name)
      Set the name describing the token
      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).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AccessTokenOptions

        public AccessTokenOptions()
    • 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