Class TokenRotator

java.lang.Object
com.slack.api.token_rotation.TokenRotator

public class TokenRotator extends Object
A utility to perform Slack token rotation.
  • Field Details

    • DEFAULT_MILLISECONDS_BEFORE_EXPIRATION

      public static long DEFAULT_MILLISECONDS_BEFORE_EXPIRATION
  • Constructor Details

    • TokenRotator

      public TokenRotator(String clientId, String clientSecret)
    • TokenRotator

      public TokenRotator(MethodsClient methodsClient, long millisecondsBeforeExpiration, String clientId, String clientSecret)
  • Method Details

    • performTokenRotation

      Performs token rotation for the given set of token and refresh token. This method returns non-empty value only when the rotation is done. If you get the refreshed token data, your datastore must update the database record to have the new ones.
      Throws:
      TokenRotationException
    • performTokenRotation

      public Optional<RefreshedToken> performTokenRotation(CurrentToken current) throws TokenRotationException
      Performs token rotation for the given set of token and refresh token. This method returns non-empty value only when the rotation is done. If you get the refreshed token data, your datastore must update the database record to have the new ones.
      Throws:
      TokenRotationException
    • getMethodsClient

      public MethodsClient getMethodsClient()
    • getMillisecondsBeforeExpiration

      public long getMillisecondsBeforeExpiration()
    • getClientId

      public String getClientId()
    • getClientSecret

      public String getClientSecret()
    • setMethodsClient

      public void setMethodsClient(MethodsClient methodsClient)
    • setMillisecondsBeforeExpiration

      public void setMillisecondsBeforeExpiration(long millisecondsBeforeExpiration)
    • setClientId

      public void setClientId(String clientId)
    • setClientSecret

      public void setClientSecret(String clientSecret)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object