Library for enabling x-wsse authentication in lwp
This document describes version 0.05 of LWP::Authen::Wsse, released December 27, 2005.
use LWP::UserAgent; use HTTP::Request::Common; my $url = 'http://www.example.org/protected_page.html'; # Set up the WSSE client my $ua = LWP::UserAgent->new; $ua->credentials('example.org', '', 'username', 'password'); $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"; }
\*(C`LWP::Authen::Wsse\*(C' allows \s-1LWP\s0 to authenticate against servers that are using the \*(C`X-WSSE\*(C' authentication scheme, as required by the Atom Authentication \s-1API\s0.
The module is used indirectly through \s-1LWP\s0, rather than including it directly in your code. The \s-1LWP\s0 system will invoke the \s-1WSSE\s0 authentication when it encounters the authentication scheme while attempting to retrieve a \s-1URL\s0 from a server.
You also need to set the credentials on the UserAgent object like this:
$ua->credentials('www.company.com:80', '', "username", "password");
Alternatively, you may also subclass LWP::UserAgent and override the \*(C`get_basic_credentials()\*(C' method. See LWP::UserAgent for more details.
\s-1LWP\s0, LWP::UserAgent, lwpcook.
Audrey Tang <[email protected]>
Copyright 2004, 2005 by Audrey Tang <[email protected]>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>