即使我已经在web.xml中具有安全性约束,为什么任何授权都无法访问我的服务?

时间:2019-03-18 10:58:53

标签: java servlets web.xml security-constraint

我在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>

0 个答案:

没有答案