在JSF web.xml中查找禁用身份验证的标志
我正在web.xml中搜索一个简单的true/false标志,以启用或禁用JSF中的身份验证 情况: 我有一个web.xml,其中包含以下用于身份验证的代码:在JSF web.xml中查找禁用身份验证的标志,jsf,jakarta-ee,authentication,web.xml,Jsf,Jakarta Ee,Authentication,Web.xml,我正在web.xml中搜索一个简单的true/false标志,以启用或禁用JSF中的身份验证 情况: 我有一个web.xml,其中包含以下用于身份验证的代码: <login-config> <auth-method>${test.auth}</auth-method> <realm-name>file</realm-name> </login-config> <security-role>
<login-config>
<auth-method>${test.auth}</auth-method>
<realm-name>file</realm-name>
</login-config>
<security-role>
<description>Tester</description>
<role-name>Tester</role-name>
</security-role>
<security-constraint>
<display-name>Test-Server-Access</display-name>
<web-resource-collection>
<web-resource-name>Test-Server-Access</web-resource-name>
<description/>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>Tester Access</description>
<role-name>Tester</role-name>
</auth-constraint>
<user-data-constraint>
<description>HTTPS Login</description>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
${test.auth}
文件
测试员
测试员
测试服务器访问
测试服务器访问
/*
测试人员访问
测试员
HTTPS登录
保密的
一切都按预期进行,对我来说相当不错。但还有一件事要做。
正如您所看到的,我想填写一个参数(${test.auth}
),这也很有效。但是现在我需要一个类似于标志的东西来禁用带有这样一个参数的整个auth机制。我已经用NONE
尝试过了,但我认为系统仍然希望角色测试仪中有一个用户
那么,如何在不注释的情况下禁用整个身份验证机制呢
背景:
我的应用程序有不同的环境:
- 本地机的开发
- 测试服务器
- 生产服务器
- 开发->无配置文件
- 测试服务器->测试配置文件
- 生产服务器->生产配置文件
${test.auth}
谢谢你的帮助。我通过将url模式设置为从未使用过的站点“解决”了这个问题。这不太好,但目前还有效:/
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>file</realm-name>
</login-config>
<security-role>
<description>Tester</description>
<role-name>Tester</role-name>
</security-role>
<security-constraint>
<display-name>Test-Server-Access</display-name>
<web-resource-collection>
<web-resource-name>Test-Server-Access</web-resource-name>
<description/>
<url-pattern>${test.url}</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>Tester Access</description>
<role-name>Tester</role-name>
</auth-constraint>
<user-data-constraint>
<description>HTTPS Login</description>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
基本的
文件
测试员
测试员
测试服务器访问
测试服务器访问
${test.url}
测试人员访问
测试员
HTTPS登录
保密的
如果有更干净的解决方案,我将不胜感激