Package com.slack.api.token_rotation
Class TokenRotator
java.lang.Object
com.slack.api.token_rotation.TokenRotator
public class TokenRotator
extends java.lang.Object
A utility to perform Slack token rotation.
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_MILLISECONDS_BEFORE_EXPIRATION -
Constructor Summary
Constructors Constructor Description TokenRotator(MethodsClient methodsClient, long millisecondsBeforeExpiration, java.lang.String clientId, java.lang.String clientSecret)TokenRotator(java.lang.String clientId, java.lang.String clientSecret) -
Method Summary
Modifier and Type Method Description protected booleancanEqual(java.lang.Object other)booleanequals(java.lang.Object o)java.lang.StringgetClientId()java.lang.StringgetClientSecret()MethodsClientgetMethodsClient()longgetMillisecondsBeforeExpiration()inthashCode()java.util.Optional<RefreshedToken>performTokenRotation(RequestConfigurator<CurrentToken.CurrentTokenBuilder> configurator)Performs token rotation for the given set of token and refresh token.java.util.Optional<RefreshedToken>performTokenRotation(CurrentToken current)Performs token rotation for the given set of token and refresh token.voidsetClientId(java.lang.String clientId)voidsetClientSecret(java.lang.String clientSecret)voidsetMethodsClient(MethodsClient methodsClient)voidsetMillisecondsBeforeExpiration(long millisecondsBeforeExpiration)java.lang.StringtoString()
-
Field Details
-
DEFAULT_MILLISECONDS_BEFORE_EXPIRATION
public static long DEFAULT_MILLISECONDS_BEFORE_EXPIRATION
-
-
Constructor Details
-
TokenRotator
public TokenRotator(java.lang.String clientId, java.lang.String clientSecret) -
TokenRotator
public TokenRotator(MethodsClient methodsClient, long millisecondsBeforeExpiration, java.lang.String clientId, java.lang.String clientSecret)
-
-
Method Details
-
performTokenRotation
public java.util.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 java.util.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
public java.lang.String getClientId() -
getClientSecret
public java.lang.String getClientSecret() -
setMethodsClient
-
setMillisecondsBeforeExpiration
public void setMillisecondsBeforeExpiration(long millisecondsBeforeExpiration) -
setClientId
public void setClientId(java.lang.String clientId) -
setClientSecret
public void setClientSecret(java.lang.String clientSecret) -
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other) -
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-