Skip to content

Instantly share code, notes, and snippets.

@NetworksAreMadeOfString
Created August 20, 2012 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NetworksAreMadeOfString/3407638 to your computer and use it in GitHub Desktop.
Save NetworksAreMadeOfString/3407638 to your computer and use it in GitHub Desktop.
Rhybudd Authentication Example
HttpPost httpost = new HttpPost(URL + "/zport/acl_users/cookieAuthHelper/login");
List <NameValuePair> nvps = new ArrayList <NameValuePair>();
nvps.add(new BasicNameValuePair("__ac_name", UserName));
nvps.add(new BasicNameValuePair("__ac_password", Password));
nvps.add(new BasicNameValuePair("submitted", "true"));
nvps.add(new BasicNameValuePair("came_from", URL + "/zport/dmd"));
httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
// Response from POST not needed, just the cookie
HttpResponse response = httpclient.execute(httpost);
// Consume so we can reuse httpclient
response.getEntity().consumeContent();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment