private static AuthenticationException createAuthenticationException(
        final AuthenticationBuilder builder) {
        val exception = new AuthenticationException(builder.getFailures(), builder.getSuccesses());
        if (!builder.getFailures().isEmpty()) {
            val firstCause = builder.getFailures().values().iterator().next();
            exception.initCause(firstCause);
        }
        return exception;
    }
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