jglatre commented on issue #1236:
URL: https://github.com/apache/shiro/issues/1236#issuecomment-3149333044

   As a workaround, just avoid exposing `BeanPostProcessor` to Spring, wrap the 
original `ShiroFilterFactoryBean` in a new `FactoryBean`:
   
   ```
   @Bean
   public FactoryBean<AbstractShiroFilter> shiroFilter( 
       SecurityManager securityManager,
       ShiroFilterChainDefinition chainDefinition, 
       Map<String, Filter> filters  
   ) {
       return new ShiroFilterWrapperFactoryBean( securityManager, 
chainDefinition.getFilterChainMap(), filters );
   }
   
   
   private static class ShiroFilterWrapperFactoryBean implements 
FactoryBean<AbstractShiroFilter> {
       private final ShiroFilterFactoryBean delegate = new 
ShiroFilterFactoryBean();
   
       public ShiroFilterWrapperFactoryBean(
              SecurityManager securityManager,
              Map<String, String> chainDefinitionMap,
              Map<String, Filter> filters
       ) {
           delegate.setSecurityManager( securityManager );
           delegate.setFilterChainDefinitionMap( chainDefinitionMap );
           for (Map.Entry<String, Filter> filter : filters.entrySet()) {
               delegate.postProcessBeforeInitialization( filter.getValue(), 
filter.getKey() );
           }
       }
   
       @Override
       public AbstractShiroFilter getObject() throws Exception {
           return (AbstractShiroFilter) delegate.getObject();
       }
   
      @Override
       public Class<?> getObjectType() {
           return delegate.getObjectType();
       }
   
       @Override
       public boolean isSingleton() {
           return delegate.isSingleton();
       }
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to