RE: Perl Single sign-on general login page: i need some help from the list
I can't see your example code because it was virus-blocked, but in=0D=0Agen=
eral, the answer to your question will be browser-specific=2E=0D=0A=0D=0AIf=
you have a HTTP::Response, you can write the contents to a file and=0D=0At=
hen bring up that file in your browser, e=2Eg=2E=0D=0A=0D=0Asystem("mybrows=
er file://tempfile=2Ehtml");=0D=0A=0D=0A=0D=0A-----Original Message-----=0D=
=0AFrom: Andrea Setti [mailto:asetti [at] eonegroup=2Eit] =0D=0ASent: Thursday, =
March 17, 2005 12:29 PM=0D=0ATo: 'John J Lee'=0D=0ACc: libwww [at] perl=2Eorg=0D=
=0ASubject: Perl Single sign-on general login page: i need some help from=
=0D=0Athe list=0D=0A=0D=0AHi John, Hi list=2E=0D=0A=0D=0AI need your help f=
or two tasks:=0D=0A=0D=0AI need to forward a HTTP::Message object to the cl=
ient's browser and=0D=0Adon't=0D=0Aknow how to do it=2E=0D=0ASecond, if som=
eone could help me to simplify or optimize this script=0D=0Ashould=0D=0Abe =
helpful=2E=0D=0A=0D=0AAs John already know (his patience is almost infinite=
), this script=0D=0Atries to=0D=0Abe a login submission page for a general =
single sign-on purpose=2E=0D=0AI wrote it to be used with TYPO3 CMS but sho=
uld be ok for every type of=0D=0Asite=2E=0D=0A=0D=0ACan someone help me to =
finish it?=0D=0A=0D=0AThanks a lot to everyone!=0D=0A=0D=0A=0D=0A=0D=0A----=
-------------------------------------=0D=0A***************** ***************=
************************************=0D=0AThis e-mail is intended only for =
the addressee named above=2E As this e-mail=0D=0Amay contain confidential =
or privileged information, if you are not the=0D=0Anamed addressee, you ar=
e not authorised to retain, read, copy or=0D=0Adisseminate this message or=
any part of it=2E=0D=0A************************************************* **=
*****************=0D=0A
R: Perl Single sign-on general login page: i need some help from the list
Sorry to everyone for the virus blocking.
Following i'm attaching the original code.
Unfortunately, i need this script to be a milleware between the original
site and a CMS, so i cannot open a localhtml page to a system. It has to =
be
a cgi.
BOF--------------------------------BOF
#!C:\Perl\Bin\Perl -W
#!/usr/bin/perl
# ------------------------------------------------------------ ---------
# Coded by Andrea Setti 17-03-2005 - Reggio Emilia - ITALY
# infos to: my $domain =3D'eone group';
# $domain =3D~ s/\ //;
# print "asetti at " . $domain . " dot it";
# released under the GNU Public License
# see http://www.gnu.org/copyleft/gpl.html for further infos.
# ------------------------------------------------------------ ---------
# ------------------------------------------------------------ ---------
# ToDo: 1. forward $objHTMessage to the real browser
# 2. handle POST information about login and password
# (see line 13 to 17 of this script)
# 3. change the references to the real ones on $objHTMessage
# (they could point to the mechanize object that are links
# to the server's cache.
# ------------------------------------------------------------ ---------
use strict;
use Net::SSLeay;
use WWW::Mechanize;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Headers;
use HTTP::Message;
#use CGI;
# these variables will be passed by a CMS webpage via POST
# passing these variables has to be implemented.
my $login_url =3D 'http://<mysite>/<mycgi-dir>/<mycgiscript>';
my $username =3D 'my_login_username';
my $password =3D 'my_login_password';
# initializes cookies and fetches the login page
my $mech =3D WWW::Mechanize->new(cookie_jar =3D> {});
$mech->agent_alias( 'Windows IE 6' );
$mech->get($login_url);
# check result
$mech->success or die "Can't get the search page";
# fills the login page and saves all the form input_values
$mech->submit_form(
form_name =3D> 'a',
fields =3D> {
wtusername =3D> $username,
wtpassword =3D> $password,
},
);
# to fetch also the cookies, i need to build a new HTTP message,
# using HTTP::Message i can attach both the cookies fetched by the login
page and the content of the authenticated page.
#my $redirect_url =3D =
${$mech->{req}->{_uri}}."?".$mech->{req}->{_content};
my $headers =3D HTTP::Headers->new;
$headers =3D $mech->{req}->{_headers};
my $html_response =3D $mech->{content};
# builds the HTTP::Message object
my $objHTMessage =3D HTTP::Message->new($headers,$html_response);
#print $redirect_url."\n\n".$headers->as_string."\n\n";
#my $objCGI =3D new CGI;
# prints out the object
print $objHTMessage->as_string;
EOF--------------------------------EOF
-----Messaggio originale-----
Da: Worenklein, David, GCM [mailto:worenkd [at] gcm.com]
Inviato: gioved=EC 17 marzo 2005 22.08
A: Andrea Setti; John J Lee
Cc: libwww [at] perl.org
Oggetto: RE: Perl Single sign-on general login page: i need some help =
from
the list
I can't see your example code because it was virus-blocked, but in =
general,
the answer to your question will be browser-specific.
If you have a HTTP::Response, you can write the contents to a file and =
then
bring up that file in your browser, e.g.
system("mybrowser file://tempfile.html");
-----Original Message-----
From: Andrea Setti [mailto:asetti [at] eonegroup.it]
Sent: Thursday, March 17, 2005 12:29 PM
To: 'John J Lee'
Cc: libwww [at] perl.org
Subject: Perl Single sign-on general login page: i need some help from =
the
list
Hi John, Hi list.
I need your help for two tasks:
I need to forward a HTTP::Message object to the client's browser and =
don't
know how to do it.
Second, if someone could help me to simplify or optimize this script =
should
be helpful.
As John already know (his patience is almost infinite), this script =
tries to
be a login submission page for a general single sign-on purpose.
I wrote it to be used with TYPO3 CMS but should be ok for every type of
site.
Can someone help me to finish it?
Thanks a lot to everyone!
-----------------------------------------
************************************************************ ********
This e-mail is intended only for the addressee named above. As this =
e-mail
may contain confidential or privileged information, if you are not the
named addressee, you are not authorised to retain, read, copy or
disseminate this message or any part of it.
************************************************************ ********