In My MVC application, even after login when I am trying to get the principal object using,
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
the authentication is returned as null.
In Spring-security context,
<intercept-url pattern="/test/user/login" access="IS_AUTHENTICATED_ANONYMOUSLY" />
Servlet mapping in Web.xml:
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
I am new to MVC implementation. Please help me in fixing this.