Hello all,
Currently, Struts has the capability to manage javax.sql.DataSources for
accessing JDBC connections... I was pondering whether it might also be
useful to have it manage InitialContext's...
Consider the following fragment of XML that might be taken from a
struts-config.xml...
<naming-contexts>
<naming-context key="myEJBConnection"
initialContextFactory="your.factory.class.here"
providerUrl="jndi:/some/url/here"
securityPrincipal="username"
securityCredentials="password"
(+ other attributes to support the standard JNDI properties as
defined by javax.naming.Context)>
<property name="some.custom.property.name">value</property>
<property name="some.custom.property.name">value</property>
</naming-context>
<naming-context key="myLDAPConnection"
...
</naming-context>
</naming-contexts>
Similar to findDataSource(String), ActionServlet would have a
javax.naming.Context findNamingContext(String) method.
The issues are primarily these:
1. findNamingContext() would probably (???) need to return Contexts on a
per user session basis.
2. Whilst forcing all Contexts returned to use the same principal and
credentials (as in the above example) is fine for some circumstances
(looking up records on an LDAP server) it is definately not for others
(such as connecting to an EJB container) where you want to propagate the
identity of the user in some fashion. I guess if you chose to omit the
securityPrincipal and securityCredentials from the specific naming-context,
then depending on which container you are using (as an example, Weblogic
which is both a servlet and EJB container) it will probably figure out
which user it is and whether they are sufficiently authenticated. If
however the servlet and EJB containers are separate products (for example,
Tomcat and JBoss), and possibly running different JVMs (for whatever
reason), then this is all complicated some what. Is there still some way
though, of solving this generically within Struts in a reasonably
satisfactory manner? Possibly JAAS comes into play here, but I believe the
way in which JAAS integrates with the Servlet model is still a bit unclear.
Thoughts?
Regards,
James W.
--------------------------------------------------------------------------
This e-mail is from Cards Etc Pty Ltd (ACN: 069 533 302). It may contain
privileged and confidential information. It is intended for the named
recipient(s) only. If you are not an intended recipient, please notify us
immediately by reply e-mail or by phone on +61 2 9212 7773 & delete this
e-mail from your system.
--------------------------------------------------------------------------