Source:
protected Event doExecute(final RequestContext requestContext) { final Authentication authentication = WebUtils.getAuthentication(requestContext); final Principal p = authentication.getPrincipal(); final RegisteredService service = WebUtils.getRegisteredService(requestContext); final Event enrollEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ENROLL); final Event denyEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_DENY); final Event unavailableEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE); final Collection<String> providerIds = WebUtils.getResolvedMultifactorAuthenticationProviders(requestContext); final Collection<MultifactorAuthenticationProvider> providers = MultifactorAuthenticationUtils.getMultifactorAuthenticationProvidersByIds(providerIds, applicationContext); for (final MultifactorAuthenticationProvider pr : providers) { final DuoMultifactorAuthenticationProvider duoProvider = this.provider.findProvider(pr.getId(), DuoMultifactorAuthenticationProvider.class); final DuoSecurityAuthenticationService duoAuthenticationService = duoProvider.getDuoAuthenticationService(); final DuoUserAccount account = duoAuthenticationService.getDuoUserAccount(p.getId()); switch (account.getStatus()) { case ENROLL: requestContext.getFlowScope().put("duoRegistrationUrl", duoProvider.getRegistrationUrl()); return enrollEvent; case ALLOW: return returnByPass(authentication, duoProvider.getId()); case DENY: return denyEvent; case UNAVAILABLE: final RegisteredServiceMultifactorPolicy.FailureModes failureMode = duoProvider.determineFailureMode(service); if (failureMode != RegisteredServiceMultifactorPolicy.FailureModes.CLOSED) { return returnByPass(authentication, duoProvider.getId()); } return unavailableEvent; } } return success(); }

Target:
protected Event doExecute(final RequestContext requestContext) { final Authentication authentication = WebUtils.getAuthentication(requestContext); final Principal p = authentication.getPrincipal(); final RegisteredService service = WebUtils.getRegisteredService(requestContext); final Event enrollEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ENROLL); final Event denyEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_DENY); final Event unavailableEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_UNAVAILABLE); final Event errorEvent = new EventFactorySupport().event(this, CasWebflowConstants.TRANSITION_ID_ERROR); final Collection<String> providerIds = WebUtils.getResolvedMultifactorAuthenticationProviders(requestContext); final Collection<MultifactorAuthenticationProvider> providers = MultifactorAuthenticationUtils.getMultifactorAuthenticationProvidersByIds(providerIds, applicationContext); for (final MultifactorAuthenticationProvider pr : providers) { final DuoMultifactorAuthenticationProvider duoProvider = this.provider.findProvider(pr.getId(), DuoMultifactorAuthenticationProvider.class); final DuoSecurityAuthenticationService duoAuthenticationService = duoProvider.getDuoAuthenticationService(); final DuoUserAccount account = duoAuthenticationService.getDuoUserAccount(p.getId()); switch (account.getStatus()) { case ENROLL: if (!StringUtils.hasText(duoProvider.getRegistrationUrl())) { LOGGER.error("Duo webflow resolved to event ENROLL, but no registration url was provided."); return errorEvent; } requestContext.getFlowScope().put("duoRegistrationUrl", duoProvider.getRegistrationUrl()); return enrollEvent; case ALLOW: return returnByPass(authentication, duoProvider.getId()); case DENY: return denyEvent; case UNAVAILABLE: final RegisteredServiceMultifactorPolicy.FailureModes failureMode = duoProvider.determineFailureMode(service); if (failureMode != RegisteredServiceMultifactorPolicy.FailureModes.CLOSED) { return returnByPass(authentication, duoProvider.getId()); } return unavailableEvent; default: } } return success(); }