Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating SecurityContext

 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a small question regarding the SecurityContext update.

I noticed that when I use the following lines the SecurityContext is not really (or never ???) updated :


However, if i use the following lines, the SecurityContext is systematically updated :


So, the line SecurityContextHolder.getContext().setAuthentication(auth); does correctly update the security context.

But aren't these two ways of doing the same thing ?
Why does the first method does not work ?

Thanks for enlightening me.
 
Rishi Shehrawat
Ranch Hand
Posts: 218
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The SecurityContextHolder is able to reterieve the context from threadlocal, which is where it is kept/stored by Spring.

http://static.springsource.org/spring-security/site/docs/3.0.x/apidocs/org/springframework/security/core/context/SecurityContextHolder.html
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic