Search code examples
jbosswildfly

How to add security domain with Wildfly/Jboss CLI


I want to add the following to the standalone-full.xml through Wildfly/Jboss CLI.

        <subsystem xmlns="urn:jboss:domain:security:2.0">
            <security-domains>
                <security-domain name="MY_NAME" cache-type="default">
                    <authentication>
                        <login-module code="XXX" flag="optional">
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                        <login-module code="YYY" flag="required">
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                    </authentication>
                </security-domain>
            </security-domains>
        </subsystem>

Solution

  • It is possible with the following commands:

    /subsystem=security/security-domain=MY_NAME:add 
    /subsystem=security/security-domain=MY_NAME:write-attribute(name=cache-type, value=default)
    /subsystem=security/security-domain=MY_NAME/authentication=classic:add(login-modules=[{code=XXX, flag=optional,module-options={password-stacking=useFirstPass}},{code=YYY, flag=required, module-options={password-stacking=useFirstPass}}]
    

    NOTE: I already had <subsystem xmlns="urn:jboss:domain:security:2.0"> created, so anyone reading who doesn't have the mentioned subystem might want to run /subsystem=security:add