Interface AccessTokenBuilder


public interface AccessTokenBuilder
The access token builder is able to create AccessToken. For more informations about access tokens have look at AccessToken.
Since:
2.0.0
  • Method Details

    • subject

      AccessTokenBuilder subject(String subject)
      Sets the subject for the token. If the subject is not set the currently authenticated subject will be used instead.
      Parameters:
      subject - subject of token
      Returns:
      * @return this
    • custom

      AccessTokenBuilder custom(String key, Object value)
      Adds a custom entry to the token.
      Parameters:
      key - key of custom entry
      value - value of entry
      Returns:
      this
    • issuer

      AccessTokenBuilder issuer(String issuer)
      Sets the issuer for the token.
      Parameters:
      issuer - issuer name or url
      Returns:
      this
    • expiresIn

      AccessTokenBuilder expiresIn(long count, TimeUnit unit)
      Sets the expiration for the token.
      Parameters:
      count - expiration count
      unit - expiration unit
      Returns:
      this
    • refreshableFor

      AccessTokenBuilder refreshableFor(long count, TimeUnit unit)
      Sets the time how long this token may be refreshed. Set this to 0 (zero) to disable automatic refresh.
      Parameters:
      count - Time unit count. If set to 0, automatic refresh is disabled.
      unit - time unit
      Returns:
      this
    • scope

      AccessTokenBuilder scope(Scope scope)
      Reduces the permissions of the token by providing a scope.
      Parameters:
      scope - scope of token
      Returns:
      this
    • build

      AccessToken build()
      Creates a new AccessToken with the provided settings.
      Returns:
      new AccessToken