Return-Path: Delivered-To: apmail-incubator-jsecurity-dev-archive@locus.apache.org Received: (qmail 40246 invoked from network); 17 Oct 2008 15:03:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Oct 2008 15:03:23 -0000 Received: (qmail 95411 invoked by uid 500); 17 Oct 2008 15:03:25 -0000 Delivered-To: apmail-incubator-jsecurity-dev-archive@incubator.apache.org Received: (qmail 95397 invoked by uid 500); 17 Oct 2008 15:03:25 -0000 Mailing-List: contact jsecurity-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jsecurity-dev@incubator.apache.org Delivered-To: mailing list jsecurity-dev@incubator.apache.org Received: (qmail 95386 invoked by uid 99); 17 Oct 2008 15:03:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2008 08:03:25 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tskowronek@wi.rr.com designates 71.74.56.125 as permitted sender) Received: from [71.74.56.125] (HELO hrndva-omtalb.mail.rr.com) (71.74.56.125) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2008 15:02:15 +0000 Received: from JAVAONE ([69.76.39.119]) by hrndva-omta02.mail.rr.com with ESMTP id <20081017150150.SOQB29585.hrndva-omta02.mail.rr.com@JAVAONE>; Fri, 17 Oct 2008 15:01:50 +0000 From: "Thomas Skowronek" To: Cc: Subject: RE: [grails-user] JSecurity Plugin, AbstractLdapRealm and Caching Date: Fri, 17 Oct 2008 09:59:17 -0500 Message-ID: <56C068CD9A2D478C9BFC6C102FD0F68F@JAVAONE> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: AckwGpEx+Co1Udf0TyW/5nZJ/HG/VgAThOJg In-Reply-To: <8bd9fdba0810162237k496d73a5h31254ce8c48ccb72@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org 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, Thomas -----Original Message----- From: Peter Ledbrook [mailto:peter@g2one.com] Sent: Friday, October 17, 2008 12:38 AM To: user@grails.codehaus.org Cc: jsecurity-dev@incubator.apache.org Subject: Re: [grails-user] JSecurity Plugin, AbstractLdapRealm and Caching > 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 instantiated: 100 // Finally add the remaining beans to the security manager. 101 log.info "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) }". Cheers, Peter -- Software Engineer G2One, Inc. http://www.g2one.com/ --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email