Announcement Announcement Module
Collapse
No announcement yet.
SecurityContext working alternately Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SecurityContext working alternately

    Hi,

    I am using Spring Security based authentication for our application. Once the user logs in, the authorization checks work flawlessly, but there is an option to switch between the themes, some which have admin access and others non-admin. When user switches for the first time, the authorization works fine but the next switch (if its authorized as admin) doesn't work and throws an "exception : org.springframework.security.access. AccessDeniedException: Access is denied"

    For the next switch(admin or non-admin) works fine again, its working subsequently. I am using the following code while switching:

    SecurityContextHolder.clearContext();
    SecurityContextImpl securityContext = new SecurityContextImpl();
    securityContext.setAuthentication(result); //result - authentication object
    SecurityContextHolder.setContext(securityContext);

    I am using Java 1.5.19, Tomcat 6.0.20, Spring Security 3.0.0 and Spring 3.0.3.

    Any suggestions?


    Thanks in advance,
    Mahesh
Working...
X