Interface FlowRequestService
@PublicApi
public interface FlowRequestService
Enables clients to start flow requests and to get their results.
-
Method Summary
Modifier and TypeMethodDescriptioncreateFlowRequest(javax.servlet.http.HttpSession session, ClientConfiguration clientConfiguration, Function<String, String> clientRedirectUrl) Creates the flow requestcreateFlowRequest(javax.servlet.http.HttpSession session, String clientConfigId, String externalId, Function<String, String> clientRedirectUrl) Creates the flow request and persists the results for the given resource owner.getFlowResult(javax.servlet.http.HttpSession session, String flowRequestId) Returns stored flow result.
-
Method Details
-
createFlowRequest
@Nonnull FlowRequest createFlowRequest(@Nonnull javax.servlet.http.HttpSession session, @Nonnull ClientConfiguration clientConfiguration, @Nonnull Function<String, String> clientRedirectUrl) throws IllegalArgumentException, IllegalStateExceptionCreates the flow request- Parameters:
session- session, in which the data will be storedclientConfiguration- endpoints to hit and required credentialsclientRedirectUrl- function that, based on id, will produce url that the flow will be redirected to after obtaining the token;- Returns:
- The
FlowRequestcontains the redirect url and id - Throws:
IllegalArgumentException- thrown if the provided arguments are invalid, e.g.clientConfigurationendpoints are not httpsIllegalStateException- thrown if the session is invalidated, or base URL is not https (TODO: update this doc depending on the decision from go/j/KRAK-3359)
-
createFlowRequest
@Nonnull FlowRequest createFlowRequest(@Nonnull javax.servlet.http.HttpSession session, @Nonnull String clientConfigId, @Nonnull String externalId, @Nonnull Function<String, String> clientRedirectUrl) throws IllegalArgumentException, IllegalStateExceptionCreates the flow request and persists the results for the given resource owner.- Parameters:
session- session, in which the data will be storedclientConfigId- id of the config to useexternalId- unique identifier for whom the token will be generated forclientRedirectUrl- function that, based on id, will produce url that the flow will be redirected to after obtaining the token;- Returns:
- The
FlowRequestcontains the redirect url and id - Throws:
IllegalArgumentException- thrown if the provided arguments are invalidIllegalStateException- thrown if the session is invalidated, or base URL is not https- Since:
- 4.1.0
-
getFlowResult
@Nonnull FlowResult getFlowResult(@Nonnull javax.servlet.http.HttpSession session, @Nonnull String flowRequestId) throws IllegalArgumentException Returns stored flow result. This method should be called only once for the givenflowRequestId- subsequent calls will fail.- Parameters:
session- session to fetch the result from; has to be the same session as provided to {createFlowRequest(HttpSession, ClientConfiguration, Function)}flowRequestId- the id of theFlowRequestfrom {createFlowRequest(HttpSession, ClientConfiguration, Function)}- Returns:
- an
FlowResultcontaining eitherClientTokenorFlowRequestErrorif error occurred - Throws:
IllegalArgumentException- if there is no result for correspondingflowRequestId
-