Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

LWP::UserAgent and NT Challenge Response authentication

by rchiav (Deacon)
on Nov 03, 2001 at 01:53 UTC ( #122932=perlquestion: print w/replies, xml ) Need Help??

rchiav has asked for the wisdom of the Perl Monks concerning the following question:

This is my first fumble through the LWP modules so forgive me if I'm missing something obvious. I Super Searched to no avail.

One of my coworkers asked me if it would be possible to automate the process of taking a web page (generated through a POST) and importing the table on that page into Excel. Hey! Looks like another good opportunity to showcase perl. (I've already made them all install it).

Well the downside is that it's an ASP page on an NT server using MS Challenge/Response Authentication. Using IE, I can go there no problem.. no prompts for user and password. Using LWP::UserAgent, it's telling me "Error: Access is Denied".

My questions is.. how would I go about authenticating with MS Challenge/Response authentication using LWP? The Docs only talked about simple and digest authentaication.

Thanks,
Rich

  • Comment on LWP::UserAgent and NT Challenge Response authentication

Replies are listed 'Best First'.
Re: LWP::UserAgent and NT Challenge Response authentication
by traveler (Parson) on Nov 03, 2001 at 03:21 UTC
    I think I can point you to the necessary parts, however I have not seen a precoded solution. See this page for a description of how the NTLM auth works. If Microsoft has such a description, I've not found it. You'll have to pack up the structures yourself. You shouldn't have to code the NTLM response, though, as Authen::NTLM will probably be fine for that.

    You may be able to negotiate a different auth type (e.g. digest or simple), though so that may be another approach

    HTH, --traveler

Re: LWP::UserAgent and NT Challenge Response authentication
by dws (Chancellor) on Nov 03, 2001 at 03:36 UTC
    My questions is.. how would I go about authenticating with MS Challenge/Response authentication using LWP?

    I took some notes the last time this question went by, and bookmarked NTLM Authentication Scheme for HTTP, which explains the protocol. It doesn't provide a Perl solution, but it gives you all of the info you'll need to implement one.

Re: LWP::UserAgent and NT Challenge Response authentication
by hopes (Friar) on Nov 03, 2001 at 18:02 UTC
    Check this code:
    $ua = new LWP::UserAgent; $request = new HTTP::Request('GET', $url); $request->authorization_basic($login,$passw); $response = $ua->request($request);

    Remember to set the permissions in NT correctly. If the user which is executing the script doesn't have permissions to read the script, I use to obtain the annoying
    Error: Access is Denied
    (last time this morning) :-)
    Remember to check NT permissions
    Hopes
      The problem is that I do have permission to read the file. As I pointed out above, I can use IE to view the page without a prompt for a password or an error. In your case, you're probably using NTCR and basic authentication. In my case, the page does not provide basic authentication. That's not something I can control

      PS - To those who have downvoted this, it would be nice if you explained youself. If I'm not understanding how to force IIS to use basic authentication when it's configured NOT to use basic authentication, let me know. I'm sure there's a lot of people who would love to know how to do this seeing as though you can't use Netscape to view pages that are set up to JUST use NT Challenege Response Authentication.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://122932]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2021-09-22 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?