shiro-user mailing list archives

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

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
onLogout.

My realm class is the following:

public class MyRealm extends AuthenticatingRealm{

    @Override
    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.
    }

    @Override
    public void onLogout(PrincipalCollection principals) {
        try {
            log.debug("User {} logged out.",
principals.getPrimaryPrincipal());
        } catch (Throwable e) {
            log.warn("", e);
        } finally {
            super.onLogout(principals);
        }
    }
    
    private static final Logger log =
LoggerFactory.getLogger(GamesRealm.class);
}

and my shiro.ini config file is:

[main]

# Domain Realm
MyRealm = es.calypso.games.dc.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 = es.calypso.games.dc.EhCacheManagerFactory
ssoCacheManager.cacheManager = $ssoCacheManagerFactory 
#ssoCacheManager.cacheManagerConfigFile = classpath:ehcache.xml
securityManager.cacheManager = $ssoCacheManager 

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

[urls]

/* = user[user]

What am i doing wrong?

Thanks.






--
View this message in context: http://shiro-user.582556.n2.nabble.com/onLogout-implementation-in-AuthenticatingRealm-subclass-doesn-t-get-called-tp7577801.html
Sent from the Shiro User mailing list archive at Nabble.com.

Mime
View raw message