use of org.apereo.cas.adaptors.duo.authn.DuoCredential in project cas by apereo.
the class PrepareDuoWebLoginFormAction method doExecute.
@Override
protected Event doExecute(final RequestContext requestContext) throws Exception {
final Principal p = WebUtils.getAuthentication(requestContext).getPrincipal();
final DuoCredential c = requestContext.getFlowScope().get(CasWebflowConstants.VAR_ID_CREDENTIAL, DuoCredential.class);
c.setUsername(p.getId());
WebUtils.getResolvedMultifactorAuthenticationProviders(requestContext).forEach(pr -> {
final DuoAuthenticationService duoAuthenticationService = provider.findProvider(pr.getId(), DuoMultifactorAuthenticationProvider.class).getDuoAuthenticationService();
requestContext.getViewScope().put("sigRequest", duoAuthenticationService.signRequestToken(p.getId()));
requestContext.getViewScope().put("apiHost", duoAuthenticationService.getApiHost());
requestContext.getViewScope().put("commandName", "credential");
requestContext.getViewScope().put("principal", p);
});
return success();
}
Aggregations