public static String determineNameIdNameQualifier(final SamlRegisteredService samlRegisteredService,
                                                      final MetadataResolver samlIdPMetadataResolver) {
        if (StringUtils.isNotBlank(samlRegisteredService.getNameIdQualifier())) {
            return samlRegisteredService.getNameIdQualifier();
        }
        val nameQualifier = FunctionUtils.doIf(StringUtils.isNotBlank(samlRegisteredService.getIssuerEntityId()),
                samlRegisteredService::getIssuerEntityId,
                Unchecked.supplier(() -> {
                    val criteriaSet = new CriteriaSet(
                        new EvaluableEntityRoleEntityDescriptorCriterion(IDPSSODescriptor.DEFAULT_ELEMENT_NAME),
                        new SamlIdPSamlRegisteredServiceCriterion(samlRegisteredService));
                    LOGGER.trace("Resolving entity id from SAML2 IdP metadata to determine issuer for [{}]", samlRegisteredService.getName());
                    val entityDescriptor = Objects.requireNonNull(samlIdPMetadataResolver.resolveSingle(criteriaSet));
                    return entityDescriptor.getEntityID();
                }))
            .get();
        LOGGER.debug("Using name qualifier [{}] for the Name ID", nameQualifier);
        return nameQualifier;
    }
Determine name id name qualifier string.

@param samlRegisteredService   the saml registered service
@param samlIdPMetadataResolver the saml id p metadata resolver
@return the string
support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/SamlIdPUtils.java