I use Spring Security 3 in my jsf2 web app.
When a non-authenticated user tries to access a protected resource, Spring Security redirects to the login page.
In this case, how can I show a message to the user in the login page saying he/she is not allowed to access the resource?
As Spring Security throws an AccessDeniedException in the ExceptionTranslationFilter, and then redirects to the login page, I’ve tried to use a preRenderView listener in the login page, which checks for “WebAttributes.ACCESS_DENIED_403”, but it is null.
Now I get you, actually if the user is not yet authenticated then an AuthenticationException is thrown and ExceptionTranslationFilter will launch the authenticationEntryPoint. So just add error request parameter like this.