securityglassfishrealmasadmin

How can i define a Loginmodule from Glassfish asadmin?


I'm currently implementing a Glassfish realm backed by a neo4j DB, for which I've defined a Realm and a LoginModule class.

I can install the realm using the create-auth-realm asadmin command. But the realm is recognized by Glassfish only if it is associated to a LoginModule defined in the config/login.conf file.

For instance, in my case, I have to do the following:

  1. Create the authentication realm:
    create-auth-realm --classname com.mycompany.security.MyRealm --property jaas-context=MyLoginModule myrealm
    and then

  2. Define MyLoginModule in that config/login.conf file :

    MyLoginModule { 
      fr.mycompany.security.MyLoginModule required; 
    };
    

I can edit the login.conf file by hand but would like to use an asadmin command to automate this step.
Would you know of such an asadmin command ?


Solution

  • It seems that, at the moment, the Glassfish CLI does not support this.

    Quote from here:

    glassfish has a pretty good CLI (which is actually one of the reasons, why I switched over from JBoss). However, there is no CLI cmd for modifying the login.conf of an instance (i.e. add/remove an entry in a reliable way).

    I'm wondering about why the realm is not added/removed automatically to/from the login.conf, when one creates/deletes a realm using the create-auth-realm/delete-auth-realm command ...

    I have requested for an update.