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

RealmFactory not working properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 1.2.0
    • Configuration
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: