This is mostly pseudo code, but something like:

ApplicationContext appContext = SpringUtil.getApplicationContext();
AbstractShiroFilter filter = appContext.getBean(AbstractShiroFilter.class); //
or possibly appContext.getBean(ShiroFilterFactoryBean.class).getObject()

PathMatchingFilterChainResolver resolver = (PathMatchingFilterChainResolver)
filter.getFitlerChainResovler();
resolver.getFilterChainManager().addFilter(<your logic here>)

I mentioned subclassing mostly to get around dealing with the above object
graph, and casting, but something like the above should work.


On Tue, Oct 11, 2016 at 11:55 AM, Hitesh <umaletiya.hit...@gmail.com> wrote:

> First of all, I am using the ShiroFilterFactoryBean only. Here is the xml
> configuration of that -
>
> /<bean id="shiroFilter"
> class="org.apache.shiro.spring.web.ShiroFilterFactoryBean">
>         <property name="securityManager" ref="securityManager" />
>         <property name="loginUrl" value="/home/login.zul" />
>         <property name="successUrl" value="/home/index.zul" />
>         <property name="unauthorizedUrl" value="/home/unauthorized.zul" />
>         <property name="filterChainDefinitions"
> value="#{filterDef.filterChainDefinitionMap}"/>
> </bean>/
>
> Now, when I save URL = Role Mapping from UI, I get reference of this bean
> from application context and then invoke setFilterChainDefinition() method
> on it. The exact lines are -
>
> *ApplicationContext appContext = SpringUtil.getApplicationContext();
> appContext.getBean(ShiroFilterFactoryBean.class).
> setFilterChainDefinitions(appContext.getBean(ShiroFilterDefMap.class).
> getFilterChainDefinitionMap());*
>
> Later, as per your suggestion, I extended the ShiroFilterFactoryBean and
> created my own user defined ShiroFilterBean which I attached in one of the
> earlier reply. I actually want to know what exactly I am supposed to do in
> the subclass. You have the file. You can suggest.
>
>
>
> --
> View this message in context: http://shiro-developer.582600.
> n2.nabble.com/Facing-issue-in-reflecting-URL-ROLE-changes-
> dynamically-tp7579469p7579477.html
> Sent from the Shiro Developer mailing list archive at Nabble.com.
>

Reply via email to