protected void handleAuthenticationException(final Throwable ex, final String name, final AuthenticationBuilder builder) {
        LOGGER.trace(ex.getMessage(), ex);
        val msg = new StringBuilder(StringUtils.defaultString(ex.getMessage()));
        if (ex.getCause() != null) {
            msg.append(" / ").append(ex.getCause().getMessage());
        }
        if (ex instanceof GeneralSecurityException) {
            LOGGER.info("[{}] exception details: [{}].", name, msg);
            builder.addFailure(name, ex);
        } else {
            LOGGER.error("[{}]: [{}]", name, msg);
            builder.addFailure(name, ex);
        }
    }
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