我有一个在 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
一起工作。
关于java - 如何从 Waffle 身份验证中排除 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29691420/