I suggest you add a hint to the pax shiro documentation that CDI beans have
to be referenced by name in order for them to be instantiated through CDI -
'@ShiroIni' implies '@Named'. If one does the following 'mongoRealm' and
'rolePermissionResolver' are instantiated through regular shiro without CDI
integration, so anything annotated '@Inject' will *not *be injected:
[main]
mongoRealm = de.versatec.mongo.shiro.MongoRealm
...
rolePermissionResolver =
de.versatec.mongo.shiro.ActiveDirectoryRolePermissionResolver
rolePermissionResolver.tenantId = versatec.invalid
activeDirectoryRealm.rolePermissionResolver = $rolePermissionResolver
securityManager.realms = $mongoRealm, $activeDirectoryRealm
-------------
Instead one has to do this when using pax shiro for CDI integration
($mongoRealm and $activeDirectoryRolePermissionResolver are now instantiated
through CDI):
[main]
activeDirectoryRealm.rolePermissionResolver =
$activeDirectoryRolePermissionResolver
activeDirectoryRealm.rolePermissionResolver.tenantId = versatec.invalid
securityManager.realms = $mongoRealm, $activeDirectoryRealm
#Mark how we use references to the two classes without explicitly defining
them in shiro.ini
-----------
MongoRealm.java:
...
@ShiroIni
public class MongoRealm extends AuthorizingRealm {

    @Inject
    private MongoProvider mongoProvider;
...
}





--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/OPS4J-Pax-Shiro-extends-Apache-Shiro-for-Java-EE-6-tp7579096p7579154.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to