"Christopher Schultz" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > All, > > Securityfilter includes a feature that allows users to wrap Tomcat Realm > classes (Such as DataSourceRealm, JAASRealm, etc.) so they don't have to > implement their own. The adapter that provides the plumbing between the > sf code and the tc code is short and sweet, but it has been flawed for > some time due to tc's RealmBase requirement that setContainer() be > called before the Realm is brought into service. > > Since we are instantiating these objects outside of Tomcat (that is, > where we don't have any references to Tomcat internal objects), I'm > wondering about a few things. > > First, does anyone know if the Container used by the Realm actually > needs to be the currently-running Tomcat Container object? Can we just > create a dummy one and let it go? >
Unless you pre-registester the Realm with JMX, the dummy needs to extend ContainerBase. But otherwise, it just needs to implement getLogger() and getContainerSuffix() (not needed if you JMX register yourself) to have a dummy container. Note: I haven't tried this myself, just looked for references to the Container in the Tomcat 6 code. As such, there is no promise that this is 100% accurate ;). > Regardless of whether a dummy Container is useful, is there a way to get > a reference to the currently-running Tomcat Container object? We may be > able to get to objects such as the ServletContext in order to complete > setup of these objects in memory before they are actually used. > You can get this from the "managedResource" attribute on the MBean corresponding to the Container via JMX. Tomcat stand-alone has standard naming conventions for the ObjectName, so this should be too hard to work out (but J2EE Containers may have their own naming conventions for Tomcat MBeans). Depending on the Tomcat version and/or configuration, the Container class may not be visible to your ClassLoader. So there is no guarantee that you could call setContainer for a Realm that was created by your webapp. You will also likely have problems if you are running Tomcat with a SecurityManager. > Any help would be very much appreciated. > > Thanks, > - -chris > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.9 (MingW32) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > iEYEARECAAYFAkiRxr8ACgkQ9CaO5/Lv0PBehwCgliZu934iFl7UgtNub9JbSnIF > l0sAn1RSV0ZmT5uG46A2be24qhG66HJO > =LBPD > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]