logo       
Google Custom Search
    AddThis Social Bookmark Button

R: Perl Single sign-on general login page: i need some help from the list: msg#00025

Subject: 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 ='eone group';
#                                  $domain =~ 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 = 'http://<mysite>/<mycgi-dir>/<mycgiscript>';
my $username  = 'my_login_username';
my $password  = 'my_login_password';

# initializes cookies and fetches the login page
my $mech = WWW::Mechanize->new(cookie_jar => {});
$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 => 'a',
    fields => {
        wtusername => $username,
        wtpassword => $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 = ${$mech->{req}->{_uri}}."?".$mech->{req}->{_content};
my $headers       = HTTP::Headers->new;
   $headers       = $mech->{req}->{_headers};
my $html_response = $mech->{content};

# builds the HTTP::Message object
my $objHTMessage  = HTTP::Message->new($headers,$html_response);

#print $redirect_url."\n\n".$headers->as_string."\n\n";
#my $objCGI = new CGI;

# prints out the object
print $objHTMessage->as_string;
EOF--------------------------------EOF


-----Messaggio originale-----
Da: Worenklein, David, GCM [mailto:worenkd@xxxxxxx] 
Inviato: giovedì 17 marzo 2005 22.08
A: Andrea Setti; John J Lee
Cc: libwww@xxxxxxxx
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@xxxxxxxxxxxx]
Sent: Thursday, March 17, 2005 12:29 PM
To: 'John J Lee'
Cc: libwww@xxxxxxxx
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.
********************************************************************






Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>