You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anton Pussep <an...@pussep.de> on 2007/10/01 01:11:36 UTC

Login implementation, how to forward user to original destination?

I spent quite a few hours today trying to forward the user to his
original destination when he has to login in between.

I have an interceptor (Authentication) that is called before an action
and it forwards to Login.action if the user is not logged in. The
problem is that if Login.action returns SUCCESS the struts.xml maps it
to a static page (index.jsp) and not the page originally requested by
the user.

My current solution is it that the Authentication interceptor saves the
requested URL as a session attribute and Login.action reads it and makes
a getResponse().sendForward(requestedURL). However, I am not happy with
this solution and I guess there are some much better solutions out
there. Would be great if you could suggest me a better way to do that.

Best regards,
Anton

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Own TextProvider implementation for validation

Posted by Anton Pussep <an...@pussep.de>.
I would like to use an own i18n system with the validation provided by
Struts 2 and XWork 2. The action-validation.xml will contain keys as
messages and those keys should be used in order to retrieve the messages
from my i18n system. There seems to be a TextProvider interface, thus I
could probably create an own implementation of it and set my own
TextProvider in TextProviderFactory? But I am also wondering if Struts
also provides something similar, since ActionSupport also implements
TextProvider, so is the action used as a TextProvider by the validation
interceptor?

Best,
Anton

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Login implementation, how to forward user to original destination?

Posted by Paul Benedict <pb...@apache.org>.
There's no perfect solution. You should choose a first-win or last-win
strategy.

Paul

On 10/1/07, Anton Pussep <an...@pussep.de> wrote:
>
> First of all thanks a lot for the fast reply.
>
> The problem with storing something in the session is it that if the user
> tried to access two different pages at once in separate windows and had
> to login in both, he will be forwarded in both to the last page he tried
> to access. I think this is a quite realistic scenario, for example if a
> user was logged in and used the service in separate windows, but was
> kicked out by the system because he was inactive for a while. Any way to
> do that?
>
> Best,
> Anton
>
> Paul Benedict wrote:
> > Anton,
> >
> > Acegi Security does something similar. The original requests (yes -- the
> > actual request object) is stored in the session when the user's
> credentials
> > are challenged. If they then succeed at the login page, the original
> request
> > is taken from the session and forwarded along.
> >
> > Paul
> >
> > On 9/30/07, Anton Pussep <an...@pussep.de> wrote:
> >> I spent quite a few hours today trying to forward the user to his
> >> original destination when he has to login in between.
> >>
> >> I have an interceptor (Authentication) that is called before an action
> >> and it forwards to Login.action if the user is not logged in. The
> >> problem is that if Login.action returns SUCCESS the struts.xml maps it
> >> to a static page (index.jsp) and not the page originally requested by
> >> the user.
> >>
> >> My current solution is it that the Authentication interceptor saves the
> >> requested URL as a session attribute and Login.action reads it and
> makes
> >> a getResponse().sendForward(requestedURL). However, I am not happy with
> >> this solution and I guess there are some much better solutions out
> >> there. Would be great if you could suggest me a better way to do that.
> >>
> >> Best regards,
> >> Anton
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> For additional commands, e-mail: user-help@struts.apache.org
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Login implementation, how to forward user to original destination?

Posted by Anton Pussep <an...@pussep.de>.
First of all thanks a lot for the fast reply.

The problem with storing something in the session is it that if the user
tried to access two different pages at once in separate windows and had
to login in both, he will be forwarded in both to the last page he tried
to access. I think this is a quite realistic scenario, for example if a
user was logged in and used the service in separate windows, but was
kicked out by the system because he was inactive for a while. Any way to
do that?

Best,
Anton

Paul Benedict wrote:
> Anton,
> 
> Acegi Security does something similar. The original requests (yes -- the
> actual request object) is stored in the session when the user's credentials
> are challenged. If they then succeed at the login page, the original request
> is taken from the session and forwarded along.
> 
> Paul
> 
> On 9/30/07, Anton Pussep <an...@pussep.de> wrote:
>> I spent quite a few hours today trying to forward the user to his
>> original destination when he has to login in between.
>>
>> I have an interceptor (Authentication) that is called before an action
>> and it forwards to Login.action if the user is not logged in. The
>> problem is that if Login.action returns SUCCESS the struts.xml maps it
>> to a static page (index.jsp) and not the page originally requested by
>> the user.
>>
>> My current solution is it that the Authentication interceptor saves the
>> requested URL as a session attribute and Login.action reads it and makes
>> a getResponse().sendForward(requestedURL). However, I am not happy with
>> this solution and I guess there are some much better solutions out
>> there. Would be great if you could suggest me a better way to do that.
>>
>> Best regards,
>> Anton
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Login implementation, how to forward user to original destination?

Posted by Paul Benedict <pb...@apache.org>.
Anton,

Acegi Security does something similar. The original requests (yes -- the
actual request object) is stored in the session when the user's credentials
are challenged. If they then succeed at the login page, the original request
is taken from the session and forwarded along.

Paul

On 9/30/07, Anton Pussep <an...@pussep.de> wrote:
>
> I spent quite a few hours today trying to forward the user to his
> original destination when he has to login in between.
>
> I have an interceptor (Authentication) that is called before an action
> and it forwards to Login.action if the user is not logged in. The
> problem is that if Login.action returns SUCCESS the struts.xml maps it
> to a static page (index.jsp) and not the page originally requested by
> the user.
>
> My current solution is it that the Authentication interceptor saves the
> requested URL as a session attribute and Login.action reads it and makes
> a getResponse().sendForward(requestedURL). However, I am not happy with
> this solution and I guess there are some much better solutions out
> there. Would be great if you could suggest me a better way to do that.
>
> Best regards,
> Anton
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>