1 Reply Latest reply on Nov 25, 2016 6:23 AM by ctomc

    Help with native management api

    cain

      I feel incredibly stupid about this, but I could really use some help with the native management API.  I'm trying to add a security realm, which I can do, but I can't set the authorization.  I've tried a number of things, and I can't get any of them to work.

       

      This is what I want to add to standalone.xml

                  <security-realm name="realm">

                      <authentication>

                          <jaas name="domain"/>

                      </authentication>

                  </security-realm>

       

      The following code will give me that without the <authentication> bit

       

      ModelControllerClient client = createClient();

       

      ModelNode op = new ModelNode();

      op.get("operation").set("add");

       

      ModelNode address = op.get("address");

      address.add("core-service", "management");

      address.add("security-realm", "realm");

           

      client.execute(op);

       

       

      But I need to add in the <authentication> section and can't for the life of me figure out how to do it.  I've tried this and a number of other things but they all fail.  The example below gives the following error:

       

      "JBAS014883: No resource definition is registered for address [\n    (\"core-service\" => \"management\"),\n    (\"security-realm\" => \"realm\"),\n    (\"jaas\" => \"domain\")\n]",

       

      ModelControllerClient client = createClient();

       

       

      ModelNode op = new ModelNode();

      op.get("operation").set("add");

       

      ModelNode address = op.get("address");

      address.add("core-service", "management");

      address.add("security-realm", "realm");

      address.add("authentication");

      address.add("jaas", "domain");

           

      client.execute(op);

       

       

      I'm having a hard time finding example online of how this works, so any help would be greatly appreciated.

        • 1. Re: Help with native management api
          ctomc

          something along this lines should work

          ModelNode op = new ModelNode();

          op.get("operation").set("add");

          ModelNode address = op.get("address");

          address.add("core-service", "management");

          address.add("security-realm", "realm");

          address.add("authentication", "jaas");

          op.get("name").set("domain");

          client.execute(op);

          or CLI command  /core-service=management/security-realm=ManagementRealm/authentication=jaas:add(name=domain)