protected ChainingAuthenticationPolicyExecutionResult evaluateAuthenticationPolicies(final Authentication authentication,
                                                                                         final AuthenticationTransaction transaction,
                                                                                         final Set<AuthenticationHandler> authenticationHandlers) throws Throwable {
        val policies = authenticationEventExecutionPlan.getAuthenticationPolicies(transaction);
        val executionResult = new ChainingAuthenticationPolicyExecutionResult();

        val resultBuilder = authenticationSystemSupport.getObject().getAuthenticationResultBuilderFactory().newBuilder();
        resultBuilder.collect(transaction.getAuthentications());
        resultBuilder.collect(authentication);

        val resultAuthentication = resultBuilder.build().getAuthentication();
        LOGGER.trace("Final authentication used for authentication policy evaluation is [{}]", resultAuthentication);

        policies.forEach(policy -> {
            try {
                LOGGER.debug("Executing authentication policy [{}]", policy.getName());
                val supportingHandlers = authenticationHandlers
                    .stream()
                    .filter(handler -> transaction.getCredentials().stream().anyMatch(handler::supports))
                    .collect(Collectors.toCollection(LinkedHashSet::new));
                val result = policy.isSatisfiedBy(resultAuthentication, supportingHandlers, applicationContext);
                executionResult.getResults().add(result);
                if (!result.isSuccess()) {
                    executionResult.getFailures()
                        .add(new AuthenticationException("Unable to satisfy authentication policy %s".formatted(policy.getName())));
                }
            } catch (final GeneralSecurityException e) {
                LOGGER.debug(e.getMessage(), e);
                FunctionUtils.doIfNotNull(e.getCause(), o -> executionResult.getFailures().add(e.getCause()));
            } catch (final Throwable e) {
                LOGGER.debug(e.getMessage(), e);
                executionResult.getFailures().add(e);
            }
        });
        return executionResult;
    }
This is {@link DefaultAuthenticationManager}, which provides common operations
around an authentication manager implementation.

@author Misagh Moayyed
@since 5.0.0
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/DefaultAuthenticationManager.java