Search in sources :

Example 1 with MultifactorAuthenticationRequiredException

use of org.apereo.cas.authentication.MultifactorAuthenticationRequiredException in project cas by apereo.

the class PrincipalAttributeMultifactorAuthenticationTrigger method resolveMultifactorAuthenticationProvider.

/**
 * Resolve multifactor authentication provider set.
 *
 * @param context   the context
 * @param service   the service
 * @param principal the principal
 * @return the set
 */
protected Set<Event> resolveMultifactorAuthenticationProvider(final Optional<RequestContext> context, final RegisteredService service, final Principal principal) {
    val events = determineMultifactorAuthenticationEvent(context, service, principal);
    val deny = casProperties.getAuthn().getMfa().getTriggers().getPrincipal().isDenyIfUnmatched();
    if (deny && (events == null || events.isEmpty())) {
        throw new AuthenticationException(new MultifactorAuthenticationRequiredException(service, principal));
    }
    return events;
}
Also used : lombok.val(lombok.val) AuthenticationException(org.apereo.cas.authentication.AuthenticationException) MultifactorAuthenticationRequiredException(org.apereo.cas.authentication.MultifactorAuthenticationRequiredException)

Aggregations

lombok.val (lombok.val)1 AuthenticationException (org.apereo.cas.authentication.AuthenticationException)1 MultifactorAuthenticationRequiredException (org.apereo.cas.authentication.MultifactorAuthenticationRequiredException)1