我有一个Java应用程序,该应用程序在Tomcat上运行,并使用Waffle对活动目录进行身份验证。我的要求是不使用任何身份验证即可使用此应用程序中托管的某些剩余URL。

配置设置如下。

context.xml(Tomcat)

<Valve className="waffle.apache.NegotiateAuthenticator"
    principalFormat="fqn" roleFormat="both"/>
<Realm className="waffle.apache.WindowsRealm"/>


web.xml

 <security-role>
      <role-name>Everyone</role-name>
 </security-role>

   <security-constraint>
   <display-name>Waffle Security Constraint</display-name>
      <web-resource-collection>
        <web-resource-name>Protected Area</web-resource-name>
        <url-pattern>/*</url-pattern>
      </web-resource-collection>
      <auth-constraint>
        <role-name>Everyone</role-name>
      </auth-constraint>
    </security-constraint>


我该如何实现?

最佳答案

只需添加第二个不受保护的约束,如下所示:

<security-constraint>
  <display-name>Login Page</display-name>
  <web-resource-collection>
    <web-resource-name>Unprotected Login Page</web-resource-name>
    <url-pattern>/login.jsp</url-pattern>
  </web-resource-collection>
</security-constraint>


我可能还需要在context.xml文件中使用混合身份验证:

<Context>
  <Valve className="waffle.apache.MixedAuthenticator" />
  <Realm className="waffle.apache.WindowsRealm" />
</Context>


但是,我们可以使其与waffle.apache.NegotiateAuthenticator一起使用。

参见:https://github.com/dblock/waffle/blob/master/Docs/tomcat/TomcatMixedSingleSignOnAndFormAuthenticatorValve.md

10-07 19:07
查看更多