You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Steve Schwarz <sa...@hotmail.com> on 2004/03/09 15:22:58 UTC

[repost] authentication-fw accessing resource for redirect

Hi
Sorry to post again; but I'm stumped on this one...
Thanks
Steve

>Hi
>I've been pouring through the mail archives and can't seem to find what I'm 
>doing wrong...
>
>If I am not yet authenticated and I try to access a protected page, I am 
>(correctly) redirected to the login page with the uri containing the 
>(encoded) resource that I tried to access. How do I redirect back to the 
>protected resource I was originally seeking after logging in successfully?
>
>If it matters, I am doing all of this in a sub sitemap.
>
>Here's relevant sitemap entries:
>      <authentication-manager>
>        <handlers>
>          <handler name="uploadHandler">
>            <redirect-to uri="cocoon://agilitycourses/login"/>
>            <authentication uri="cocoon:/upload-authuser"/>
>            <applications>
>              <application loadondemand="true" name="courses">
>              </application>
>            </applications>
>          </handler>
>        </handlers>
>      </authentication-manager>
>
>this pipeline is called from the login form post action:
>	<map:match pattern="dologin">
>        <map:act type="auth-loggedIn">
>          <map:parameter name="handler" value="uploadHandler"/>
>          <map:redirect-to uri="alreadyLoggedIn"/>
>        </map:act>
>		<map:act type="auth-login">
>			<map:parameter name="handler" value="uploadHandler"/>
>			<map:parameter name="name" value="{request-param:name}"/>
>			<map:parameter name="password" value="{request-param:password}"/>
>			<map:parameter name="use-request-parameters" value="true"/>
><!-- I've tried {request-attr:resource} also w/no success -->
>			<map:redirect-to uri="{request-param:resource}"/>
>		</map:act>
>		<map:redirect-to uri="login"/>
>	</map:match>
>
><map:match pattern="protected/*">
><map:act type="auth-protect">
>  <map:parameter name="handler" value="uploadHandler"/>
>  <map:parameter name="application" value="courses"/>
>
>      <map:match pattern="**/upload_acml">
>        <map:generate src="web/content/upload_acml.html" />
>        <map:serialize type="html" />
>      </map:match>
>
></map:act>
></map:match>
>
>The "login" html is:
><html>
><head><title>LOGIN</title></head>
><body><form method="post" action="dologin">
><table><tr><td>Name: <input type="text" name="name"/></td></tr>
>	<tr><td>Password: <input type="password" name="password"/></td></tr>
>	<tr><td><input type="submit"/></td></tr></table></form></body>
></html>
>
>So if it access protected/upload_acml I am sent to:
>http://192.168.1.102:8888/agilitycourses/login?resource=%2Fagilitycourses%2Fprotected%2Fupload_acml
>
>I just can't seem to access the "resource" once the form is submitted.
>So the redirect goes to  the root of my site submap.
>
>Any help is greatly appreciated.
>Thanks
>Steve

_________________________________________________________________
Find things fast with the new MSN Toolbar – includes FREE pop-up blocking! 
http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: [repost] authentication-fw accessing resource for redirect

Posted by Johannes Textor <jc...@gmx.de>.
Hi Steve,

"resource" is a regular GET parameter, so you have to pass it on to the 
"dologin" pipeline
by hand, using a hidden field in your form.

Steve Schwarz wrote:

> Hi
> Sorry to post again; but I'm stumped on this one...
> Thanks
> Steve
>
>> Hi
>> I've been pouring through the mail archives and can't seem to find 
>> what I'm doing wrong...
>>
>> If I am not yet authenticated and I try to access a protected page, I 
>> am (correctly) redirected to the login page with the uri containing 
>> the (encoded) resource that I tried to access. How do I redirect back 
>> to the protected resource I was originally seeking after logging in 
>> successfully?
>>
>> If it matters, I am doing all of this in a sub sitemap.
>>
>> Here's relevant sitemap entries:
>> <authentication-manager>
>> <handlers>
>> <handler name="uploadHandler">
>> <redirect-to uri="cocoon://agilitycourses/login"/>
>> <authentication uri="cocoon:/upload-authuser"/>
>> <applications>
>> <application loadondemand="true" name="courses">
>> </application>
>> </applications>
>> </handler>
>> </handlers>
>> </authentication-manager>
>>
>> this pipeline is called from the login form post action:
>> <map:match pattern="dologin">
>> <map:act type="auth-loggedIn">
>> <map:parameter name="handler" value="uploadHandler"/>
>> <map:redirect-to uri="alreadyLoggedIn"/>
>> </map:act>
>> <map:act type="auth-login">
>> <map:parameter name="handler" value="uploadHandler"/>
>> <map:parameter name="name" value="{request-param:name}"/>
>> <map:parameter name="password" value="{request-param:password}"/>
>> <map:parameter name="use-request-parameters" value="true"/>
>> <!-- I've tried {request-attr:resource} also w/no success -->
>> <map:redirect-to uri="{request-param:resource}"/>
>> </map:act>
>> <map:redirect-to uri="login"/>
>> </map:match>
>>
>> <map:match pattern="protected/*">
>> <map:act type="auth-protect">
>> <map:parameter name="handler" value="uploadHandler"/>
>> <map:parameter name="application" value="courses"/>
>>
>> <map:match pattern="**/upload_acml">
>> <map:generate src="web/content/upload_acml.html" />
>> <map:serialize type="html" />
>> </map:match>
>>
>> </map:act>
>> </map:match>
>>
>> The "login" html is:
>> <html>
>> <head><title>LOGIN</title></head>
>> <body><form method="post" action="dologin">
>> <table><tr><td>Name: <input type="text" name="name"/></td></tr>
>> <tr><td>Password: <input type="password" name="password"/></td></tr>
>> <tr><td><input type="submit"/></td></tr></table></form></body>
>> </html>
>>
>> So if it access protected/upload_acml I am sent to:
>> http://192.168.1.102:8888/agilitycourses/login?resource=%2Fagilitycourses%2Fprotected%2Fupload_acml 
>>
>>
>> I just can't seem to access the "resource" once the form is submitted.
>> So the redirect goes to the root of my site submap.
>>
>> Any help is greatly appreciated.
>> Thanks
>> Steve
>
>
> _________________________________________________________________
> Find things fast with the new MSN Toolbar – includes FREE pop-up 
> blocking! http://clk.atdmt.com/AVE/go/onm00200414ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org