4 Replies Latest reply on Nov 2, 2018 7:00 PM by RICARDO NEVES

    Problem creating security-domain with jboss-cli (wildfly 12)

    RICARDO NEVES Newbie

      command executed:

       

      jboss-cli.sh --connect --command="/subsystem=security/security-domain=App:add" \

      jboss-cli.sh --connect --command="/subsystem=security/security-domain=App/authentication=classic:add( \

              login-modules=[{ \

                  "code"=>"Database", \

                  "flag"=>"required", \

                  "module-options"=>[ \

                      "dsJndiName"=>"java:jboss/datasources/DS", \

                      "principalsQuery"=>SELECT pass FROM user WHERE username = ?, \

                      "rolesQuery"=>SELECT name, 'Roles' FROM user_x_roles WHERE username = ?, \

                      "unauthenticatedIdentity"=>"guest"] \

                  }])"

       

      result (wrong):

       

      <security-domain name="App">

           <authentication>

                <login-module code="Database" flag="required">

                     <module-option name="dsJndiName" value="java:jboss/datasources/DS"/>

                     <module-option name="principalsQuery" value="SELECT pass FROM user WHERE username = ?"/>

                     <module-option name="rolesQuery" value="SELECT name"/>

                     <module-option name="'Roles' FROM user_x_roles WHERE username" value="?"/>

                     <module-option name="unauthenticatedIdentity" value="guest"/>

                </login-module>

           </authentication>

      </security-domain>

       

      expected (correct):

       

      <security-domain name="App">

           <authentication>

                <login-module code="Database" flag="required">

                     <module-option name="dsJndiName" value="java:jboss/datasources/DS"/>

                     <module-option name="principalsQuery" value="SELECT pass FROM user WHERE username = ?"/>

                     <module-option name="rolesQuery" value="SELECT name, 'Roles' FROM user_x_roles WHERE username = ?"/>

                     <module-option name="unauthenticatedIdentity" value="guest"/>

                </login-module>

           </authentication>

      </security-domain>

       

      Does anyone know where I'm going wrong?

      it looks like it's breaking the line when there's a comma in the query (creating two tags module-option).

       

      tks