house0128 commented on issue #891:
URL: https://github.com/apache/shiro/issues/891#issuecomment-1580111106

   @lprimak  Thanks.
   I try this way:
   `<dependency>
               <groupId>org.apache.shiro</groupId>
               <artifactId>shiro-core</artifactId>
               <version>1.11.0</version>
               <classifier>jakarta</classifier>
           </dependency>
           <dependency>
               <groupId>org.apache.shiro</groupId>
               <artifactId>shiro-spring</artifactId>
               <version>1.11.0</version>
               <classifier>jakarta</classifier>
           </dependency>
           <dependency>
               <groupId>org.apache.shiro</groupId>
               <artifactId>shiro-ehcache</artifactId>
               <version>1.11.0</version>
               <classifier>jakarta</classifier>
           </dependency>`
           
           
           Then meet this  problem, when we integrated shiro and springboot, we 
customized some things like this
           
           
           `@Bean(name = "shiroFilter")
       public ShiroFilterFactoryBean shiroFilter(@Qualifier("securityManager") 
SecurityManager manager) {
           ShiroFilterFactoryBean bean = new ShiroFilterFactoryBean();
           bean.setSecurityManager(manager);
           bean.setLoginUrl("/api/xxxxxx");
   
           Map<String, Filter> filtersMap = bean.getFilters();
           filtersMap.put("authc", new CustomFormAuthenticationFilter());
   
           LinkedHashMap<String, String> filterChainDefinitionMap = new 
LinkedHashMap<>();
           filterChainDefinitionMap.put("/api/xxxxxx", "anon");
           bean.setFilterChainDefinitionMap(filterChainDefinitionMap);
           return bean;
       }
       
       public class CustomFormAuthenticationFilter extends 
FormAuthenticationFilter  {
       @Override
       protected boolean onAccessDenied(ServletRequest request, ServletResponse 
response) throws Exception {
           // Get current login user
           Subject subject = getSubject(request, response);
           if (subject.getPrincipal() == null) {
               ...........
               return false;
           } else {
               return true;
           }
       }
       `
       
       In spring2 is ok.But in spring3 doesn't.Because 
       
       Map<String, Filter> filtersMap = bean.getFilters();------->Filter is 
jakarta.servlet.Filter.
       
        filtersMap.put("authc", new CustomFormAuthenticationFilter()); 
----->CustomFormAuthenticationFilter is javax.servlet.Filter
        
        Any idea?
       


-- 
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