Class AccessTokenOptions.Builder

  • Enclosing class:
    AccessTokenOptions

    public static class AccessTokenOptions.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

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