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

RealmFactory not working properly

    Details

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

      Description

      Im trying to use a realmFactory to register a realm.

      The config is quite simple:

      [main]
      realmFactory = se.example.init.MyRealmFactory
      authc.loginUrl = /

      After debugging the problem I stumbled upon the following lines in

      org.apache.shiro.config.IniSecurityManagerFactory (Line 173 in version 1.1.0)

      private void addToRealms(Collection<Realm> realms, RealmFactory factory) {
      LifecycleUtils.init(factory);
      Collection<Realm> factoryRealms = factory.getRealms();
      if (!CollectionUtils.isEmpty(realms))

      { realms.addAll(factoryRealms); }


      }

      Changing
      if (!CollectionUtils.isEmpty(realms)) {
      to
      if (!CollectionUtils.isEmpty(factoryRealms)) {

      solves the problem.

        Attachments

          Activity

            People

            • Assignee:
              lhazlewood Les Hazlewood
              Reporter:
              jontro jontro
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: