[Melbourne-pm] SSO authentication

Mithun Radhakrishnan mithunr2003 at gmail.com
Thu May 22 07:09:34 PDT 2014


I need to do a SSO authentication and do a HTTP GET request for a web
service.

I get the below response content on doing a basic authentication using
LWP.  I am trying to automate the testing of some of the web services. But
the basic authentication using Mozilla(browser) REST client works properly
and it is giving the expected response.

Do we need to do a different authentication mechanism in LWP for SSO?


"Can't verify SSL peers without knowning which Certificate Authorities to
trust

This problem can be fixed by either setting the PERL_LWP_SSL_CA_FILE
envirionment variable or by installing the Mozilla::CA module.

To disable verification of SSL peers set the PERL_LWP_SSL_VERIFY_HOSTNAME
envirionment variable to 0.  If you do this you can't be sure that you
communicate with the expected peer.
"


-------------------------------------------------------------------------------------------
my $method = 'GET';
my $uri    = 'http://xxxx';
my $username = 'xxx';
my $password = 'xxxx';

my $cookie_location = "/tmp/cookie";    # This must be read/write
my $ua = LWP::UserAgent->new(keep_alive => 1);
$ua->default_header( 'Accept' => '*/*' );
$ua->cookie_jar(
    {
        file           => $cookie_location,
        autosave       => 1,
        ignore_discard => 1
    }
);

my $request = HTTP::Request->new( $method, $uri );
$request->authorization_basic( $username, $password );
my $response = $ua->request($request);

---------------------------------------------------------------------------------


Regards
Mithun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20140522/947a880e/attachment.html>


More information about the Melbourne-pm mailing list