protected Principal buildResolvedPrincipal(final String id, final Map<String, List<Object>> attributes,
                                               final Credential credential, final Optional<Principal> currentPrincipal,
                                               final Optional<AuthenticationHandler> handler) throws Throwable {
        return context.getPrincipalFactory().createPrincipal(id, attributes);
    }
Resolves principals by querying a data source using the Person Directory API.
The {@link Principal#getAttributes()} are populated by the results of the
query and the principal ID may optionally be set by proving an attribute whose first non-null value is used;
otherwise the credential ID is used for the principal ID.

@author Marvin S. Addison
@since 4.0.0
support/cas-server-support-person-directory-core/src/main/java/org/apereo/cas/authentication/principal/resolvers/PersonDirectoryPrincipalResolver.java