perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richter, Gerald" <rich...@ecos.de>
Subject RE: Re: Exit frustration
Date Fri, 19 Jan 2007 11:33:08 GMT
Hi,

Sorry for my late reply, I was offline for some time.

At the moment I can't reproduce the problem here.

Is it possible for you to put a few lines of code together that shows 
the problem, which I can run here to see what's going on?

Gerald
 

> -----Original Message-----
> From: Gunnar Wolf [mailto:gwolf@gwolf.org] 
> Sent: Tuesday, January 16, 2007 11:15 PM
> To: Oskar Ahner
> Cc: Richter, Gerald; embperl@perl.apache.org
> Subject: Re: Exit frustration
> 
> Oskar Ahner dijo [Wed, Jan 10, 2007 at 08:02:56PM +0100]:
> > >Umh... I understand that "clean" is very subjective, but 
> it's cleaner 
> > >for me sometimes to exit this way. In this specific case, 
> I'm calling 
> > >exit from my redirect method, in order to _avoid_ going 
> through the 
> > >rest of the logic - i.e., at user authentication time, if 
> the user is 
> > >not successfully authenticated, from the Embperl base.pm's init 
> > >method, I just call 
> $epreq->{webclient}->redirect('login.html'), and 
> > >that's it.
> > >  
> > Ok, I didn't mean it to do it uncleanly :-) I was thinking about a 
> > solution where a "message" can be passed between the 
> different phases 
> > (like $r->notes in mod_perl). In such a case You can set a flag to 
> > indicate failure for instance, and all other sub routines check for 
> > this status flag.
> 
> I understand you... I might have done this earlier, before 
> getting the application working ;-) But right now, if I don't 
> have to, I'd rather not shake the mix too hard ;-)
> 
> > Btw, are You
> > coding your authentication  mechanism
> > in embperl or mod perl? I  tried to do it in embperl but 
> ended up in 
> > mod perl by it it's "lower level nature".
> > But I'm interrested in authentication modules written 
> purley in embperl.
> 
> It depends on what do you want to achieve - I am not a fan of 
> most authentication methods used in mod_perl (i.e. HTTP basic 
> authentication), as they usually involve a 
> login/passwd-equivalent exchange at every request. I prefer 
> doing my authentication against a (secure enough, of course) 
> cookie stored in the client linked to the session information 
> which resides only in the server - And that's precisely what 
> embperl provides. I'm simplifying this from my base.pm (I can 
> send you the whole system if you are interested anyway - In 
> this case, it's a simplistic Web-to-SMB read-only gateway). 
> As for every connection I need to instantiate the SmbGate 
> object (which, in turn, contains a Filesys::SmbClient) with 
> the user's login and password, I store them both in %udat. 
> Here it goes:
> 
> sub init {
>     my ($self);
>     $self = shift;
> 
>     # Errors and messages should always be arrayrefs, even if empty
>     $udat{err} = [] unless $udat{err};
>     $udat{msg} = [] unless $udat{msg};
>     $epreq->{warnings} = SmbGate::Embperl::Warnings->new($udat{err},
>     $udat{msg});
> 
>     # Set up the base SmbGate object
>     $epreq->{smb} = SmbGate->new();
> 
>     $epreq->{webclient} = SmbGate::Embperl::WebClient->new($epreq,
> 							   
> \%http_headers_out,
> 							   \%udat);
>     $epreq->{webclient}->content_type('text/html'); # Can be 
> changed later
> 
>     # Validate user if we get login/passwd
>     if ($fdat{login} and $fdat{passwd}) {
>     # Just pass them on to the session - We will check them 
> right away.
>     # We store both login _and_ password in our session, as we will
>     # need both to start future Samba sessions
>     $udat{login} = $fdat{login};
>     $udat{passwd} = $fdat{passwd};
>     }
> 
>     if ($udat{login} and $udat{passwd}) {
>     $epreq->{smb}->login("smb://iiec/$udat{login}",
> 		     $udat{login}, $udat{passwd}) or
> 		         $epreq->{warnings}->add_err("Invalid 
> user/password");
> 
>     }
> 
> 
>     # Initialize the HTML helper module (this has to happen 
> after the user is
>     # logged in)
>     $epreq->{html} = SmbGate::Embperl::HtmlHelper->new(user =>
>       $udat{login},
> 			           base => $epreq->{conf}->base_url);
> 
>     # Debug mode? Take care of it here. Leave authorization to the
>       called
>     # methods.
>     $epreq->{webclient}->set_debug if $fdat{set_debug};
>     $epreq->{webclient}->unset_debug if $fdat{unset_debug};
> 
>     0;
> }
> 
> Greetings,
> 
> --
> Gunnar Wolf - gwolf@gwolf.org - (+52-55)5623-0154 / 1451-2244 
> PGP key 1024D/8BB527AF 2001-10-23
> Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5 27AF
> 
>  
> ** Virus checked by BB-5000 Mailfilter ** 
> !DSPAM:45ad4f673528577028921!
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message