Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

LWP::UserAgent Authentication - how to get password

Posted on 2004-04-22
3
Medium Priority
?
591 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 2000 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…
Six Sigma Control Plans

604 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