public void authenticate(String username, String password) throws RemoteException {
        username = JID.unescapeNode(username);
        LOG.debug("authenticate '" + username + "'");

        final AuthenticatePost authenticatePost = new AuthenticatePost();
        authenticatePost.value = password;
        final StringWriter writer = new StringWriter();
        JAXB.marshal(authenticatePost, writer);

        final HttpUriRequest postRequest = RequestBuilder.post(crowdServer.resolve("authentication?username=" + urlEncode(username)))
            .setConfig(requestConfig)
            .setEntity(new StringEntity(writer.toString(), StandardCharsets.UTF_8))
            .setHeader(HEADER_CONTENT_TYPE_APPLICATION_XML)
            .build();

        try(final CloseableHttpResponse response = client.execute(postRequest, clientContext)) {

            if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
                handleHTTPError(response);
            }
            
        } catch (IOException ioe) {
            handleError(ioe);
        }
        
        LOG.info("authenticated user:" + username);
    }
Authenticates a user with crowd. If authentication failed, raises a <code>RemoteException</code>
@param username the username
@param password the password
@throws RemoteException if an exception occurred communicating with the crowd server
xmppserver/src/main/java/org/jivesoftware/openfire/crowd/CrowdManager.java