Uploaded image for project: 'Shiro'
  1. Shiro
  2. SHIRO-455

Allowing to cache WildcardPermission in WildcardPermissionResolver class

    XMLWordPrintableJSON

    Details

      Description

      Hello,

      I am benching Shiro, tahnks this method:
      public void bench() {
      final Subject subject = SecurityUtils.getSubject();
      subject.login(new UsernamePasswordToken(LOGIN+i, PWD));
      for (int ind = 0; ind < 100000; ind++)

      { // a lot of authorizations assertTrue(subject.isPermitted("medias:album:read")); }

      subject.logout();
      }

      I see that I waste my time in the methode WildCardPermissionResolver which create a new instance of permission each time even if it is the same String in parameter.
      I added a map which allows to cache WildcardPermission.
      You can find in attachement the patch.

      PS : the cache for authorisation is activated:
      cacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
      securityManager.cacheManager = $cacheManager

      Regards,

      Thibault

        Attachments

        1. shiro-core.patch
          1 kB
          Thibault Tigeon

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              thibault Thibault Tigeon
            • Votes:
              2 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: