15.3.2.2. Writing an event observer for security-related events

If, upon successful login, some user statistics require updates, you can write 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. More information about other security-related events appears later in the chapter.