private AuthenticatedAssertionContext getAssertion(final SamlRequest samlRequest) throws Throwable {
        val selectedService = serviceFactory.createService(samlRequest.getEntityId());
        val registeredService = servicesManager.findServiceBy(selectedService, SamlRegisteredService.class);

        val authentication = authenticateRequest(samlRequest, selectedService);
        val context = RegisteredServiceAttributeReleasePolicyContext.builder()
            .registeredService(registeredService)
            .applicationContext(saml20ObjectBuilder.getOpenSamlConfigBean().getApplicationContext())
            .service(selectedService)
            .principal(authentication.getPrincipal())
            .build();
        val attributesToRelease = registeredService.getAttributeReleasePolicy().getAttributes(context);
        val builder = DefaultAuthenticationBuilder.of(
            context.getApplicationContext(), authentication.getPrincipal(),
            principalFactory, attributesToRelease,
            selectedService, registeredService, authentication);

        val finalAuthentication = builder.build();
        val authnPrincipal = finalAuthentication.getPrincipal();
        return AuthenticatedAssertionContext.builder()
            .name(authnPrincipal.getId())
            .attributes(CollectionUtils.merge(authnPrincipal.getAttributes(), finalAuthentication.getAttributes()))
            .build();
    }
Produce logout request post.

@param entityId the entity id
@param response the response
@return the response entity
@throws Exception the exception
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/sso/SSOSamlIdPPostProfileHandlerEndpoint.java