Shiro
  1. Shiro
  2. SHIRO-205

Filter configs cannot contain commas in INI format

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.2.0
    • Component/s: Configuration
    • Labels:
      None

      Description

      Consider this configuration:

      [urls]
      /test/** = roles[guest, admin]

      The above won't work at the moment because PathMatchingFilter splits the right-hand value into 'roles[guest' and 'admin]'. Commas inside square brackets should be ignored when splitting the path value.

        Activity

        Les Hazlewood made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Les Hazlewood added a comment -

        Closing with the 1.2.0 release.

        Show
        Les Hazlewood added a comment - Closing with the 1.2.0 release.
        Les Hazlewood made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Les Hazlewood added a comment -

        Bracketed config no no longer needs to be quoted. For example, the following filter chain definition lines are equivalent:

        foo, bar["a, b"], baz["d, e, f"]

        and

        foo, bar[a, b], baz[d, e, f]

        The first line (old style) still works for backwards compatibility but the latter functions as expected now.

        Show
        Les Hazlewood added a comment - Bracketed config no no longer needs to be quoted. For example, the following filter chain definition lines are equivalent: foo, bar ["a, b"] , baz ["d, e, f"] and foo, bar [a, b] , baz [d, e, f] The first line (old style) still works for backwards compatibility but the latter functions as expected now.
        Les Hazlewood made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Les Hazlewood made changes -
        Assignee Peter Ledbrook [ pledbrook ] Les Hazlewood [ lhazlewood ]
        Kalle Korhonen made changes -
        Field Original Value New Value
        Fix Version/s 1.2.0 [ 12315478 ]
        Fix Version/s 1.1.0 [ 12314742 ]
        Hide
        Peter Ledbrook added a comment -

        That probably does work, but I didn't know whether double-quotes was the appropriate solution or not. If it is, then I'll revert my local change because it breaks the quoting. Seems odd to require quotes (from a user perspective) since you already have the '[' and ']' delimiters.

        Show
        Peter Ledbrook added a comment - That probably does work, but I didn't know whether double-quotes was the appropriate solution or not. If it is, then I'll revert my local change because it breaks the quoting. Seems odd to require quotes (from a user perspective) since you already have the ' [' and '] ' delimiters.
        Hide
        Les Hazlewood added a comment -

        Hi Peter,

        I think that's a valid solution. But I'm amazed it didn't work already by using quotes inside the brackets. I thought that was documented in http://shiro.apache.org/web.html that you had to quote commas, but it doesn't look like it.

        Can you try:

        [urls]
        /test/** = roles["guest, admin"]

        and see if that works?

        Show
        Les Hazlewood added a comment - Hi Peter, I think that's a valid solution. But I'm amazed it didn't work already by using quotes inside the brackets. I thought that was documented in http://shiro.apache.org/web.html that you had to quote commas, but it doesn't look like it. Can you try: [urls] /test/** = roles ["guest, admin"] and see if that works?
        Hide
        Peter Ledbrook added a comment -

        My proposed fix involves specifying '[' as the starting quote and ']'
        as the end quote when using Shiro's split() method. One side-effect of
        this approach is that " is no longer considered a quote character. Is
        that OK? Do quote characters have any special meaning in filter chain
        definitions?

        Thanks,

        Peter

        Show
        Peter Ledbrook added a comment - My proposed fix involves specifying ' [' as the starting quote and '] ' as the end quote when using Shiro's split() method. One side-effect of this approach is that " is no longer considered a quote character. Is that OK? Do quote characters have any special meaning in filter chain definitions? Thanks, Peter
        Peter Ledbrook created issue -

          People

          • Assignee:
            Les Hazlewood
            Reporter:
            Peter Ledbrook
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development