Trying to migrate to Shiro v2.x (from v1.13) and stuck with the following code
(which was working fine in 1.13):
public static MySecurityManager getSecurityManager() {
return (MySecurityManager)
org.apache.shiro.SecurityUtils.getSecurityManager();
}
Getting the following exception:
java.lang.ClassCastException: class
org.apache.shiro.ee.filters.ShiroFilter$WrappedSecurityManager cannot be cast
to class pkg.local.MySecurityManager
(org.apache.shiro.ee.filters.ShiroFilter$WrappedSecurityManager and
pkg.local.MySecurityManager are in unnamed module of loader
org.glassfish.web.loader.WebappClassLoader @26652402)
The issue is that some of my code need to iterate over realms, as result this
code doesn't work anymore: getSecurityManager().getRealms().
Any suggestions how to get access to own custom implementation of Security
Manager (MySecurityManager as per the code above) or at least get access to
realms?
Thanks!