Re: [Acegisecurity-developer] Can I have a secured page containing a form with method=post?

2008-04-21 Thread Sorin Postelnicu
:)
Thanks for your reply.
It's a little more complicated than that :)

Our client has very complex requirements. I already created an 
ExtendedAuthenticationProcessingFilter to handle some of these requirements :)
But the problem with POST is quite tricky.
I discovered its cause, which is as following:
The problem occurs when I try to access the page containing the form while not 
being logged-in.
This causes the ExceptionTranslationFilter to save the request on the session, 
under the ACEGI_SAVED_REQUEST_KEY. This SavedRequest has (of course) the method 
GET.
Then the login form is presented, and after login the SavedRequestAwareWrapper 
does the following:

SavedRequest saved = (SavedRequest) 
session.getAttribute(AbstractProcessingFilter.ACEGI_SAVED_REQUEST_KEY);

if ((saved != null)  saved.doesRequestMatch(request, portResolver)) {
savedRequest = saved;
session.removeAttribute(AbstractProcessingFilter.ACEGI_SAVED_REQUEST_KEY);
..
}

This code looks perfectly ok, because the SavedRequest is removed from the 
session.
But the problem is that after this filter, on the next request or somewhere, I 
can't determine where and why, the SavedRequest re-appears on the session!!
I actually tried to debug through the Apache Tomcat code (I use Tomcat 6), and 
still could not determine why the SavedRequest re-appears.

For now I have found the simple workaround of using some URL for the initial 
GET that displays the form, and a different URL for the action=... 
method=POST.

Sorin



On Mon, 2008-04-21 at 15:07 +0200, olivier nouguier wrote:
 yap,
  I use to observe the same (odd) behaviour with standard j2ee form
 login configuration ... but with acegi you can
 alwaysUseDefaultTargetUrl to avoid this (setting default target to
 /init.action or a like). 
 hih
 
 
 
 On Mon, Apr 21, 2008 at 12:36 PM, Sorin Postelnicu
 [EMAIL PROTECTED] wrote:
 Hi guys,
 
 Can anyone confirm to me that if I have a secured page and
 this page contains a form with method=post (and action=the
 same page), then the POST will not work?
 The behaviour that I noticed is that the POST is converted to
 a GET when going through the filter chain. Is this true?
 And is there any way to solve this?
 If anyone else encountered this problem, thank you for any
 solution or suggestion you can give me.
 
 Sorin Postelnicu
 
 
 
 
 -
 This SF.net email is sponsored by the 2008 JavaOne(SM)
 Conference
 Don't miss this year's exciting event. There's still time to
 save $100.
 Use priority code J8TL2D2.
 
 http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
 ___
 Home: http://acegisecurity.org
 Acegisecurity-developer mailing list
 Acegisecurity-developer@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer
 
 
 
 -- 
 Quand le dernier arbre sera abattu, la dernière rivière asséchée, le
 dernier poisson péché, l'homme va s'apercevoir que l'argent n'est pas
 comestible 
 - proverbe indien Cri 
 -
 This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
 Don't miss this year's exciting event. There's still time to save $100. 
 Use priority code J8TL2D2. 
 http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
 ___ Home: 
 http://acegisecurity.org Acegisecurity-developer mailing list 
 Acegisecurity-developer@lists.sourceforge.net 
 https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


-
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


Re: [Acegisecurity-developer] How can I include a login form on multiple pages, and return to the original page after login?

2007-09-07 Thread Sorin Postelnicu
I posted a solution for this problem here:
http://blog.tremend.ro/2007/09/07/how-to-use-the-request-referer-as-the-targeturl-when-using-acegi-security-for-spring/




-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer


[Acegisecurity-developer] How can I include a login form on multiple pages, and return to the original page after login?

2007-08-15 Thread Sorin Postelnicu
Hi guys!

I have a question for anyone who has solved this problem before:
I included the same login form on multiple pages on my site, and I want
the following functionality:
When a user logs-in (using the login form on any page), if the login is
successful he will be returned to the same page from which he logged-in.
And, if possible, something similar if the login is not successful: he
will be returned to the same page from which he logged-in, but with a
request parameter set to some value (for example ?login_error=1).
The controller for the page already knows to display different things
based on the user being logged-in or not, and to handle the login_error
parameter.
I just want to know how can I configure Acegi to accomplish this (hoping
that it is possible).
The configuration that is described in the Acegi documentation redirects
the user to a defaultTargetUrl or an authenticationFailureUrl, but I do
not want that. The AbstractProcessingFilter can return to the page saved
under the ACEGI_SAVED_REQUEST_KEY by the ExceptionTranslationFilter, but
only after an AccessDeniedException or AuthenticationException.
But I need it to return to the same page from which the login form was
submitted.

Thanks for anyone who can help!



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Home: http://acegisecurity.org
Acegisecurity-developer mailing list
Acegisecurity-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/acegisecurity-developer