users@glassfish.java.net

Re: Switching realms easily?

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Thu, 22 Mar 2012 13:15:17 -0400

On Thu, Mar 22, 2012 at 1:07 PM, Shing Wai Chan
<shing.wai.chan_at_oracle.com>wrote:

> In this moment, beside direct editing, one cannot change realm name within
> a war.
>

OK, thanks.


> But one can change what the realm name refers to in admin as you have
> mentioned.
> With this, one can even change the authentication mechanism after
> deployment as follows:
> 1. the war refers to realm "myrealm"
> 2. create a "myrealm" in admin
> 3. deploy the app
> 4. change the definition of "myrealm"
>

Yep; I'm in a position where I want to have two realms installed: an LDAP
one, and a JDBC one. I would like for them to have different names. Our
application obviously will only directly refer to one of them.

I do my setup/editing using asadmin.

The only commands I could find were create-auth-realm, which is accurate
but tedious, and delete-auth-realm. I didn't see something like
rename-auth-realm. (There's list-auth-realms as well, which does what
you'd expect. :-))

I know I can script these up to rename one of the realms by deleting it and
recreating it with a different name; it is just tedious and error prone
given the number of properties that must be supplied. I was hoping there
would be an easier way other than writing my own shell scripts for this,
that's all.

Thanks for your help!

Best,
Laird

-- 
http://about.me/lairdnelson