Issue
I'm trying to change a aplication to Maven. I'm working with NetBeans and GlassFish 3.1.2.2. There is a problem that I can't solve. I have been searching and I have not found any solution. My problem is with Shiro. The GlassFish console show that:
Grave: java.lang.IllegalArgumentException: Configuration error. Specified object [anyofroles] with property [loginUrl] without first defining that object's class. Please first specify the class property first, e.g. myObject = fully_qualified_class_name and then define additional properties. at org.apache.shiro.config.ReflectionBuilder.applySingleProperty(ReflectionBuilder.java:361) at org.apache.shiro.config.ReflectionBuilder.applyProperty(ReflectionBuilder.java:325)
My Shiro versions are the same at the previous project: * shiro-cas -> 1.2.0 * shiro-core -> 1.3.0 * shiro-web -> 1.3.0
My shiri.ini contains that:
[main]
anyofroles.loginUrl = /login.xhtml
# realm to be used
secundaryRealm=com.asesoreslocales.security.SecondaryRealm
anyofroles = com.asesoreslocales.security.AnyRolesAuthorizationFilter
builtInCacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $builtInCacheManager
[users]
[urls]
/mantenimientos/** = anyofroles["administrador,editor"]
/remesas/** = anyofroles["administrador,editor"]
/alegaciones/** = anyofroles["administrador,editor"]
/notificaciones/** = anyofroles["administrador,editor"]
/expedientes/expedientes.xhtml = anyofroles["administrador,editor"]
/expedientes/busquedaExpedientes.xhtml = anyofroles["administrador,editor,consultor"]
At the previous project, Shiro worked normally.
Thank for your help and sorry for my english.
Solution
The error messages says you should first declare the object:
anyofroles = com.asesoreslocales.security.AnyRolesAuthorizationFilter
and then define the properties of it:
anyofroles.loginUrl = /login.xhtml
Did you try that? Maybe like this:
[main]
# realm to be used
secundaryRealm=com.asesoreslocales.security.SecondaryRealm
anyofroles = com.asesoreslocales.security.AnyRolesAuthorizationFilter
anyofroles.loginUrl = /login.xhtml
builtInCacheManager = org.apache.shiro.cache.MemoryConstrainedCacheManager
securityManager.cacheManager = $builtInCacheManager
[users]
[urls]
/mantenimientos/** = anyofroles["administrador,editor"]
/remesas/** = anyofroles["administrador,editor"]
/alegaciones/** = anyofroles["administrador,editor"]
/notificaciones/** = anyofroles["administrador,editor"]
/expedientes/expedientes.xhtml = anyofroles["administrador,editor"]
/expedientes/busquedaExpedientes.xhtml = anyofroles["administrador,editor,consultor"]
Answered By - funfried
Answer Checked By - Pedro (JavaFixing Volunteer)