Package com.slack.api.bolt.service
Interface OAuthStateService
- All Superinterfaces:
Service
- All Known Implementing Classes:
AmazonS3OAuthStateService
,ClientOnlyOAuthStateService
,FileOAuthStateService
Manages state parameters for Slack OAuth flow.
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNewStateToDatastore
(String state) Adds a newly generated state value to the server-side datastore.default void
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
Generates a new unique state parameter value.default String
generateSessionCookieValue
(Request request, String state) Generates a cookie value.default long
Returns the time period of expiration for state values in seconds.default String
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
Verifies the given state parameter and returns true if it's valid.Methods inherited from interface com.slack.api.bolt.service.Service
initializer
-
Field Details
-
DEFAULT_EXPIRATION_IN_SECONDS
static final long DEFAULT_EXPIRATION_IN_SECONDS- See Also:
-
-
Method Details
-
getSessionCookieName
Returns the cookie name used for browser sessions. -
extractStateFromQueryString
Returns the state parameter value from a given query string if it exists. -
issueNewState
Issues a new state parameter and set it in both the browser session and the system's server-side datastore.- Throws:
Exception
-
generateNewStateValue
Generates a new unique state parameter value. -
getExpirationInSeconds
default long getExpirationInSeconds()Returns the time period of expiration for state values in seconds. -
generateSessionCookieValue
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
Adds a newly generated state value to the server-side datastore.- Throws:
Exception
-
isValid
Verifies the given state parameter and returns true if it's valid. This method doesn't have any side effects, so that you can call this method multiple times. -
extractStateFromSession
Returns an underlying state value in a cookie-based session if it exists. -
isAvailableInDatabase
Verifies the state value is available in the datastore and returns true if it's valid. -
consume
Deletes the state value from the server-side datastore and set a response header to delete the one in session.- Throws:
Exception
-
deleteStateFromDatastore
Deletes a given state value from the server-side datastore.- Throws:
Exception
-