Disable Spring Security for OPTIONS Http Method

前端 未结 6 2458
自闭症患者
自闭症患者 2020-11-27 13:37

Is it possible to disable Spring Security for a type of HTTP Method?

We have a Spring REST application with services that require Authorization token to be attached

6条回答
  •  一整个雨季
    2020-11-27 14:32

    Allow all OPTIONS in context:

        @Override
        public void configure(WebSecurity web) throws Exception {
            web.ignoring().antMatchers(HttpMethod.OPTIONS, "/**");
        }
    

提交回复
热议问题