Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

LWP Authorization

by gr0f (Acolyte)
on Jul 25, 2001 at 04:04 UTC ( [id://99525]=perlquestion: print w/replies, xml ) Need Help??

gr0f has asked for the wisdom of the Perl Monks concerning the following question:

I'm wondering if the type of LWP authentication used to satisfy domain passwords, eg the credentials method:
$ua->credentials($netloc, $realm, $uname, $pass)
can also be used to login to a site like Hotmail with the username/password entered in HTML text fields. This is the site I have to gain access to with my script in case anyone doesn't know what I'm talking about:
http://www.environet.gov.on.ca/

Are these authentication methods the same, or is something else required? Browsers obviously cache something since they aren't redirected to this login page every time trying access a protected page. Any insight would be helpful...

Thanks, Timbo...

Replies are listed 'Best First'.
Re: LWP Authorization
by epoptai (Curate) on Jul 25, 2001 at 04:19 UTC
    Form login is different from HTTP authentication. It's usually done with LWP::Useragent and HTTP::Request::Common like this working example:
    #!perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; my $ua = LWP::UserAgent->new; my $request = POST ('http://perlmonks.org', [node=>'showchatmessages', + displaytype=>'raw']); my $response = $ua->request($request); my $page = $response->content; print $page;

    --
    Check out my Perlmonks Related Scripts like framechat, reputer, and xNN.

Re: LWP Authorization
by hacker_j99 (Beadle) on Jul 25, 2001 at 05:33 UTC
    I dont know if this is always correct but in some crude forms of auth. a enviroment variable will store the username. In all my scripts I have used a cookie approach taking

    the login script checks the ecryprted password to the encryted password in a database if its true it caches a cookie on the client while recording information (some long nearly random numbers in both the cookie and database making it hard to guess and hit two at once) on the cookie in the database

    a seperate handeler controls how long the cookie information is stored in the database (i.e. how long the cookie is good for based on clock speed) if a cookie expires it attempts to trash the cookie on the client and cleans the database

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://99525]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 10:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found