我想使用Spring XML配置禁用websocket CSRF保护。
我知道可以完成using Java configuration:
@Configuration public class WebSocketSecurityConfig extends AbstractSecurityWebSocketMessageBrokerConfigurer { ... @Override protected boolean sameOriginDisabled() { return true; } }
...但是我如何在XML配置中做同样的事情呢?
答案 0 :(得分:1)
您必须将它作为属性放在websocket-message-broker元素上:
<websocket-message-broker same-origin-disabled="true">...</websocket-message-broker>
答案 1 :(得分:-1)
您可以使用XML配置文件并添加:
<http>
<!-- ... -->
<csrf disabled="true"/>
</http>
它相当于java:
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable();
}