I have a Spring 3 application with Spring Security. I need to do some proccessing in almost all the urls of my application. The proccesing is different depending on the user which is logged-in. I had though of doing it by using a Spring filter but I cannot access
SecurityContextHolder.getContext().getAuthentication().getPrincipal()
in the filter because SecurityContextHolder is still null.
What is the best way to do this?
thanks.
To access the security context, your filter should be behind the Spring Security filter, i.e. its
<filter-mapping>should be placed after the Spring Security’s one.