1 Reply Latest reply on Apr 1, 2009 6:18 AM by Arbi Sookazian

    Seam Security loginSuccessful observer not firing

    Troy Sellers Newbie

      Hi All,


      I have configured my Seam App to use the container security



      <security:identity jaas-config-name="activeDirectory" />




      This may be a stupid question, but would this now mean that my observer is not going to be called?
      The Seam docs are a little quiet about this kind of configuration....


      I am using JBoss 4.2.3 community server and have configured with an application-policy called activeDirectory, this is configured to talk to an AD 2003 server.


      This piece of code lives in the Authenticator (stateless) class that is part of my application.


      @Observer("org.jboss.seam.security.loginSuccessful")
      public void afterLogin() {
           
           logger.info("User [#{identity.credentials.username}] has logged in");
      }



      This observer should fire with a successful login under these circumstances yeah?


      Cheers,
      Troy


        • 1. Re: Seam Security loginSuccessful observer not firing
          Arbi Sookazian Master

          from Seam 2.1.1.GA ref doc:


          15.3.2.2. Writing an event observer for security-related events
          Say for example, that upon a successful login that some user statistics must
          be updated. This would be done by writing an event observer for the
          org.jboss.seam.security.loginSuccessful event, like this:


          @In UserStats userStats;
          @Observer("org.jboss.seam.security.loginSuccessful")
          public void updateUserStats()
          {
          userStats.setLastLoginDate(new Date());
          userStats.incrementLoginCount();
          }


          This observer method can be placed anywhere, even in the Authenticator component itself.