private Authentication authenticateRequest(final SamlRequest samlRequest, final WebApplicationService selectedService) throws Throwable {
        if (StringUtils.isNotBlank(samlRequest.getPassword())) {
            val credential = new UsernamePasswordCredential(samlRequest.getUsername(), samlRequest.getPassword());
            val result = authenticationSystemSupport.finalizeAuthenticationTransaction(selectedService, credential);
            return result.getAuthentication();
        }
        val principal = principalResolver.resolve(new BasicIdentifiableCredential(samlRequest.getUsername()),
            Optional.of(principalFactory.createPrincipal(samlRequest.getUsername())),
            Optional.empty(), Optional.of(selectedService));
        return DefaultAuthenticationBuilder.newInstance().setPrincipal(principal).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