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.

有帮助吗?

解决方案

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.

其他提示

  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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top