在WebLogic Server 域中如何禁用 GET 和 POST 以外的 HTTP 方法(如 PUT、DELETE 等)

我们可以使用 <application_name>/WEB-INF/web.xml 中的安全约束来限制对 HTTP 方法的访问,例如 PUT 或者 DELETE:

<security-constraint>
  <display-name>Constraint-0</display-name>
  <web-resource-collection>
    <web-resource-name>mytest</web-resource-name>
    <description>Test</description>
    <url-pattern>/*</url-pattern>
    <http-method>PUT</http-method>
    <http-method>DELETE</http-method>
  </web-resource-collection>
  <auth-constraint>
    <role-name>NONE</role-name>
  </auth-constraint>
  <user-data-constraint>
    <transport-guarantee>NONE</transport-guarantee>
  </user-data-constraint>
</security-constraint>

注意:WebLogic Server 中没有选项可以在整个服务器上禁用它们,因为规范要求应用程序服务器允许所有 HTTP 方法。

实际上限制 HTTP 方法的责任在于应用程序。
我们这样做的方法是在 web.xml 文件中提供安全约束。

日期:2020-09-17 00:16:36 来源:oir作者:oir