shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Skowronek" <>
Subject RE: [grails-user] JSecurity Plugin, AbstractLdapRealm and Caching
Date Fri, 17 Oct 2008 14:59:17 GMT
Les and Peter,

Making the following change fixed the problem.  Subsequent requests are now
accessing the cache.

"mgr.realms += beans.collect { applicationContext.getBean(it) }"

Thanks for all your help on this issue.  I really appreciate it.

Best regards,


-----Original Message-----
From: Peter Ledbrook [] 
Sent: Friday, October 17, 2008 12:38 AM
Subject: Re: [grails-user] JSecurity Plugin, AbstractLdapRealm and Caching

> DefaultWebSecurityManager securityManager = new
> 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.

To unsubscribe from this list, please visit:

View raw message