3 Replies Latest reply on Feb 27, 2009 12:46 PM by wachtda.scsi.gmx.ch

    User Name in loggedOut Event

    michaeltr

      Hello


      is it possible to get the user name of the logged out user in the org.jboss.seam.security.loggedOut event? I need it for an audit entry. As far as I can see the envent is raised after the session.invalidate so the user name is null.



      Michael

        • 1. Re: User Name in loggedOut Event
          shane.bryzak

          Session invalidation doesn't actually occur until the end of the request, the actual reason why the username is null is because the principal and credentials are cleared by the call to Identity.unAuthenticate().  The easiest workaround that I can think of off the top of my head is to write another observer for org.jboss.seam.security.postAuthenticate which copies the username to another variable in session scope, then you can read that value during the loggedOut event instead.

          • 2. Re: User Name in loggedOut Event
            michaeltr

            Thanks for your answer. That was my first idea too, but I thought there might be a more elegant solution.


            Michael

            • 3. Re: User Name in loggedOut Event
              wachtda.scsi.gmx.ch
              Wouldn't it be more elegant to write a own logout method, which calls manually the identity.logout()?

              For example:

              View -> #{authenticator.myLogout()}


              @In
              Identity identity;

              public void myLogout() {
                // do some stuff with the user
                // call the logout
                identity.logout();
              }