2 Replies Latest reply on Jun 26, 2013 4:52 AM by Wolf-Dieter Fink

    Quoting in jboss-cli

    jeroenvds Newbie

      I'm trying to add a security domain. I currently do it with this 2 commands:

       

      {code}/usr/local/jboss/bin/jboss-cli.sh -c '/subsystem=security/security-domain=jdbcRealm:add(cache-type=default)'

       

      /usr/local/jboss/bin/jboss-cli.sh -c '/subsystem=security/security-domain=jdbcRealm/authentication=classic:add(login-modules=[{"code"=>"Database","flag"=>"required","module-options"=>[("dsJndiName"=>"java:jboss/datasources/df"),("principalsQuery"=>"SELECT PASSWORD FROM PERSON WHERE EMAIL = ?"),("rolesQuery"=>"SELECT name, 'Roles' FROM GROUPS INNER JOIN PERSON_GROUPS pg ON (GROUPS.id = pg.groups_id) WHERE email = ?"),("hashAlgorithm"=>"MD5"),("hashEncoding"=>"hex")]}]'{code}

      I'm having problems with the rolesquery part: I need a static column with the text Roles (or something different). So 'Roles' has to be quoted in the configuration file. But the quotes dissapear when using the above command. I tried adding backslashes, adding extra quotes etc, but I can't get it to work. It will probably be something stupid. Anybody has an idea?

        • 1. Re: Quoting in jboss-cli
          Wolf-Dieter Fink Master

          Hmm, not sure whether the shell is robbing; could you try it in the interactive CLI?

          • 2. Re: Quoting in jboss-cli
            Wolf-Dieter Fink Master

            Yes, the shell is interpreting.

            You can use the interactive CLI with jboss-cli.sh -c and type the add command here directly.

             

            Other option is to quote like this:

            bin/jboss-cli.sh -c "/subsystem=security/security-domain=jdbcRealm3/authentication=classic:add(login-modules=[{\"code\"=>\"Database\",\"flag\"=>\"required\",\"module-options\"=>[(\"dsJndiName\"=>\"java:jboss/datasources/df\"),(\"principalsQuery\"=>\"SELECT PASSWORD FROM PERSON WHERE EMAIL = ?\"),(\"rolesQuery\"=>\"SELECT name, 'Roles' FROM GROUPS INNER JOIN PERSON_GROUPS pg ON (GROUPS.id = pg.groups_id) WHERE email = ?\"),(\"hashAlgorithm\"=>\"MD5\"),(\"hashEncoding\"=>\"hex\")]}]"

            The command is surounded with " and all " must be quoted with \