У меня есть это ограничение безопасности в web.xml моего приложения отдыха из джерси.
Я должен разрешить запрос OPTIONS и установить аутентификацию для запросов GET и POST.
<security-constraint>
<display-name>Allow unprotected GET</display-name>
<web-resource-collection>
<url-pattern>/* </url-pattern>
<http-method>OPTIONS</http-method>
</web-resource-collection>
</security-constraint>
<security-constraint>
<display-name>Require authentication for POST</display-name>
<web-resource-collection>
<url-pattern>/* </url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>Platform Users</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>MyRealm</realm-name>
</login-config>
<security-role>
<description>The role that is required to log in to the HCS pages.</description>
<role-name>Platform Users</role-name>
</security-role>
Однако, когда я отправляю запрос REST через angular, я получаю 200 для запроса OPTIONS 403 (Запрещено) для запроса GET.
Может кто-нибудь сказать мне, где я иду не так?
Примечание: я уверен, что CORS здесь не проблема.Я добавил CORS Filter, и он работает без ограничений безопасности.