Solved

LWP::UserAgent Authentication - how to get password

Posted on 2004-04-22
3
581 Views
Last Modified: 2012-05-04
Hi,


I am trying to use LWP::UserAgent to retrieve password protected web
page. Since, my page is also password protected, I need to send
'Authorization' http header (encoded in base64) to other page. Both applications use same user name and password. How can I read password or 'Authorization' header in my script to make the following statement work:

$req->authorization_basic($username, $password);
OR
$req->authorization('Basic cm1vaSHGFsdfTNteFxs');   #cm1vaSHGFsdfTNteFxs is username:password encoded in base64

Thanks,
Rakesh.
0
Comment
Question by:rakmohan
3 Comments
 
LVL 20

Accepted Solution

by:
jmcg earned 500 total points
ID: 10970523
There's a limitation here. In the CGI environment your script is run in, it does not have full access to the headers of the HTTP request that caused it to start. You can learn, from environment variables, the AUTH_TYPE and REMOTE_USER. This means you would need to have stored the password corresponding to the user somewhere where your script can access it -- it cannot simply read or pass along the Authentication: header that was received.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question