Created
August 20, 2012 20:35
-
-
Save NetworksAreMadeOfString/3407638 to your computer and use it in GitHub Desktop.
Rhybudd Authentication Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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