1LWP::Authen::Ntlm(3)  User Contributed Perl Documentation LWP::Authen::Ntlm(3)
2
3
4

NAME

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

SYNOPSIS

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

DESCRIPTION

27       LWP::Authen::Ntlm allows LWP to authenticate against servers that are
28       using the NTLM authentication scheme popularized by Microsoft.  This
29       type of authentication is common on intranets of Microsoft-centric
30       organizations.
31
32       The module takes advantage of the Authen::NTLM module by Mark Bush.
33       Since there is also another Authen::NTLM module available from CPAN by
34       Yee Man Chan with an entirely different interface, it is necessary to
35       ensure that you have the correct NTLM module.
36
37       In addition, there have been problems with incompatibilities between
38       different versions of Mime::Base64, which Bush's Authen::NTLM makes use
39       of.  Therefore, it is necessary to ensure that your Mime::Base64 module
40       supports exporting of the encode_base64 and decode_base64 functions.
41

USAGE

43       The module is used indirectly through LWP, rather than including it
44       directly in your code.  The LWP system will invoke the NTLM
45       authentication when it encounters the authentication scheme while
46       attempting to retrieve a URL from a server.  In order for the NTLM
47       authentication to work, you must have a few things set up in your code
48       prior to attempting to retrieve the URL:
49
50       ·   Enable persistent HTTP connections
51
52           To do this, pass the "keep_alive=>1" option to the LWP::UserAgent
53           when creating it, like this:
54
55               my $ua = LWP::UserAgent->new(keep_alive=>1);
56
57       ·   Set the credentials on the UserAgent object
58
59           The credentials must be set like this:
60
61              $ua->credentials('www.company.com:80', '', "MyDomain\\MyUserCode", 'MyPassword');
62
63           Note that you cannot use the HTTP::Request object's
64           authorization_basic() method to set the credentials.  Note, too,
65           that the 'www.company.com:80' portion only sets credentials on the
66           specified port AND it is case-sensitive (this is due to the way LWP
67           is coded, and has nothing to do with LWP::Authen::Ntlm)
68

AVAILABILITY

70       General queries regarding LWP should be made to the LWP Mailing List.
71
72       Questions specific to LWP::Authen::Ntlm can be forwarded to
73       jtillman@bigfoot.com
74
76       Copyright (c) 2002 James Tillman. All rights reserved. This program is
77       free software; you can redistribute it and/or modify it under the same
78       terms as Perl itself.
79

SEE ALSO

81       LWP, LWP::UserAgent, lwpcook.
82
83
84
85perl v5.30.2                      2020-04-15              LWP::Authen::Ntlm(3)
Impressum