public static SAML2NameIDGenerator get(final Optional<RequestAbstractType> authnRequest,
                                           final String nameFormat,
                                           final SamlRegisteredService service,
                                           final String attributeValue) {
        val encoder = new SamlAttributeBasedNameIdGenerator(attributeValue);
        encoder.setId(SamlAttributeBasedNameIdGenerator.class.getSimpleName());
        encoder.setFormat(nameFormat);
        encoder.setDefaultIdPNameQualifierLookupStrategy(baseContexts -> service.getNameIdQualifier());
        encoder.setDefaultSPNameQualifierLookupStrategy(baseContexts -> service.getServiceProviderNameIdQualifier());

        authnRequest.flatMap(SamlIdPUtils::getNameIDPolicy).ifPresent(policy -> {
            val qualifier = policy.getSPNameQualifier();
            LOGGER.debug("NameID SP qualifier is set to [{}]", qualifier);
            encoder.setSPNameQualifier(qualifier);
        });
        encoder.setIdPNameQualifier(service.getNameIdQualifier());
        encoder.setOmitQualifiers(service.isSkipGeneratingNameIdQualifiers());
        FunctionUtils.doUnchecked(__ -> encoder.initialize());
        return encoder;
    }
Gets generator for.

@param authnRequest   the authn request
@param nameFormat     the name format
@param service        the service
@param attributeValue the attribute value
@return the generator for
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlAttributeBasedNameIdGenerator.java