Package com.slack.api.token_rotation
Class TokenRotator
java.lang.Object
com.slack.api.token_rotation.TokenRotator
public class TokenRotator extends Object
A utility to perform Slack token rotation.
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_MILLISECONDS_BEFORE_EXPIRATION
-
Constructor Summary
Constructors Constructor Description TokenRotator(MethodsClient methodsClient, long millisecondsBeforeExpiration, String clientId, String clientSecret)
TokenRotator(String clientId, String clientSecret)
-
Method Summary
Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
String
getClientId()
String
getClientSecret()
MethodsClient
getMethodsClient()
long
getMillisecondsBeforeExpiration()
int
hashCode()
Optional<RefreshedToken>
performTokenRotation(RequestConfigurator<CurrentToken.CurrentTokenBuilder> configurator)
Performs token rotation for the given set of token and refresh token.Optional<RefreshedToken>
performTokenRotation(CurrentToken current)
Performs token rotation for the given set of token and refresh token.void
setClientId(String clientId)
void
setClientSecret(String clientSecret)
void
setMethodsClient(MethodsClient methodsClient)
void
setMillisecondsBeforeExpiration(long millisecondsBeforeExpiration)
String
toString()
-
Field Details
-
DEFAULT_MILLISECONDS_BEFORE_EXPIRATION
public static long DEFAULT_MILLISECONDS_BEFORE_EXPIRATION
-
-
Constructor Details
-
TokenRotator
-
TokenRotator
public TokenRotator(MethodsClient methodsClient, long millisecondsBeforeExpiration, String clientId, String clientSecret)
-
-
Method Details
-
performTokenRotation
public Optional<RefreshedToken> performTokenRotation(RequestConfigurator<CurrentToken.CurrentTokenBuilder> configurator) throws TokenRotationExceptionPerforms 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 TokenRotationExceptionPerforms 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
-
getMillisecondsBeforeExpiration
public long getMillisecondsBeforeExpiration() -
getClientId
-
getClientSecret
-
setMethodsClient
-
setMillisecondsBeforeExpiration
public void setMillisecondsBeforeExpiration(long millisecondsBeforeExpiration) -
setClientId
-
setClientSecret
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-