Openfire currently offers three types of events:
GroupEvents (unrelated to this discussion)
SessionEvents:
-
A session was created.
-
A session was destroyed
-
An anonymous session was created.
-
An anonymous session was created.
UserEvents:
-
A user was created.
-
A user is being deleted.
-
A user’'s name, email, or an extended property was changed.
There’‘s a significant difference in the creation of a new session and a logon (which I define as a successful authentication attempt). I’'d like to be able to catch ‘‘authentication events’’ as well, as having a trigger that fires after a user successfully logged in can be useful.
I can see at least two possible solutions: We can create a new EventListener and -Dispatcher class that handles these events, or we can add methods to one of the existing structures.
The first option would create a new class that’'s a bit weird, because the ‘‘mirrored’’ functionality of authenticate/logon would be the essentially the same as ‘‘session destroyed’’. The second option would force all existing implementations of the interface to update, as the new interface-defined methods need to be implemented.
The first option, creating a new ‘‘AuthenticateEventListener’’, only introduces one slightly weird situation (in logoff/session-destroy situations where a class implements both the SessionEventListener and the new interface). I would prefer this over the other solution - several small interfaces as opposed to a few bigger ones should gives you more flexibility.
Opinions and/or suggestions anyone?