Question

I am using form-based authentication and j_security_check in my j2ee application which runs on glassfish 3.1. Problem is when login succeed I have to update some data related to authenticated user. How to make post-login operation after j_security_check ends it's execution? Thanks.

Was it helpful?

Solution

A workaround with Servlet 3.0 (or Java EE 6): Call HttpServletRequest.login() from a managed bean and if it doesn't throw an exception do your post login operations.

OTHER TIPS

  1. Create a filter which is mapped to j_security_check

  2. You need to overwrite the Origin header of the response before chain.doFilter(request, response); of that filter and also to place your post redirect URL in the cookie WASReqURL (Or the cookie of glassfish that holds the next url)

  3. The link you chose in step 2 need to be mapped to a servlet which executes the post-j_security_check stuff and afterward, to redirect back to the overwritten link from step 2.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top