Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lwp::authen::ntlm(3) [osx man page]

LWP::Authen::Ntlm(3)					User Contributed Perl Documentation				      LWP::Authen::Ntlm(3)

LWP::Authen::Ntlm - Library for enabling NTLM authentication (Microsoft) in LWP SYNOPSIS
use LWP::UserAgent; use HTTP::Request::Common; my $url = ''; # Set up the ntlm client and then the base64 encoded ntlm handshake message my $ua = LWP::UserAgent->new(keep_alive=>1); $ua->credentials('', '', "MyDomain\MyUserCode", 'MyPassword'); $request = GET $url; print "--Performing request now...----------- "; $response = $ua->request($request); print "--Done with request------------------- "; if ($response->is_success) {print "It worked!->" . $response->code . " "} else {print "It didn't work!->" . $response->code . " "} 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. 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 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: o Enable persistent HTTP connections To do this, pass the "keep_alive=>1" option to the LWP::UserAgent when creating it, like this: my $ua = LWP::UserAgent->new(keep_alive=>1); o Set the credentials on the UserAgent object The credentials must be set like this: $ua->credentials('', '', "MyDomain\MyUserCode", 'MyPassword'); Note that you cannot use the HTTP::Request object's authorization_basic() method to set the credentials. Note, too, that the '' 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 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. perl v5.16.2 2012-01-13 LWP::Authen::Ntlm(3)

Check Out this Related Man Page

LWP::Protocol::PSGI(3pm)				User Contributed Perl Documentation				  LWP::Protocol::PSGI(3pm)

LWP::Protocol::PSGI - Override LWP's HTTP/HTTPS backend with your own PSGI applciation SYNOPSIS
use LWP::UserAgent; use LWP::Protocol::PSGI; # can be Mojolicious, Catalyst ... any PSGI application my $psgi_app = do { use Dancer; setting apphandler => 'PSGI'; get '/search' => sub { return 'googling ' . params->{q}; }; dance; }; LWP::Protocol::PSGI->register($psgi_app); # can hijack any code or module that uses LWP::UserAgent underneath, with no changes my $ua = LWP::UserAgent->new; my $res = $ua->get(""); print $res->content; # "googling bar" DESCRIPTION
LWP::Protocol::PSGI is a module to hijack any code that uses LWP::UserAgent underneath such that any HTTP or HTTPS requests can be routed to your own PSGI application. Because it works with any code that uses LWP, you can override various WWW::*, Net::* or WebService::* modules such as WWW::Mechanize, without modifying the calling code or its internals. use WWW::Mechanize; use LWP::Protocol::PSGI; LWP::Protocol::PSGI->register($my_psgi_app); my $mech = WWW::Mechanize->new; $mech->get(""); # $my_psgi_app runs METHODS
register LWP::Protocol::PSGI->register($app); my $guard = LWP::Protocol::PSGI->register($app); Registers an override hook to hijack HTTP requests. If called in a non-void context, returns a Guard object that automatically resets the override when it goes out of context. { my $guard = LWP::Protocol::PSGI->register($app); # hijack the code using LWP with $app } # now LWP uses the original HTTP implementations unregister LWP::Protocol::PSGI->unregister; Resets all the overrides for LWP. If you use the guard interface described above, it will be automatically called for you. AUTHOR
Tatsuhiko Miyagawa <> COPYRIGHT
Copyright 2011- Tatsuhiko Miyagawa LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Plack::Client LWP::UserAgent perl v5.12.3 2011-05-12 LWP::Protocol::PSGI(3pm)
Man Page

Featured Tech Videos