SecurityContextHolder « Security « Spring Q&A





1. Is SecurityContextHolder thread safe?    stackoverflow.com

I use SecurityContextHolder and a custom UserDetailsService to obtain UserDetails from SecurityContextHolder:

Object o = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserDetailsDTO user = (UserDetailsDTO) o;
I left out the null checks, etc., but that's the idea. I'm ...

2. How to set up Spring Security SecurityContextHolder strategy?    stackoverflow.com

I'm using asynchronous methods in my service (Spring 3 @Async annotation). And I've got a problem - spawned thread doesn't have security context. Cause of it is Spring Security by default ...

3. Spring security's SecurityContextHolder: session or request bound?    stackoverflow.com

Is the Userprincipal I retrieve from SecurityContextHolder bound to requests or to sessions? UserPrincipal principal = (UserPrincipal) SecurityContextHolder.getContext().getAuthentication().getPrincipal(); This is the way I access the currently logged in user. Will this invalidate if ...

4. SecurityContextHolder.getContext() NPE when using @Async    stackoverflow.com

I'm trying to convert a sequential series of calls of spring service to be asynchronous. I have annotated the method with @Async and added taskExecutor configuratinos. I can see that the method is ...

5. how to add Authentication manually to SecurityContextHolder after registration?    forum.springsource.org

how to add Authentication manually to SecurityContextHolder after registration? hi to all. i have a simple web application that i used than spring security wihtin it after some time. before using ...

6. PayloadValidatingInterceptor error not clearing SecurityContextHolder    forum.springsource.org

Hi All, I am using PayloadValidatingInterceptor for validating request and response. When the response validation fails its returning the response message. But its not clearing SecurityConetxHolder. When I call SecurityContextHolder.getContext().getAuthenticati on().getPrincipal() ...

7. SecurityContextHolder.getContext().getAuthenticati on() is Null Always!    forum.springsource.org

SecurityContextHolder.getContext().getAuthenticati on() is Null Always! Hello, Im using Spring security 3.0.3. and im able to login with credentials.After I login Im trying to access Authentication from controller class as GzSecuritySessionUserObject secUser ...

8. customize authentication and SecurityContextHolder working    forum.springsource.org

customize authentication and SecurityContextHolder working Hi Guys, I am using spring 3.0 for a while and i am using spring security 3.0.5 I want to know how SecurityContextHolder works exactly. I ...

9. SecurityContextHolder.getContext().getAuthenticati on() null on error-page    forum.springsource.org

Hi, I'm running Spring 3.0.5 on a Tomcat 6 (Windows Machine). I've found a problem/misconfiguration on Spring/Tomcat Error-Handling. When an Exception occurs in a Spring MVC Controller, Tomcat handles the exception ...





10. SecurityContextHolder is Null Pointer Exception    forum.springsource.org

SecurityContextHolder is Null Pointer Exception Hello everybody! I want to use SecurityContextHolder object below. User user = (User)SecurityContextHolder.getContext().getAuthen tication().getPrincipal(); But get null pointer exception. My web.xml Code: springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy ...

11. SecurityContextHolder, not in acegi 0.8.3 jar?    forum.springsource.org

SecurityContextHolder, not in acegi 0.8.3 jar? Apologies if this is a dumb or FA'd Q... I am having trouble rebuilding the "contacts" sample web application. I can deploy the contacts war ...

12. SecurityContextHolder not using InheritableThreadLocal in 0.9.0?    forum.springsource.org

Hello, As advertised at http://acegisecurity.sourceforge.net...e-080-090.html, the new SecurityContextHolder uses an InheritableThreadLocal. Earlier CVS snapshots did use the InheritableThreadLocal, but the 0.9.0 codebase appears to have reverted to just ThreadLocal (the revision ...

13. Possible Memory Leak due to SecurityContextHolder thread local    forum.springsource.org

Possible Memory Leak due to SecurityContextHolder thread local Searching for memory leaks in my webapp, i found the thread local in the security context holder (Acegi 1.0 RC1 - context holder ...

14. SecurityContextHolder/SwitchUserProcessingFilter usage    forum.springsource.org

SecurityContextHolder/SwitchUserProcessingFilter usage I am developing an application where admins sometimes need to login as other users and found the SwitchUserProcessingFilter to be very useful for that. I see in the documentation ...

15. SecurityContextHolder.hasContext()    forum.springsource.org

SecurityContextHolder.hasContext() Hi all, I'm facing a situation in my web application where I need to know if the user is logged in or not and I was hoping to get that ...

16. SecurityContextHolder.getContext() is null    forum.springsource.org

hello, * i've a SimpleUrlHandlerMapping that handles all my request * a HandlerInterceptorAdapter is charged to add SecurityContextHolder.getContext().getAuthenticati on().getPrincipal() to all models * when a url is not accessible (access denied) ...





17. SecurityContextHolder.getContext().getAuthenticati on().getPrincipal() returns null    forum.springsource.org

SecurityContextHolder.getContext().getAuthenticati on().getPrincipal() returns null I've written a simple Filter that checks if a user is logged in and if so, logs the username and page visited. The username is obtained by ...

18. SecurityContextHolder.getContext().getAuthenticati on() returns null    forum.springsource.org

Dec 2nd, 2006, 10:33 AM #1 visionset View Profile View Forum Posts Private Message Member Join Date Dec 2006 Location Nottingham, UK Posts 39 SecurityContextHolder.getContext().getAuthenticati on() returns null I have a ...

19. Populating the SecurityContextHolder with Request Information before Authenticating    forum.springsource.org

Populating the SecurityContextHolder with Request Information before Authenticating Hello, I have a problem that I had some questions about. I am trying to access the ServletRequest and populate the SecurityContextHolder with ...

20. Unit testing Controller that gets Authentication from SecurityContextHolder    forum.springsource.org

I think I have got it.. Code: GrantedAuthority[] grantedAuthorities = new GrantedAuthority[]{new GrantedAuthorityImpl("ROLE_CUSTOMER")}; UserDetails userDetails = new User("username", "123456", true, false, false, false, grantedAuthorities); Authentication authentication = new TestingAuthenticationToken(userDetails, null, grantedAuthorities); ...

21. Is it possible to access SecurityContextHolder from a listener?    forum.springsource.org

Is it possible to access SecurityContextHolder from a listener? I'm implementing a listener to listen for authentication events and based on the particular event to manipulate the user account in the ...

22. HttpInvoker Basic Authentication and SecurityContextHolder    forum.springsource.org

HttpInvoker Basic Authentication and SecurityContextHolder Hi, I use HttpInvoker for the remoting of my application. Authentication is done with the AuthenticationSimpleHttpInvokerRequestExecutor. The Dispatcher Servlet is secured whit Tomcat Security: ...

23. How to get Authentication from SecurityContextHolder based on session?    forum.springsource.org

How to get Authentication from SecurityContextHolder based on session? Hi, Group, I am developing a web application using acegisecurity on tomcat server. Each user has to login through acegisecurity when use ...

24. SecurityContextHolder.getContext() is NULL    forum.springsource.org

May 21st, 2007, 09:33 AM #1 cornflakeGirl View Profile View Forum Posts Private Message Junior Member Join Date Oct 2006 Location Miami, FL Posts 15 SecurityContextHolder.getContext() is NULL Hi Guys, Hope ...

25. sessionDestroyed() and SecurityContextHolder    forum.springsource.org

sessionDestroyed() and SecurityContextHolder Hi all, I have a class that implements HttpSessionListener, and when sessionDestroyed() is invoked on session timeout the SecurityContextHolder is already invalidated. There must be some type of ...

26. Problem with SecurityContextHolder    forum.springsource.org

Problem with SecurityContextHolder Hi, Ours is an enterprise application and we are using Acegi 1.0.3. We are facing a problem in fetching authenticated data from SecurityContextHolder. When multiple users try to ...

27. First login, null Authentication object in SecurityContextHolder.getContext()    forum.springsource.org

Sep 25th, 2007, 05:12 PM #1 rodrigo.baquero View Profile View Forum Posts Private Message Junior Member Join Date Sep 2007 Posts 3 First login, null Authentication object in SecurityContextHolder.getContext() I'm facing ...

28. Another SecurityContextHolder.getContext().getAuthenticati on()==null problem    forum.springsource.org

Nov 21st, 2007, 12:59 PM #1 igorg View Profile View Forum Posts Private Message Junior Member Join Date Nov 2007 Posts 17 Another SecurityContextHolder.getContext().getAuthenticati on()==null problem I've found several thread written ...

29. SecurityContextHolder has no Authentication    forum.springsource.org

SecurityContextHolder has no Authentication We are using acegi + CAS. We can authenticate but when we try to get the Authentication object from SecurityContextHolder, the object is null. We try getting ...

30. SecurityContextHolder loses Authentication    forum.springsource.org

SecurityContextHolder loses Authentication Hello, I login into my application, I can see in DEBUG output that authentication works and the Holder is populated. But sometimes the authentication is lost and the ...

31. 'SecurityContextHolder now cleared' after succesful authentication    forum.springsource.org

'SecurityContextHolder now cleared' after succesful authentication I have a strange issue in my configuration. When I logon to my application, the user is authenticated, the granted authorities are filled, but once ...

32. Updating Authentication in SecurityContextHolder results closing of WebApplicationCon    forum.springsource.org

Updating Authentication in SecurityContextHolder results closing of WebApplicationCon Hi, I am new to acegi and using Acegi with struts not with Spring. I am facing a problem when i am creating ...

33. SecurityContextHolder    forum.springsource.org

SecurityContextHolder Hello everyone, i am playing around with Spring and Security at the moment and i ran into a problem i hope someone can help me out with. I set up ...

34. SecurityContextHolder and thread safety question...    forum.springsource.org

SecurityContextHolder and thread safety question... Howdy - Got Spring Security 2.0.3 configured for our app - it's been great - thanks all! I have the following UserSecurityHelper class in my web ...

35. SecurityContextHolder always null for Struts 2 Action and Interceptor    forum.springsource.org

SecurityContextHolder always null for Struts 2 Action and Interceptor Dear All, I Need someone to help me to give me some clue and advice, it's little confusing for me when using ...

36. SecurityContextHolder.getContext() null problem    forum.springsource.org

SecurityContextHolder.getContext() null problem I use Spring Security 2.04 + JCaptcha + struts2 I want to get current username by using SecurityContextHolder.getContext().getAuthenticati on(); but I find SecurityContextHolder.getContext() allways return null when i ...

37. SecurityContextHolder randomly returns me different Authentication objects    forum.springsource.org

if i login as one person logout and login as another person. every request, SecurityContextHolder.getContext().getAuthenticati on() returns at randomly one of the two users. whats the deal with that?

38. SecurityContextHolder.getContext() returns NULL (Spring, JSF, ICEfaces)    forum.springsource.org

SecurityContextHolder.getContext() returns NULL (Spring, JSF, ICEfaces) Hi guys. We're putting together a webapp using JSF, Spring, Spring Security and ICEfaces. Integrating all of these hasn't been exactly smooth, but it seems ...

39. How to determine user role after login - SecurityContextHolder.getContext() is null    forum.springsource.org

We've got two types of users in our system, admins and regular users. After login we need to determine which roll the user is and redirect them to different pages depending ...

40. Setting the SecurityContextHolder Contents Directly    forum.springsource.org

Setting the SecurityContextHolder Contents Directly Hello, I have an application that is protected using CAS and the casAuthenticationProvider. However I have the need to authenticate users for a specific uri in ...

41. SecurityContextHolder returns null    forum.springsource.org

It depends how your application handels threads. In default-mode (MODE_THREADLOCAL) the SecurityContext will ony be visible in the thread you initialized the SecurityContext. (Similar to Java ThreadLocal) In mode MODE_INHERITABLETHREADLOCAL the ...

42. How can I call SecurityContextHolder.getContext().getAuthenticati on() from facelet?    forum.springsource.org

How can I call SecurityContextHolder.getContext().getAuthenticati on() from facelet? Hello all, I apologize as this is probably a novice question, but I want to display "Hello ${currentUser}" on each page. What's the ...

43. NullPointerException on SecurityContextHolder.getContext().getAuthenticati on    forum.springsource.org

NullPointerException on SecurityContextHolder.getContext().getAuthenticati on hi all, I have a search page after login and my login page use asprign + acegi my search page can link to delete and update page ...

44. SecurityContextHolder.getContext().getAuthenticati on() returns null    forum.springsource.org

Sep 19th, 2009, 05:06 AM #3 rohan123 View Profile View Forum Posts Private Message Senior Member Join Date Dec 2008 Location India Posts 258 Originally Posted by Luke Taylor Where are ...

45. SecurityContextHolder propagation problem with thread pools    forum.springsource.org

SecurityContextHolder propagation problem with thread pools I am having a problem with the propagation of the SecurityContext into thread pools provided by the java.util.concurrency.Executors framework. I am using Java 1.6 and ...

46. SecurityContextHolder getting the current Principal properly    forum.springsource.org

Exposing the current Principal to the view with SecurityContextHolder In order to get the current UserDetails of the authenticated user, I have a method in my UserDetailsService implementation that returns a ...

47. Update 2.x to 3.0.2 SecurityContextHolder issue    forum.springsource.org

Feb 25th, 2010, 06:20 PM #1 denebj View Profile View Forum Posts Private Message Junior Member Join Date Feb 2010 Posts 10 [RESOLVED]Update 2.x to 3.0.2 SecurityContextHolder issue Hello guys I ...

48. SecurityContextHolder.getContext().getAuthenticati on() returns null    forum.springsource.org

SecurityContextHolder.getContext().getAuthenticati on() returns null Hi, I am trying to use SecurityContextHolder.getContext().getAuthenticati on() to check if the authentication has been done. On the basis of this discussion, I want to display/not display ...

49. SecurityContextHolder.getContext().getAuthenticati on() returning mutiple User    forum.springsource.org

SecurityContextHolder.getContext().getAuthenticati on() returning mutiple User Hi everybody, I use a simple method for returning the current user. Code: public static UserDetails currentUserDetails() { SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); ...

50. SecurityContextHolder.getAuthentication().getAutho rities() returning only one ROLE    forum.springsource.org

Sep 21st, 2010, 10:41 AM #1 victuriosu View Profile View Forum Posts Private Message Junior Member Join Date Mar 2009 Posts 6 SecurityContextHolder.getAuthentication().getAutho rities() returning only one ROLE I have a ...

51. SecurityContextHolder vs session-scope    forum.springsource.org

SecurityContextHolder vs session-scope Good morning everybody, first of all apologies my english... In my last project i've written an application with spring-security but i've found a problem and i dont know ...

52. SecurityContextHolder.getContext().getAuthenticati on() is null in 404 error page    forum.springsource.org

Oct 25th, 2010, 10:10 PM #1 koolguyjeff@gmail.com View Profile View Forum Posts Private Message Junior Member Join Date Oct 2010 Posts 2 SecurityContextHolder.getContext().getAuthenticati on() is null in 404 error page I ...

53. SecurityContextHolder.getContext().getAuthenticati on() returns null    forum.springsource.org

SecurityContextHolder.getContext().getAuthenticati on() returns null Hi, I'm seeing this problem for my application where the user times out on Login page and upon checking the log files it seems we are running ...