首页 > 解决方案 > 为什么即使我在 web.xml 中已经有安全约束,任何授权都不能访问我的服务?

问题描述

我在web.xml. Role_TestWs可以访问我的服务,但没有授权可以访问我的服务。我只想Role_TestWs能够访问我的服务。

<security-constraint>
    <web-resource-collection>
      <web-resource-name>TestWs</web-resource-name>
      <url-pattern>/*</url-pattern>
      <http-method>POST</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>Role_TestWs</role-name>
    </auth-constraint>
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>default</realm-name>
  </login-config>
  <security-role>
    <role-name>Role_TestWs</role-name>
  </security-role>
</web-app>

标签: javaservletsweb.xmlsecurity-constraint

解决方案


推荐阅读