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"
41       functions.
42

USAGE

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

AVAILABILITY

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

SEE ALSO

82       LWP, LWP::UserAgent, lwpcook.
83
84
85
86perl v5.36.0                      2022-07-22              LWP::Authen::Ntlm(3)
Impressum