You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Amish Desai <am...@yahoo.com> on 2007/03/06 21:08:11 UTC

Redirect URL in AuthCookie


Hi,

I am facing issue in Redirecting URL after the user authenticates himself
using AuthCookie. I am new to Apache Per modules. any code with the
implementation would be appreciated.

My user wants to access xyz.html page on web server, now since that folder
is proctected he is shown a login.pl form for Authentication. the form has 3
fields username/password/groupid. Using AuthCookie I am calling my own sub
subroutine for login in Sample::AuthCookie.pm which as follows.

sub login($$$){

	my $self = shift;
        my $r = shift;
   	my $q=new CGI;

	my %args = $r->method eq 'POST' ? $r->content : $r->args;
	my $name='destination';
	
	my $redirect_url= $args{$name};
	
	#printf (STDOUT $redirect_url);
	print $q->redirect($redirect_url);
	
	#return OK;
}

It takes me back to login.pl page when I hit submit and does not redirect me
to xyz.html page. Login.pl page has hidden form element as destination. 
After reading AuthCookie page it says we need to implement authen_cred and
authen_ses_key in your subclass. So question is when does this 2 sub
routines get called and how? What should be the code in tis subroutines? 

My http.conf is 
<Location /cgi-bin/>
 
   AuthType Sample::AuthCookieHandler
   AuthName WhatEver
   PerlAuthenHandler Sample::AuthCookieHandler->authenticate
   PerlAuthzHandler Sample::AuthCookieHandler->authorize
   Require valid-user
                
   PerlSendHeader On
   #Options +FollowSymLinks
</Location>
   
# Login location.
<Files AUTHORIZE>
      AuthType Sample::AuthCookieHandler
      AuthName WhatEver
      SetHandler perl-script
      PerlHandler Sample::AuthCookieHandler->login
</Files>

thanks,
Amish
-- 
View this message in context: http://www.nabble.com/Redirect-URL-in-AuthCookie-tf3357975.html#a9340031
Sent from the mod_perl - Dev mailing list archive at Nabble.com.


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