gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 23:31:33 27 4
gpt4 key购买 nike

我有一个在 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/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com