R: Help!! I'm stuck! - using LWP for single sign on purposes

Thank you for the answer.

I had a look th WWW::Mechanize and it does almost everything that i =
need.

The only thing i cannot understand is: how can i forward the cookie to =
the
real browser?
I need to fetch it from the real login page and then forward it to the
referrer...

-----Messaggio originale-----
Da: Bret Swedeen [mailto:bret [at] pobox.com]
Inviato: luned=EC 28 febbraio 2005 19.39
A: Andrea Setti
Oggetto: Re: Help!! I'm stuck! - using LWP for single sign on purposes

As Andy Lester mentioned in his previous response...use WWW::Mechanize =
as it
will make this type of task much easier. Also, since you are =
authenicating
with a username and password, that transaction might occur over https. =
In
that case you will also need the mod Crypt::SSLeay to handle the SSL =
piece
of communication.
Finally, don't forget to enable cookies in your code. Near the top add =
the
line "use HTTP::Cookies;" Spend some time with WWW::Mechanize, it is =
well
worth the time spent.


On 28 Feb 2005 at 15:51, Andrea Setti wrote:

> hi list!
>
> i need your help:
>
> i use LWP to fetch a login page, that i need to fill out and re-send
> to the server in order to authenticate an user in a Single Sign-On
> environment.
>
> i need to fetch some input type's values from the original login page, =

> put username & password and then send everything via POST to the
> server.
>
> i have two problems:
>
> 1. how can i make a post request?
> 2. when i fetch data, i also need to fetch a cookie, that contains the =

> session ID.how can i "foward" it to the browser?
>
> thanks a lot!!
>
>
>
asetti [ Di, 01 März 2005 09:14 ] [ ID #669946 ]

Re: R: Help!! I'm stuck! - using LWP for single sign on purposes

--------------060209010204060703040308
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable

Dear Andrea,

HTTP::Cookies has two submodules. one for Mozilla browsers and one for
Microsoft browsers. Unfortunately the MS version does not support saving =

the cookies. (BTW - everybody knows, Firefox is the better browser ;-) ).=


I have not used these modules, just found them on cpan. If you have not
already discovered it, search.cpan.org is an excellent way to find the
modules you need (although wading through the volume can be a bit of a
challenge). A search for Cookies Microsoft produces over a thousand
results, perhaps one of them will be useful...

Cheers & Good Luck

Peter

Andrea Setti wrote:

>Thank you for the answer.
>
>I had a look th WWW::Mechanize and it does almost everything that i need=
=2E
>
>The only thing i cannot understand is: how can i forward the cookie to t=
he
>real browser?
>I need to fetch it from the real login page and then forward it to the
>referrer...
>
>-----Messaggio originale-----
>Da: Bret Swedeen [mailto:bret [at] pobox.com]
>Inviato: luned=EC 28 febbraio 2005 19.39
>A: Andrea Setti
>Oggetto: Re: Help!! I'm stuck! - using LWP for single sign on purposes
>
>As Andy Lester mentioned in his previous response...use WWW::Mechanize a=
s it
>will make this type of task much easier. Also, since you are authenicat=
ing
>with a username and password, that transaction might occur over https. =
In
>that case you will also need the mod Crypt::SSLeay to handle the SSL pie=
ce
>of communication.
>Finally, don't forget to enable cookies in your code. Near the top add =
the
>line "use HTTP::Cookies;" Spend some time with WWW::Mechanize, it is we=
ll
>worth the time spent.
>
>
>On 28 Feb 2005 at 15:51, Andrea Setti wrote:
>
>
>
>>hi list!
>>
>>i need your help:
>>
>>i use LWP to fetch a login page, that i need to fill out and re-send
>>to the server in order to authenticate an user in a Single Sign-On
>>environment.
>>
>>i need to fetch some input type's values from the original login page, =

>>put username & password and then send everything via POST to the
>>server.
>>
>>i have two problems:
>>
>>1. how can i make a post request?
>>2. when i fetch data, i also need to fetch a cookie, that contains the =

>>session ID.how can i "foward" it to the browser?
>>
>>thanks a lot!!
>>
>>
>>
>>
>>
>
>
>
>
>
>
>

--
------------------------------------------------------------ ----------
Peter Stevens Phone: +41 43 535 8517
www.MinuteWatcher.com Fax: +41 44 544 8392


--------------060209010204060703040308--
peter.stevens [ Di, 01 März 2005 09:36 ] [ ID #669947 ]

Re: R: Help!! I'm stuck! - using LWP for single sign on purposes

On Tue, 1 Mar 2005, Peter Stevens wrote:

> HTTP::Cookies has two submodules. one for Mozilla browsers and one for
> Microsoft browsers. Unfortunately the MS version does not support saving
> the cookies. (BTW - everybody knows, Firefox is the better browser ;-) ).
[...]

Those are only needed if you want to interoperate with those browsers.
Use HTTP::Cookies itself otherwise.


John
jjl [ Di, 01 März 2005 13:46 ] [ ID #672138 ]

Re: R: Help!! I'm stuck! - using LWP for single sign on purposes

On Tue, 1 Mar 2005, Andrea Setti wrote:

> Thank you for the answer.
>
> I had a look th WWW::Mechanize and it does almost everything that i need.
>
> The only thing i cannot understand is: how can i forward the cookie to the
> real browser?
> I need to fetch it from the real login page and then forward it to the
> referrer...
[...]

You don't have to forward the cookies explicitly -- it's all done under
the covers automatically. You just have to make sure it's switched on.

I don't recall if cookie handling is on by default in mechanize, though.
I would imagine so, but don't trust me: read the docs.


John
jjl [ Di, 01 März 2005 13:49 ] [ ID #672139 ]
Perl » perl.libwww » R: Help!! I'm stuck! - using LWP for single sign on purposes

Vorheriges Thema: Architectural Question rgd LWP::UserAgent, WWW::Mechanize
Nächstes Thema: Mechanize - redirect problem