@Override
    public Set<String> resolve(final AttributeRepositoryQuery query) {
        val repositoryIds = new HashSet<String>();

        if (StringUtils.hasText(query.getTenant())) {
            val tenant = tenantExtractor.getTenantsManager().findTenant(query.getTenant()).orElseThrow();
            val authenticationPolicy = tenant.getAuthenticationPolicy();
            if (authenticationPolicy != null && authenticationPolicy.getAttributeRepositories() != null) {
                repositoryIds.addAll(authenticationPolicy.getAttributeRepositories());
            }
        }

        determineRegisteredService(query)
            .map(RegisteredService::getAttributeReleasePolicy)
            .map(RegisteredServiceAttributeReleasePolicy::getPrincipalAttributesRepository)
            .map(RegisteredServicePrincipalAttributesRepository::getAttributeRepositoryIds)
            .filter(identifiers -> !identifiers.isEmpty())
            .ifPresentOrElse(repositoryIds::addAll,
                () -> {
                    val selectionMap = casProperties.getPersonDirectory().getAttributeRepositorySelection();
                    if (Objects.nonNull(query.getAuthenticationHandler()) && selectionMap.containsKey(query.getAuthenticationHandler().getName())) {
                        val assignedRepositories = StringUtils.commaDelimitedListToSet(selectionMap.get(query.getAuthenticationHandler().getName()));
                        repositoryIds.addAll(assignedRepositories);
                    } else if (Objects.nonNull(query.getActiveRepositoryIds())) {
                        repositoryIds.addAll(query.getActiveRepositoryIds());
                    }
                });

        if (repositoryIds.isEmpty()) {
            repositoryIds.add(PersonAttributeDao.WILDCARD);
        }
        return repositoryIds;
    }
This is {@link DefaultAttributeRepositoryResolver}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-person-directory-core/src/main/java/org/apereo/cas/persondir/DefaultAttributeRepositoryResolver.java