Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

LWP::Authen::Ntlm

Name LWP::Authen::Ntlm
Version 6.61
Located at /usr/local/share/perl5
File /usr/local/share/perl5/LWP/Authen/Ntlm.pm
Is Core No
Search CPAN for this module LWP::Authen::Ntlm
Documentation LWP::Authen::Ntlm
Module Details LWP::Authen::Ntlm


NAME

LWP::Authen::Ntlm - Library for enabling NTLM authentication (Microsoft) in LWP


SYNOPSIS

 use LWP::UserAgent;
 use HTTP::Request::Common;
 my $url = 'http://www.company.com/protected_page.html';
 # Set up the ntlm client and then the base64 encoded ntlm handshake message
 my $ua = LWP::UserAgent->new(keep_alive=>1);
 $ua->credentials('www.company.com:80', '', "MyDomain\\MyUserCode", 'MyPassword');
 $request = GET $url;
 print "--Performing request now...-----------\n";
 $response = $ua->request($request);
 print "--Done with request-------------------\n";
 if ($response->is_success) {print "It worked!->" . $response->code . "\n"}
 else {print "It didn't work!->" . $response->code . "\n"}


DESCRIPTION

the LWP::Authen::Ntlm manpage allows LWP to authenticate against servers that are using the NTLM authentication scheme popularized by Microsoft. This type of authentication is common on intranets of Microsoft-centric organizations.

The module takes advantage of the Authen::NTLM module by Mark Bush. Since there is also another Authen::NTLM module available from CPAN by Yee Man Chan with an entirely different interface, it is necessary to ensure that you have the correct NTLM module.

In addition, there have been problems with incompatibilities between different versions of the Mime::Base64 manpage, which Bush's the Authen::NTLM manpage makes use of. Therefore, it is necessary to ensure that your Mime::Base64 module supports exporting of the encode_base64 and decode_base64 functions.


USAGE

The module is used indirectly through LWP, rather than including it directly in your code. The LWP system will invoke the NTLM authentication when it encounters the authentication scheme while attempting to retrieve a URL from a server. In order for the NTLM authentication to work, you must have a few things set up in your code prior to attempting to retrieve the URL:

  • Enable persistent HTTP connections

    To do this, pass the "keep_alive=>1" option to the the LWP::UserAgent manpage when creating it, like this:

        my $ua = LWP::UserAgent->new(keep_alive=>1);

  • Set the credentials on the UserAgent object

    The credentials must be set like this:

       $ua->credentials('www.company.com:80', '', "MyDomain\\MyUserCode", 'MyPassword');

    Note that you cannot use the the HTTP::Request manpage object's authorization_basic() method to set the credentials. Note, too, that the 'www.company.com:80' portion only sets credentials on the specified port AND it is case-sensitive (this is due to the way LWP is coded, and has nothing to do with LWP::Authen::Ntlm)


AVAILABILITY

General queries regarding LWP should be made to the LWP Mailing List.

Questions specific to LWP::Authen::Ntlm can be forwarded to jtillman@bigfoot.com


COPYRIGHT

Copyright (c) 2002 James Tillman. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


SEE ALSO

LWP, the LWP::UserAgent manpage, lwpcook.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024