incubator-shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Ledbrook" <>
Subject Re: [grails-user] JSecurity Plugin, AbstractLdapRealm and Caching
Date Fri, 17 Oct 2008 05:37:51 GMT
> DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
> securityManager.init(); // <-- the securityManager has a default
> EhCacheCacheManager if ehcache is in the classpath, but your Realm
> doesn't have it yet
> securityManager.setRealm( myRealm );
> //now 'myRealm' will have the cacheManager instance and its
> AuthorizationInfo cache will be created.

Ah, I think I can see what the problem is. The normal realms
configured by the plugin are added in the bean definition, so they
will be initialised during "securityManager.init()". However, I add
native JSecurity realms once the security manager has been

100 	        // Finally add the remaining beans to the security manager.
101 "Registering native realms: $beans"
102 	        def mgr = applicationContext.getBean('jsecSecurityManager')
103 	        mgr.realms.addAll(beans.collect { applicationContext.getBean(it) })

Since I'm adding the beans to the existing realms collection, the
cache manager stuff is not triggered for those realms. This is already
a hack, since plugins can't see bean definitions from
"resources.groovy" or "resources.xml". I could just call "mgr.realms
+= beans.collect { applicationContext.getBean(it) }".



Software Engineer
G2One, Inc.

View raw message