• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Updating SecurityContext

 
Ranch Hand
Posts: 563
Google Web Toolkit Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 218
Hibernate Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic