Package com.slack.api.bolt.service
Interface OAuthStateService
-
- All Superinterfaces:
Service
- All Known Implementing Classes:
AmazonS3OAuthStateService
,ClientOnlyOAuthStateService
,FileOAuthStateService
public interface OAuthStateService extends Service
Manages state parameters for Slack OAuth flow.- See Also:
- Slack OAuth
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_EXPIRATION_IN_SECONDS
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addNewStateToDatastore(String state)
Adds a newly generated state value to the server-side datastore.default void
consume(Request request, Response response)
Deletes the state value from the server-side datastore and set a response header to delete the one in session.void
deleteStateFromDatastore(String state)
Deletes a given state value from the server-side datastore.default String
extractStateFromQueryString(Request request)
Returns the state parameter value from a given query string if it exists.default String
extractStateFromSession(Request request)
Returns an underlying state value in a cookie-based session if it exists.default String
generateNewStateValue()
Generates a new unique state parameter value.default String
generateSessionCookieValue(Request request, String state)
Generates a cookie value.default long
getExpirationInSeconds()
Returns the time period of expiration for state values in seconds.default String
getSessionCookieName()
Returns the cookie name used for browser sessions.boolean
isAvailableInDatabase(String state)
Verifies the state value is available in the datastore and returns true if it's valid.default String
issueNewState(Request request, Response response)
Issues a new state parameter and set it in both the browser session and the system's server-side datastore.default boolean
isValid(Request request)
Verifies the given state parameter and returns true if it's valid.-
Methods inherited from interface com.slack.api.bolt.service.Service
initializer
-
-
-
-
Field Detail
-
DEFAULT_EXPIRATION_IN_SECONDS
static final long DEFAULT_EXPIRATION_IN_SECONDS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSessionCookieName
default String getSessionCookieName()
Returns the cookie name used for browser sessions.
-
extractStateFromQueryString
default String extractStateFromQueryString(Request request)
Returns the state parameter value from a given query string if it exists.
-
issueNewState
default String issueNewState(Request request, Response response) throws Exception
Issues a new state parameter and set it in both the browser session and the system's server-side datastore.- Throws:
Exception
-
generateNewStateValue
default String generateNewStateValue()
Generates a new unique state parameter value.
-
getExpirationInSeconds
default long getExpirationInSeconds()
Returns the time period of expiration for state values in seconds.
-
generateSessionCookieValue
default String generateSessionCookieValue(Request request, String state) throws Exception
Generates a cookie value. The default behavior is to use the raw value as-is. If you'd like to go with another representation, have your own class and override this method.- Throws:
Exception
-
addNewStateToDatastore
void addNewStateToDatastore(String state) throws Exception
Adds a newly generated state value to the server-side datastore.- Throws:
Exception
-
isValid
default boolean isValid(Request request)
Verifies the given state parameter and returns true if it's valid. This methods doesn't have any side-effects, so that you can call this method multiple times.
-
extractStateFromSession
default String extractStateFromSession(Request request)
Returns an underlying state value in a cookie-based session if it exists.
-
isAvailableInDatabase
boolean isAvailableInDatabase(String state)
Verifies the state value is available in the datastore and returns true if it's valid.
-
consume
default void consume(Request request, Response response) throws Exception
Deletes the state value from the server-side datastore and set a response header to delete the one in session.- Throws:
Exception
-
-