[Webtest] RE: RE: RE: RE: problem with NT authentication

Michael Dunn webtest@lists.canoo.com
Thu, 27 Apr 2006 15:29:50 -0700


egg on my face marc, I thought it was working in htmlunit, but it was
just jumping to the exception and I was ignoring the exception. bad
programming!

at any rate, running the test in htmlunit produces the same error as in
webtest, namely a 401 error.=20

my programmer suggested capturing the calls to the test webpage using a
tool called Fiddler. we tried capturing our normal call to the test web
page through Fiddler and it appears that there are 2 401 responses
before there is the successful 200 response. could this be the problem?

is there something more that needs to be done in the htmlunit calls that
tells it to try again after the first 401 error and supply the
credentials. this doe not make sense if we have already set the
credentials correctly. when I debug the htmlunit test, I can see that
the credentials are being set correctly. below is my corrected htmlunit
test and the associated output.=20

I have not seen much other discussion about this NTLM authentication
through Google, nor have I been able to find any examples of using this
code.=20

I did talk with my network guys and found out other information about
our network that may be pertinent.
we do not use NTLM (1 or 2) authentication in our network, we use
kerberos since we are running Active Directory. could this be the reason
that htmlunit is failing?

later,
mikey

JUNIT TEST:
	public void testNTLM() throws Exception {
		DefaultCredentialsProvider prov =3D new
DefaultCredentialsProvider();
		prov.addCredentials("username","password");
        	final WebClient webClient =3D new WebClient();
	    	webClient.setCredentialsProvider(prov);
        	final URL url =3D new
URL("http://ts09utl/tmtrack/tmtrack.dll");
		try{
		    System.out.println("start test: ");
		    final HtmlPage page =3D
(HtmlPage)webClient.getPage(url);
		    System.out.println("got page");
		    assertEquals( "htmlunixxxt - Welcome to HtmlUnit",
page.getTitleText() );
		} catch(Exception e){
		    System.out.println("exception occurred: "  );
		    e.printStackTrace();
		}
	}

CONSOLE OUTPUT:
start test:=20
exception occurred:=20
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 401 Access
Denied for http://ts09utl/tmtrack/tmtrack.dll
	at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:347)
	at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:384)
	at webtest.test.talus.MikeyJunit1.testNTLM(MikeyJunit1.java:38)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at junit.framework.TestCase.runTest(TestCase.java:154)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at junit.framework.TestSuite.runTest(TestSuite.java:208)
	at junit.framework.TestSuite.run(TestSuite.java:203)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:474)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:342)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:194) =20


Michael Dunn=20
Product Test Manager=20
Adaptis=20
206 342 7478=20


-----Original Message-----
From: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] On Behalf Of Marc Guillemot
Sent: Tuesday, April 25, 2006 11:46 PM
To: webtest@lists.canoo.com
Subject: [Webtest] RE: RE: RE: RE: problem with NT authentication


Hi Mike,

I don't understand why it works when you're using directly from
htmlunit.
Are you sure of it? Do you really get the page that is protected by NT
auth?
Indeed all the problems could be logically explained if it wouldn't work
as no NTLM auth is returned but ony a "normal" auth.

It's normal that the groovy step alone works. How does the invoke look
like?
Have your removed the username and password attributes?

Marc.
--
View this message in context:
http://www.nabble.com/RE%3A-RE%3A-RE%3A-problem-with-NT-authentication-t
1488973.html#a4096225
Sent from the WebTest forum at Nabble.com.

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest