@Override
    public List<SimpleGrantedAuthority> apply(final Principal profile) {
        val username = profile.getId();
        LOGGER.debug("Attempting to get details for user [{}].", username);
        val filter = LdapUtils.newLdaptiveSearchFilter(userSearchOperation.getTemplate().getFilter(),
            LdapUtils.LDAP_SEARCH_FILTER_DEFAULT_PARAM_NAME, CollectionUtils.wrap(username));
        val response = FunctionUtils.doUnchecked(() -> userSearchOperation.execute(filter));

        LOGGER.debug("LDAP user search response: [{}]", response);
        if (!allowMultipleResults && response.entrySize() > 1) {
            throw new IllegalStateException("Found multiple results for user which is not allowed.");
        }

        if (response.entrySize() > 0) {
            val userEntry = response.getEntry();
            return generateAuthorizationForLdapEntry(profile, userEntry);
        }
        return List.of();
    }
This is {@link BaseUseAttributesAuthorizationGenerator}.

<ol>
<li>Search for an entry to resolve the username. In most cases the search should return exactly one result,
but the {@link #allowMultipleResults} property may be toggled to change that behavior.</li>
</ol>

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-ldap-core/src/main/java/org/apereo/cas/authorization/BaseUseAttributesAuthorizationGenerator.java