protected List<Principal> resolvePrincipals(final List<? extends PrincipalResolver> resolvers,
                                                final Credential credential,
                                                final Optional<Principal> principal,
                                                final Optional<AuthenticationHandler> handler,
                                                final Optional<Service> service) {
        return resolvers
            .stream()
            .filter(resolver -> resolver.supports(credential))
            .map(resolver -> {
                LOGGER.debug("Invoking principal resolver [{}]", resolver.getName());
                val resolvedPrincipal = FunctionUtils.doUnchecked(() -> resolver.resolve(credential, principal, handler, service));
                if (resolvedPrincipal != null) {
                    LOGGER.debug("Resolved principal [{}]", resolvedPrincipal);
                } else {
                    LOGGER.debug("Unable to resolve principal via [{}]", resolver.getName());
                }
                return resolvedPrincipal;
            })
            .filter(Objects::nonNull)
            .collect(Collectors.toList());
    }
Factory to create the principal type.
core/cas-server-core-authentication-api/src/main/java/org/apereo/cas/authentication/principal/resolvers/ChainingPrincipalResolver.java