java - 如何从 Waffle 身份验证中排除 URL?

标签 java tomcat waffle

我有一个在 Tomcat 上运行并使用 Waffle 通过 Activity 目录进行身份验证的 Java 应用程序。我的要求是使用此应用程序中托管的某些 rest 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>

我怎样才能做到这一点?

最佳答案

只需像这样添加第二个不 protected 约束:

<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

关于java - 如何从 Waffle 身份验证中排除 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29691420/

相关文章:

spring-security - 将 Waffle Spring Security XML 配置迁移到 Spring Boot

java - 如何使用java配置在spring中配置waffle

java - Android 检查设备中的日期格式

java 。限制日期的值

java - JAXB - 如何仅在子标签中设置 xmlns 和前缀

java - HttpURLConnection 中的 NTLM 身份验证在 JRE 中不起作用,但在 JDK 环境中起作用

java - 按频率排序单词? (从最低到最高)

tomcat 在 eclipse 中找不到 index.jsp

java - 使用 Java Web Start 部署应用程序

部署WAR时Spring-Boot模板解析失败