Aug 8th, 2006, 03:26 PM
Problem getting SecurityContext using SecurityContextHolder
I am experiencing the following problem: after a successful login with ACEGI (using LDAP provider), I cannot access the newly SecurityContext using SescurityContextHolder.getSecurityContext() - the method returns null, but it works just fine if I get it from HTTP Session, by searching for the attribute HttpSessionContextIntegrationFilter.ACEGI_SECURITY _CONTEXT_KEY.
Any idea? Am I missing a setting somewhere?
If you need more details, let me know
Aug 8th, 2006, 03:37 PM
This should be impossible. SecurityContextHolder.getContext() is guaranteed not to return null.
Aug 9th, 2006, 04:08 PM
Actually, I made a mistake. The context is indeed not null, but the method getAuthentication, called on the context retrieved by using SecurityContextHolder.getContext() is null.
This is not happening when I get it from the HTTP session.