protected Principal resolvePrincipal(final AuthenticationHandler handler, final PrincipalResolver resolver,
                                         final Credential credential, final Principal principal,
                                         final Service service) {
        if (resolver.supports(credential)) {
            try {
                val resolved = resolver.resolve(credential, Optional.ofNullable(principal),
                    Optional.ofNullable(handler), Optional.ofNullable(service));
                LOGGER.debug("[{}] resolved [{}] from [{}]", resolver, resolved, credential);
                return resolved;
            } catch (final Throwable e) {
                LOGGER.error("[{}] failed to resolve principal from [{}]", resolver, credential);
                LoggingUtils.error(LOGGER, e);
            }
        } else {
            LOGGER.warn("[{}] is configured to use [{}] but it does not support [{}], which suggests a configuration problem.",
                handler.getName(), resolver, credential);
        }
        return null;
    }
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