Archive for October, 2009

HTTP Digest Authentication: A Java Client

Friday, October 23rd, 2009 Posted in Java | Comments Off

import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HeaderElement; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.GetMethod; public class BrowserAuth { public static void main(String[] args) { try { // String urlStr = "http://example.com:8080/abc/"; String host = "example.com"; String realm = "ExampleRealm"; String userName = "user"; String password ... Read more..

NTLM Authentication: Java Client Code

Friday, October 23rd, 2009 Posted in Java | Comments Off

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.Authenticator; import java.net.HttpURLConnection; import java.net.PasswordAuthentication; import java.net.URL; public class NtlmTest01 { public static void main(String[] args) throws Exception { String urlStr = "http://example.com/root/action.dll?p1=value1"; String domain = ""; // May also be referred ... Read more..