1

We need to test a site that require windows authentication. We have tried to automate it using Casperjs, but we kept on getting a 401.

We found that others had similar issue based on the following discussion . However, the discussion was closed with no real solutions.

Someone in that discussion noted that he/she used page.customHeader with additional workarounds, but no real steps were provided on how to get this to work.

We also tried updating url to http://username:passowrd@domain.com pattern & even that did not helped.

See Fiddler's sample response when i tried this in the

GET / HTTP/1.1
Host: host 

HTTP/1.1 401 Access Denied
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM 


GET / HTTP/1.1
Host: host
Authorization: NTLM TlRMTVNTUAABAAAAB4IAoAAAAAAAAAAAAAAAAAAAAAB= 

HTTP/1.1 401 Access Denied
WWW-Authenticate: NTLM TlRMTVNTUAACAAAADAAMADAAAAAFgoGgCY6qiih5j bAAAAAAAAAAAH4AfgA8AAAAUABPAFIAVAA4ADAAAgAMAFAATwBSAFQA OAAwAAEACgBKAEwASQBNAEEABAAkAH
SharpCoder
  • 18,279
  • 43
  • 153
  • 249

1 Answers1

0

Actually there was a good workaround sugguested in issue discussion on PhantomJS github. You could use a local NTLM proxy and connect to it via CasperJS like so:

casperjs --proxy=localhost:3133 --ignore-ssl-error=true --ssl-protocol=any script.js

Community
  • 1
  • 1
Vaviloff
  • 16,282
  • 6
  • 48
  • 56