private Authentication buildAuthentication(final String username, final String password,
                                               final WebApplicationService selectedService) throws Throwable {
        if (StringUtils.isNotBlank(password)) {
            val credential = new UsernamePasswordCredential(username, password);
            val result = authenticationSystemSupport.getObject().finalizeAuthenticationTransaction(selectedService, credential);
            return result.getAuthentication();
        }
        val principal = principalResolver.getObject().resolve(new BasicIdentifiableCredential(username),
            Optional.of(principalFactory.getObject().createPrincipal(username)),
            Optional.empty(), Optional.of(selectedService));
        return DefaultAuthenticationBuilder.newInstance().setPrincipal(principal).build();
    }
Handle validation request and produce saml1 payload.

@param request  the request
@param username the username
@param password the password
@param service  the service
@return the map
@throws Throwable the throwable
support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/web/SamlValidateEndpoint.java