Solved

LWP::UserAgent Authentication - how to get password

Posted on 2004-04-22
3
583 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remove Malware code from PHP file 6 99
Perl 101 11 85
read an xml file in perl 2 68
Create an automated page index 9 82
I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
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…

749 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