Spring Security 3.2 CSRF disable for specific URLs

后端 未结 7 1931
梦毁少年i
梦毁少年i 2020-12-08 02:32

Enabled CSRF in my Spring MVC application using Spring security 3.2.

My spring-security.xml


 

        
7条回答
  •  离开以前
    2020-12-08 03:02

    I am using Spring Security v4.1. After a lot of reading and testing, I disable the CSRF security feature for specific URLs using XML configuration.

    
    
        
    
        
            
            
            
            
            
            
        
    
        
            
                
                    
                        
                        
                    
                    
                        
                        
                    
                    
                        
                        
                    
                
            
        
    
        //...
    
    
    

    With the above configuration, I enable the CSRF security only for POST|PUT|DELETE requests of all URLs which start with /rest/.

提交回复
热议问题