Jim,

I would be interested in seeing your HTTPSessionListener implementation.


David,

I'm going to hazard a guess that indeed you would need to do some
configuration through tapestry-ioc.  Can I assume that the events that you
do see are from services that you have configured entirely in Spring?


Regards,

Jonathan


On Wed, Mar 30, 2011 at 12:14 PM, Jim O'Callaghan <jc1000...@yahoo.co.uk>wrote:

> Hi David,
>
> Is there something specific in the ApplicationListener approach you
> require?  I use TSS and have a login page that in its onSuccess method
> sends
> a redirect like so:
>
> @Inject
> private HttpServletResponse response;
> .
> .
> .
>          Object onSuccess() throws IOException
>          {
>                 response.sendRedirect(request.getContextPath() + checkUrl +
> "?j_username=" +
>                              login.getUserName() + "&j_password=" +
> login.getPassword() +
>                            "&_spring_security_remember_me=" +
> (login.isRememberMe() ? "checked" : ""));
>
> and then in it’s onActivate method:
>
>            void onActivate(String extra) {
>                if (extra.equals("failed")) {
>                   failed = true;
>
> form.recordError(messages.get("login.invalidUsernameOrPassword"));
>                } else {
>                      // do your thing
>                      .
>                      .
>                      .
>            }
>
>
> I use a registered listener that implements HTTPSessionListener to update a
> hashtable of where a user has last been etc. for a kind of dashboard page,
> and some db calls to update a persisted logged on flag on a user table –
> would this approach be of any use to you?
>
> Regards,
> Jim.
>
> From: David Uttley [mailto:dutt...@democracysystems.com]
> Sent: 30 March 2011 16:29
> To: Tapestry users
> Subject: Re: Logon notification
>
> Hi Peter,
>
> If it was as easy as what you suggest I wouldn't have bothered with the
> mailing list, this is a last resort I don't use these mailing lists lightly
> only when I  start banging my head against a wall, I had already done the
> registering of the ApplicationListener. As for lack of detail I am not
> really sure what to post that would be of help. I would also argue that it
> is a Tapestry question as I am using Tapestry Spring Security which is
> configured directly by T5. Spring is reporting events to the
> ApplicationListener its the events that occur in Tapestry Spring Security
> that are not appearing. If I use the first example then I get other events
> from the container but not from TSS.
>
> I have been in contact with the guy from TSS and he told me his Spring
> knowledge was limited and directed me to the Tapestry mailing board.
>
> From looking through the debugger it appears that TSS has no application
> listeners to notify when it wishes to send an event. However, Spring has an
> application listener as I am getting other events from it. Therefore, I am
> confused how the ApplicationListener is set on TSS, I wonder if I have to
> specifically add the ApplicationListener for Tapestry in the AppModule. It
> seems like the TSS is initialised before the Spring context files and
> annotations.
>
> It looks like TSS has little support and I probably should cut my losses
> now
> and remove it and just go for a pure Spring based implementation.
>
> Thanks
> David
>
>
> On 30 Mar 2011, at 16:00, p.stavrini...@albourne.com wrote:
>
> > Hi David,
> >
> > Apart from the lack of details in your question, this is also hardly a
> Tapestry question. You should direct it to the Spring forums instead, but
> if
> this reply helps so be it:
> >
> > You will need in your applicationContext.xml to define a bean that will
> automatically start receiving events (I assume you know how)... I am not
> familiar with Spring security, but the API docs are quite clear:
> >
> >
>
> http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframe
> work/context/ApplicationListener.html
> >
> > So code that might have looked something like this in the past:
> >
> > public void onApplicationEvent(ApplicationEvent applicationEvent)
> > {
> >    if (applicationEvent instanceof AuthenticationSuccessEvent)
> >    {
> >        AuthenticationSuccessEvent event = (AuthenticationSuccessEvent)
> applicationEvent;
> >        UserDetails userDetails = (UserDetails)
> event.getAuthentication().getPrincipal();
> >
> >        //notify here now, etc.
> >    }
> > }
> >
> > 'In theory' (untested of course) can now be replaced by:
> >
> > public void onApplicationEvent(AuthenticationSuccessEvent successEvent)
> > {
> >    UserDetails userDetails = (UserDetails)
> successEvent.getAuthentication().getPrincipal();
> >    //notify here etc.
> >
> > }
> >
> > And thats all?!
> >
> > Cheers,
> > Peter
> >
> >
> >
> > ----- Original Message -----
> > From: "David Uttley" <dutt...@democracysystems.com>
> > To: "Tapestry users" <users@tapestry.apache.org>
> > Sent: Wednesday, 30 March, 2011 16:50:26 GMT +02:00 Athens, Beirut,
> Bucharest, Istanbul
> > Subject: Logon notification
> >
> > So do I have any takers for this problem?
> >
> > Somebody must be recording logins somewhere, I don't have to use Spring
> to
> do it.
> >
> > ------Original message
> >
> > I am trying to get spring security to notify me of a successful logon
> using the Spring ApplicationListener. However, the ApplicationListener
> doesn't seem to be notified of the events.
> >
> > Any help or pointers will be appreciated.
> >
> > I am using t5.2 Spring 3.0 and the 3.0.0-snapshot of t5 Spring Security.
> >
> >
> > -------
> >
> > Thanks
> > David
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> ________________________________________
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1209 / Virus Database: 1500/3538 - Release Date: 03/29/11
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>


-- 
Jonathan Barker
ITStrategic

Reply via email to