protected String buildLogoutRequestNameId(final SingleLogoutRequestContext request, final String nameIdFormat) throws Throwable {
        val samlService = (SamlRegisteredService) request.getRegisteredService();
        val principal = request.getExecutionRequest().getTicketGrantingTicket()
            .getAuthentication().getPrincipal();
        if (NameIDType.TRANSIENT.equalsIgnoreCase(StringUtils.trim(nameIdFormat))) {
            val serviceId = request.getService().getId();
            val resolver = samlProfileHandlerConfigurationContext.getSamlRegisteredServiceCachingMetadataResolver();
            val adaptorRes = SamlRegisteredServiceMetadataAdaptor.get(resolver, samlService, serviceId);
            val adaptor = adaptorRes.orElseThrow(() -> new IllegalArgumentException("Unable to find metadata for saml service " + serviceId));
            val entityId = adaptor.getEntityId();
            val principalName = principal.getId();
            LOGGER.debug("Generating transient NameID value for principal [{}] and entity id [{}]", principalName, entityId);
            return samlProfileHandlerConfigurationContext.getPersistentIdGenerator().generate(principalName, entityId);
        }

        val usernameContext = RegisteredServiceUsernameProviderContext.builder()
            .registeredService(samlService)
            .service(request.getService())
            .principal(principal)
            .applicationContext(samlProfileHandlerConfigurationContext.getApplicationContext())
            .build();
        val principalName = samlService.getUsernameAttributeProvider().resolveUsername(usernameContext);
        LOGGER.trace("Preparing NameID attribute for principal [{}]", principalName);
        return principalName;
    }
This is {@link SamlIdPProfileSingleLogoutMessageCreator}.

@author Misagh Moayyed
@since 6.0.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/slo/SamlIdPProfileSingleLogoutMessageCreator.java