When an unauthenticated user request some resources, he will be redirected to a login page but j_security_check
will keep the original requested resource. If the user login successfully, it will be redirected to that resource.
The problem is that sometimes the requested resource is dynamic, so it might not exists. I have a lot of places in my application with this behavior, so instead of validate this in each "resource handler" (controller), we are trying to centralize all this logic in a filter that intercept the j_security_check
forward to the login page.
Now, how can we get the original requested resource kept by the Form-Based Authentication mechanism? It's vendor dependent?
Another alternative:
If I can run a filter BEFORE the j_security_check
I can't modify the URL but I can send a redirect to the user with a "valid URL". But how can I execute a filter before the j_security_check
?