Not sure what version of Portal you're on, but you should check out the UserEvent API: http://docs.jboss.com/jbportal/v2.6.5/javadoc/org/jboss/portal/api/user/event/UserEvent.html
There's an example (for 2.6.X) that describes building a user counter using the UserAuthenticatedEvent: http://docs.jboss.org/jbportal/v2.6.5/referenceGuide/html_single/#d0e8341.
Thanks for answer.
I use the UserAuthenticationEvent to hook and check that the user signs in again on another machine/browser B. I tried to mark the userActivitiy as EXIT, but this not forces the user to relogin on machine A. Think I have to invalidate the UserSession, but how to get ?
userActivity = new UserActivity(userActivity.getId(), userActivity.getSessionId(), System.currentTimeMillis(), UserActivity.EXIT); getStatsService().registerActivity(userActivity);