Search in sources :

Example 1 with DuoCredential

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();
}
Also used : DuoCredential(org.apereo.cas.adaptors.duo.authn.DuoCredential) DuoMultifactorAuthenticationProvider(org.apereo.cas.adaptors.duo.authn.DuoMultifactorAuthenticationProvider) Principal(org.apereo.cas.authentication.principal.Principal) DuoAuthenticationService(org.apereo.cas.adaptors.duo.authn.DuoAuthenticationService)

Aggregations

DuoAuthenticationService (org.apereo.cas.adaptors.duo.authn.DuoAuthenticationService)1 DuoCredential (org.apereo.cas.adaptors.duo.authn.DuoCredential)1 DuoMultifactorAuthenticationProvider (org.apereo.cas.adaptors.duo.authn.DuoMultifactorAuthenticationProvider)1 Principal (org.apereo.cas.authentication.principal.Principal)1