users@glassfish.java.net

Switching realms easily?

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Thu, 22 Mar 2012 10:42:51 -0400

Currently we have a .war file that contains a web.xml that has a
<login-config> element in it with a <realm-name> of, let's say, fred.

Depending on where we deploy this .war file, we actually may want it to use
a JDBC realm, an LDAP realm, etc. etc.

I understand that web.xml's <realm-name> element must match the name of a
realm in Glassfish for that realm to be used.

What bothers me is: I wish I could (as Glassfish administrator of course)
tell the deployed application to use a different realm. I don't want to
undeploy the app, crack open the .war, edit web.xml, redeploy the app and
relaunch. Nor do I really want to rename the realms in the Glassfish
server instead.

I feel like I'm missing something. Is there a level of indirection
somewhere that would allow me to dynamically bind a web application (or an
ear file) to a realm without having to change realm names in either the
application or Glassfish?

Thanks,
Laird

-- 
http://about.me/lairdnelson