LWP::Authen::Ntlm(3)
π LWP::Authen::Ntlm β NTLM auth for LWP, bestie edition π
This is the manual page for LWP::Authen::Ntlm(3) from the User Contributed Perl Documentation, and it's literally here to help LWP do NTLM auth. Periodt.
β¨ NAME β¨
LWP::Authen::Ntlm β Library for enabling NTLM authentication (Microsoft) in LWP.
πΈ SYNOPSIS πΈ
Okay so here's the whole setup vibe, fr fr:
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 π¦
LWP::Authen::Ntlm 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. iykyk π
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. No mixing up the icons, bestie.
In addition, there have been problems with incompatibilities between different versions of Mime::Base64, which Bush's Authen::NTLM 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=>1option to theLWP::UserAgentwhen creating it, like this:
my $ua = LWP::UserAgent->new(keep_alive=>1);
- Set the credentials on the
UserAgentobject β The credentials must be set like this:
$ua->credentials('www.company.com:80', '', "MyDomain\\MyUserCode", 'MyPassword');
Note that you cannot use the HTTP::Request 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, LWP::UserAgent, lwpcook.
That's the whole page, bestie π«Ά. Source/version: perl v5.42.0; date: 2026-05-18.
π¦ where this page comes from
- opensuse-leap 16.0: perl-libwww-perl 6.770.0-160000.3.1 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms