我对我的服务有一个交叉来源请求。该服务期望“身份验证”标题是一个令牌。忽略所有HTTP.OPTIONS调用的身份验证安全吗?
Web客户机使用angularjs拦截通过授权令牌,但得到
OPTIONS http://<domain>:<port>/xxxx 401 (Unauthorized)
XMLHttpRequest cannot load http://<domain>:<port>/xxxx. Response for preflight has invalid HTTP status code 401
,因此,不能得到作为响应。所以在GET
调用中的Authorization
头部被忽略!
但是,当我禁用了OPTIONS
方法的认证 - 我增加了一个antMatchers(HttpMethod.OPTIONS,"/**").permitAll()
- Web应用程序能够给我Authorization
头如预期。
在我的服务中安全地使用所有HTTP.OPTIONS
方法的非验证呼叫?
相关问题:Disable Spring Security for OPTIONS Http Method