use of com.okta.idx.sdk.api.model.VerifyChannelDataOptions in project okta-idx-java by okta.
the class LoginController method verify.
/**
* Handle authenticator verification functionality.
*
* @param code the verification code
* @param securityQuestionKey the security question key
* @param session the session
* @return the view associated with authentication response.
*/
@PostMapping("/verify")
public ModelAndView verify(@RequestParam("code") final String code, @RequestParam(value = "security_question_key", required = false) final String securityQuestionKey, final HttpSession session) {
logger.info(":: Verify Code :: {}", code);
ProceedContext proceedContext = Util.getProceedContextFromSession(session);
AuthenticationResponse authenticationResponse;
if (!Strings.isEmpty(securityQuestionKey)) {
authenticationResponse = idxAuthenticationWrapper.verifyAuthenticator(proceedContext, new VerifyAuthenticatorAnswer(code, securityQuestionKey));
} else if ("totp".equals(String.valueOf(session.getAttribute("totp")))) {
authenticationResponse = idxAuthenticationWrapper.verifyAuthenticator(proceedContext, new VerifyChannelDataOptions("totp", code));
} else {
VerifyAuthenticatorOptions verifyAuthenticatorOptions = new VerifyAuthenticatorOptions(code);
authenticationResponse = idxAuthenticationWrapper.verifyAuthenticator(proceedContext, verifyAuthenticatorOptions);
}
if (responseHandler.needsToShowErrors(authenticationResponse)) {
ModelAndView modelAndView = new ModelAndView("verify");
modelAndView.addObject("errors", authenticationResponse.getErrors());
return modelAndView;
}
return responseHandler.handleKnownTransitions(authenticationResponse, session);
}
use of com.okta.idx.sdk.api.model.VerifyChannelDataOptions in project okta-idx-java by okta.
the class LoginController method verifyChannelData.
/**
* Handle channel data verification functionality.
*
* @param channelName the channel name
* @param channelValue the value for channel
* @param session the session
* @return the view associated with authentication response.
*/
@PostMapping("/verify-channel-data")
public ModelAndView verifyChannelData(@RequestParam("channelName") final String channelName, @RequestParam("channelValue") final String channelValue, final HttpSession session) {
logger.info(":: Verify Channel Name, Value :: {}, {}", channelName, channelValue);
ProceedContext proceedContext = Util.getProceedContextFromSession(session);
VerifyChannelDataOptions verifyChannelDataOptions = new VerifyChannelDataOptions(channelName, channelValue);
AuthenticationResponse authenticationResponse = idxAuthenticationWrapper.verifyAuthenticator(proceedContext, verifyChannelDataOptions);
if (responseHandler.needsToShowErrors(authenticationResponse)) {
ModelAndView modelAndView = new ModelAndView("verify");
modelAndView.addObject("errors", authenticationResponse.getErrors());
return modelAndView;
}
return responseHandler.handleKnownTransitions(authenticationResponse, session);
}
Aggregations