403禁止GET请求-Tomcat

时间:2018-12-16 09:01:17

标签: java angular tomcat cors jersey

我在tomcat上有一个jersey webapp。在应用程序web.xml的web.xml中,我有

<security-constraint>
    <display-name>Allow unprotected OPTIONS</display-name>
    <web-resource-collection>
        <url-pattern>/*</url-pattern>
        <http-method>OPTIONS</http-method>
    </web-resource-collection>
</security-constraint>
<security-constraint>
    <web-resource-collection>
        <web-resource-name>white-listed-methods</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
        <http-method>PUT</http-method>
        <http-method>DELETE</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>PLATFORM Users</role-name>
    </auth-constraint>
    <user-data-constraint>
        <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
</security-constraint>
<login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>My realm Realm</realm-name>
</login-config>
<security-role>
    <description>The role that is required to log in to the pages.</description>
    <role-name>PLATFORM Users</role-name>      
</security-role> 

但是,当我在我的有角度的应用程序中发送请求时(我正在从本地主机发送请求:4200),我收到200的OPTIONS请求,禁止403的GET请求。

但是我可以从浏览器或其他客户端通过身份验证访问GET方法。没问题。

Ps。我在tomcat服务器的web.xml中有一个CORSFilter。 我确定没有CORS问题。

有人可以在我哪里错吗?

Screenshot

0 个答案:

没有答案
相关问题