【问题标题】:Exclude url from security constraint从安全约束中排除 url
【发布时间】:2015-05-19 11:32:08
【问题描述】:

我已经在 weblogic 服务器上配置了 ADFS SAML,并在 web.xml 中添加了相应的条目。 我想通过 ADFS SAML 从授权中排除一个 url,所以我在 web.xml 中添加了没有 auth-constraint 的安全约束。所以现在我期望带有 /Sample/ 的 url 应该被排除,但它仍然是授权 /Sample/ 请求 请在下面找到 web.xml 受限制的 /样本/*

<security-constraint>
  <display-name>excluded</display-name>
      <web-resource-collection>
      <web-resource-name>No Access</web-resource-name>
      <url-pattern>*</url-pattern>
       <http-method>PUT</http-method>
       <http-method>DELETE</http-method>
     </web-resource-collection>

  <web-resource-collection>
        <web-resource-name>Restricted</web-resource-name>
        <url-pattern>/Sample</url-pattern>
        <http-method>GET</http-method>
        <http-method>POST</http-method>
  </web-resource-collection>


  <web-resource-collection>
        <web-resource-name>SAML</web-resource-name>
        <url-pattern>*</url-pattern>
  </web-resource-collection>
    <auth-constraint>
        <role-name>everyone</role-name>
    </auth-constraint>
 </security-constraint> 

【问题讨论】:

    标签: java web.xml weblogic12c security-constraint


    【解决方案1】:

    您目前有多个问题...您应该做的第一件事是将其分解为多个security-constraint。您可以拥有多个,因此为您的 SAML 和 No Access 定义一个单独的。 SAML 和 No Access 的 URL 模式相同,是哪一种?:

    <url-pattern>*</url-pattern> 
    

    您的 auth-constraint 似乎也很糟糕...允许所有人访问?如果您只是想限制应用程序的某些部分,请不要指定身份验证约束,例如:

    <auth-constraint />
    

    按照 SO 上的示例进行操作,例如:How to exclude one url from authorization

    按照http://java.dzone.com/articles/understanding-web-security之类的教程进行操作

    【讨论】:

      猜你喜欢
      • 2012-01-18
      • 1970-01-01
      • 1970-01-01
      • 2012-11-21
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多