RealmFactory not working properly
---------------------------------

                 Key: SHIRO-238
                 URL: https://issues.apache.org/jira/browse/SHIRO-238
             Project: Shiro
          Issue Type: Bug
          Components: Configuration
    Affects Versions: 1.1.0
            Reporter: jontro


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.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to