7

I'm doing an audit system that logs user actions. I need to record when a user performs a login. I searched different places but I always end up running into the same solution, use "filters".

The above solutions do not work for me. There are no other solutions that use filters or make a custom login?

I'm using Java 7 with GlassFish 3

Tiny
  • 27,221
  • 105
  • 339
  • 599
Crapo Wolf
  • 2,241
  • 2
  • 11
  • 20
  • 2
    Instead of using a form based authentication with `j_security_check`, you can also use programmatic authentication (and authorization, if needed, of course) using `HttpServletRequest#login(String username, String password)` in Servlet 3.x. See [this answer](http://stackoverflow.com/a/2207147/1391249), especially, the updated section. (Servlet 3.x will be available, if the target container supports at lest Java EE 6 which GlasshFish 3 does). – Tiny Dec 08 '15 at 23:14
  • Type it in response to the post so I can pay you the bounty – Crapo Wolf Dec 09 '15 at 18:56
  • 2
    Thanks but if the linked answer fulfills your needs, then the answer is essentially already given in that post and I do not deserve the bounty. – Tiny Dec 09 '15 at 19:14
  • 1
    Re-implementing form-based authentication by means of a standard `javax.security.auth.message.module.ServerAuthModule` is another alternative, which too would enable you to audit login / logout events (except for implicit logout due to session expiration). [Here](http://stackoverflow.com/questions/33280403/hook-on-process-where-container-asks-for-roles-of-ldap-user/33357026#33357026) is a Java **EE 7**-targeted example, which however would require some modifications in order to be usable with a Java EE 6 implementation. – Uux Dec 19 '15 at 13:45

0 Answers0