IniRealm initialized two times

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

IniRealm initialized two times

samir.hadzic
This post was updated on .
Hi guys,

I've got an issue regarding Shiro iniRealm and CredentialMatcher. I'm creating a securityManager with an ini file. In that Ini file, in the main section, I'm putting that :
main.put("NellMatcher","com.nellarmonia.shuttle.security.shiro.NellCredentialMatcher");
main.put("iniRealm.credentialsMatcher", "$NellMatcher");


This should be good according to https://shiro.apache.org/realm.html#credentials-matching.

I'm trying to attach my own credential matcher to the default iniRealm.Then I do :
Factory factory = new IniSecurityManagerFactory(ini);      
securityManager = factory.getInstance();


and this warning is thrown :
org.apache.shiro.realm.text.IniRealm - Users or Roles are already populated.
Configured Ini instance will be ignored.


If I did a little bit in the source code, I can see that in buildObjects method of ReflectionBuilder.java, we
first process the kvPairs and then initialize the objects with :
//SHIRO-413:init method must be called for constructed objects that are Initializable      
LifecycleUtils.init(objects.values());


But in the execute method of BeanConfigurationProcessor, the iniRealm is also initialized because the Pair "iniRealm.credentialsMatcher", "$NellMatcher" is being processed.

Therefore, iniRealm is initialized and the call to "
LifecycleUtils.init(objects.values());" tries to re-init the iniRealm again,
thus throwing the warning.

Is this a bug or am I missing something ?
Any helpis appreciated,
Regards,
Sam'



--
Sent from: http://shiro-user.582556.n2.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: IniRealm initialized two times

samir.hadzic
Allright folks, I've updated my post in the nabble forum as it was apparently
completly un-readable.

I'm not quite used to these mailing list.



--
Sent from: http://shiro-user.582556.n2.nabble.com/