OTP Configuration Step¶
OTPConfigurationStep
configures the HTTP client. This step should be used with an authentication step (SAML, Basic, or OAuth2) and with the OTPAuthValidation
.
Input Parameters¶
Mandatory input parameters:
-
authType
– Specifies the authorization type. This parameter is important and should match the next step. If the authentication type is Basic, the next should beBasicAuthStep
and so on. -
settingsParameters – This setting is provided on the
flowContext
.
Optional input parameter:
OAuth2Processor
– Specifies the OAuth2 processor. If the user define their own processor, the OAuth2 step uses that.
Using OTPConfigurationStep
¶
-
Set the Context and the onboarding settings in the
flowContext
.flowContext.setContext(callerActivity); try { OnboardingParameters onboardingParameters = new OnboardingParameters(); onboardingParameters.setUrl(SERVICE_URL); onboardingParameters.setApplicationId(APPLICATION_ID); onboardingParameters.setApplicationVersion(APPLICATION_VERSION); onboardingParameters.build(); flowContext.setOnboardingParameters(onboardingParameters); } catch (MalformedURLException e) { //error handling }
-
In the case of OAuth authentication, set the OAuth2 configuration:
OAuth2Configuration.Builder builer = new OAuth2Configuration.Builder(); config = builer.clientId("3860f7b5-2dc2-4842-8d31-7f7d8c52e9fc") .responseType("code") .authUrl(AUTH_ENDPOINT) .tokenUrl(TOKEN_ENDPOINT) .redirectUrl(OAUTH_REDIRECT_URL).build(); onboardingParameters.setOAuth2Configuration(config);
-
Initiate the step and set the authorization type:
OTPConfigurationStep otpConfigurationStep = new OTPConfigurationStep(); otpConfigurationStep.setAuthType(AuthType.SAML);
-
Specify the flow and the execute method's
FlowActionHandler
parameter's "onFailure" and "onSuccess" behavior:OTPAuthValidationStep otpAuthValidationStep = new OTPAuthValidationStep(); flowSteps = new Step[] { otpConfigurationStep, authStep, otpAuthValidationStep }; flowManagerService.execute(flow, flowContext, new FlowActionHandler() { @Override public void onFailure(Throwable t) { //set the status, update the caller activity } @Override public void onSuccess(FlowContext result) { //set the status, update the caller activity //read the result } });
Last update: November 24, 2020