spring security customize logout handler

前端 未结 4 2121
谎友^
谎友^ 2020-12-15 05:25

How can I add my own logout handler to LogoutFilter in spring-security ? Thanks!

4条回答
  •  不知归路
    2020-12-15 05:53

    See the answer in this post in the Spring Security Forum:

    XML Definition:

    
        
        
        
            
                
                
            
        
    
    
    
    
    
        
    
    

    LogoutHandler class:

    public class CustomLogoutHandler implements LogoutHandler {
        private UserCache userCache;
    
        public void logout(final HttpServletRequest request, final HttpServletResponse response, final Authentication authentication) {
            // ....
        }
    
        @Required
        public void setUserCache(final UserCache userCache) {
            this.userCache = userCache;
        }
    }
    

提交回复
热议问题