shiro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdaemon <>
Subject onLogout implementation in AuthenticatingRealm subclass doesn't get called
Date Mon, 17 Sep 2012 08:48:32 GMT

Perhaps this is a really silly question and probably a mistake from my side
but i can't find anything which lets me solve it. I'm just starting with
Shiro and i'm trying to get a custom logout functionality on a
AuthenticathingRealm subclass be called when i explicitely do a
subject.logout(). If i have understood the shiro workflow correctly, once
configured a realm in the shiro.ini file, the default behaviour is to call
doGetAuthenticationInfo when a user logs in and to call onLogout when the
user logs out or you programmatically call subject.logout(). The login part
works correctly, and my implementation of MyRealm.doGetAuthenticationInfo()
gets called, but when i do a subject.logout(), i cant see the call to

My realm class is the following:

public class MyRealm extends AuthenticatingRealm{

    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken
token) throws AuthenticationException {
        return new UserAuthInfo(token); //just for testing the realm, this
lets any user to log in the realm.

    public void onLogout(PrincipalCollection principals) {
        try {
            log.debug("User {} logged out.",
        } catch (Throwable e) {
            log.warn("", e);
        } finally {
    private static final Logger log =

and my shiro.ini config file is:


# Domain Realm
MyRealm =
MyRealm.authenticationCachingEnabled = true
securityManager.realm = $MyRealm

# Session Manager Config
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
securityManager.sessionManager = $sessionManager
securityManager.sessionManager.sessionDAO = $sessionDAO 

# Cache Manager config
ssoCacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
ssoCacheManagerFactory =
ssoCacheManager.cacheManager = $ssoCacheManagerFactory 
#ssoCacheManager.cacheManagerConfigFile = classpath:ehcache.xml
securityManager.cacheManager = $ssoCacheManager 

# SSO cookie
cookie = org.apache.shiro.web.servlet.SimpleCookie = SSOcookie
cookie.path = /
securityManager.sessionManager.sessionIdCookie = $cookie


/* = user[user]

What am i doing wrong?


View this message in context:
Sent from the Shiro User mailing list archive at

View raw message