You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Datta <ma...@yahoo.com> on 2011/04/01 18:00:05 UTC
Re: Help with configuring mulitple ActiveDirectory in web app
Hello Liz: Thanks for the response,
I initially tried instantiating creating securityManager as below
DefaultWebSecurityManager securityManager = new
DefaultWebSecurityManager();
securityManager.setRealms(getAllADRealms());
securityManager.setSessionManager(new DefaultWebSessionManager());
//securityManager.setSessionMode(DefaultWebSecurityManager.HTTP_SESSION_MODE);
securityManager.setSessionMode(DefaultWebSecurityManager.NATIVE_SESSION_MODE);
securityManager.setSubjectFactory(new DefaultWebSubjectFactory());
securityManager.setRememberMeManager(new CookieRememberMeManager());
But looks like there more to it
So changed my code to use PassThruAuthenticationFilter via configuration in
shiro.ini
Now login works perfectly:
Question regarding Logout:When the user session expires I am logging out
user as follows
or when the user clicks Logout, I invalidate session and this method gets
called.
for e.g.
public void sessionDestroyed(HttpSessionEvent se) {
logger.debug("sessionDestroyed: due to Logout or session Expired");
Subject userinsession = (Subject)
se.getSession().getAttribute("user");
try {
if (SecurityUtils.getSecurityManager() != null) {
Subject user = SecurityUtils.getSubject();
if (user != null) { // This is never null
logger.debug("sessionDestroyed: logging out user via
Security Utils");
user.logout();
}
}
} catch (UnavailableSecurityManagerException e) {
logger.error("Security Manager not Available:", e);
e.printStackTrace();
}
}
I see the exception below
Security Manager not Available:
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager
accessible to the calling code, either bound to the
org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an
invalid application configuration.
at
org.apache.shiro.SecurityUtils.getSecurityManager(SecurityUtils.java:123)
Not sure what is wrong and why am i getting this exception
--
View this message in context: http://shiro-user.582556.n2.nabble.com/Help-with-configuring-mulitple-ActiveDirectory-in-web-app-tp6035984p6231615.html
Sent from the Shiro User mailing list archive at Nabble.com.