You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "outsider404 Gazeta.pl" <ou...@gazeta.pl> on 2013/05/17 23:06:52 UTC

Why UserDatabaseRealm may use only resource from global JNDI but DataSourceRealm may use both global and local JNDI?

[Tomcat 7.0.x]
I wonder why UserDatabaseRealm use always global JNDI:

==========
Context context = getServer().
getGlobalNamingContext();
database = (UserDatabase) context.lookup(resourceName);
=========

but DataSourceRealm is more flexible:

==========
if (localDataSource) {
  context = ContextBindings.getClassLoader();
  context = (Context) context.lookup("comp/env");
} else {
  context = getServer().getGlobalNamingContext();
}
===========

Is it intentionally, for example for some security reason or it is open
improvement option for UserDatabaseRealm?

Re: Why UserDatabaseRealm may use only resource from global JNDI but DataSourceRealm may use both global and local JNDI?

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/5/18 outsider404 Gazeta.pl <ou...@gazeta.pl>:
> [Tomcat 7.0.x]
> I wonder why UserDatabaseRealm use always global JNDI:
>
> ==========
> Context context = getServer().
> getGlobalNamingContext();
> database = (UserDatabase) context.lookup(resourceName);
> =========
>
> but DataSourceRealm is more flexible:
>
> ==========
> if (localDataSource) {
>   context = ContextBindings.getClassLoader();
>   context = (Context) context.lookup("comp/env");
> } else {
>   context = getServer().getGlobalNamingContext();
> }
> ===========
>
> Is it intentionally, for example for some security reason or it is open
> improvement option for UserDatabaseRealm?

I think it is just that nobody needed it. (From a quick look, I do not
see anything that prevents such a feature).

Feel free to prepare & test a patch.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org