PDA

View Full Version : SecurityContext is always null



chandra.shekher
02-26-2011, 04:34 AM
In Pentaho 3.6, Spring security 2.0.5 has been integrated. as per the Spring security documents, Spring Security Context always available in the application where it has been integrated.

Please look in this URL
http://static.springsource.org/spring-security/site/docs/2.0.x/reference/technical-overview.html

Although , I know this is as per new version of Spring Security but pattern is stills same.
Actually , I need Spring Security Context available but whenever i try to get it . it gives me null..

Object obj = SecurityContextHolder.getContext().getAuthentication().getPrincipal();

if (obj instanceof UserDetails) {
String username = ((UserDetails)obj).getUsername();
} else {
String username = obj.toString();
}
Any Suggestion Please.

I have used standard CAS SSO script that comes with 3.6 and i have done very basic tweaking for CAS proxy authentication.

/Chandra

mlowery
03-01-2011, 10:40 AM
Need more information. For example, where is the code above? In a filter?