Shiro
  1. Shiro
  2. SHIRO-322

Overriding permissionResolver has no effect on implicit iniRealm

    Details

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

      Description

      Currently, the implicit iniRealm processes its role and permissions strings to early. Overriding the permissionResolver and or rolePermissionResolver has no effect.

      The realm is constructed by calling
      new IniRealm(ini) (IniSecurityManagerFactory.java:254)

      This constructor then calls
      processDefinition(ini) right away (IniRealm.java:60)

      This fills in the roles and users maps in SimpleAccountRealm, but it will use the default permissionResolver to do so because getPermissionResolver() (TextConfigurationRealm.java:144) will return the default instance.

      IniRealm should probably not do any initialisation code (processDefinition) before init is called. It overrides onInit() but tests whether the roles and users collections are empty before doing any processing (and it will only initialise if it was constructed with a resourcePath)...

        Activity

        Hide
        Les Hazlewood added a comment -

        Fix implemented. IniSecurityManagerFactoryTest.testImplicitIniRealmWithConfiguredPermissionResolver unit test asserts the fix.

        Show
        Les Hazlewood added a comment - Fix implemented. IniSecurityManagerFactoryTest.testImplicitIniRealmWithConfiguredPermissionResolver unit test asserts the fix.
        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.

          People

          • Assignee:
            Les Hazlewood
            Reporter:
            Philippe Laflamme
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development