private SAMLObject determineNameIdForAttributeQuery(final SamlProfileBuilderContext context) {
        val query = (AttributeQuery) context.getSamlRequest();
        val result = query.getSubject().getNameID() == null
            ? samlIdPObjectEncrypter.decode(query.getSubject().getEncryptedID(), context.getRegisteredService(), context.getAdaptor())
            : query.getSubject().getNameID();
        result.detach();
        return result;
    }
Prepare name id attribute idp attribute.

@param context    the context
@param nameFormat the name format
@return the idp attribute
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/nameid/SamlProfileSamlNameIdBuilder.java