Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在JSF web.xml中查找禁用身份验证的标志_Jsf_Jakarta Ee_Authentication_Web.xml - Fatal编程技术网

在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>

我正在web.xml中搜索一个简单的true/false标志,以启用或禁用JSF中的身份验证

情况:

我有一个web.xml,其中包含以下用于身份验证的代码:

<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
尝试过了,但我认为系统仍然希望角色测试仪中有一个用户

那么,如何在不注释的情况下禁用整个身份验证机制呢

背景:

我的应用程序有不同的环境:

  • 本地机的开发

  • 测试服务器

  • 生产服务器

现在我希望身份验证只在测试服务器上发生。为此,我使用maven配置文件进行

  • 开发->无配置文件

  • 测试服务器->测试配置文件

  • 生产服务器->生产配置文件

为了实现不同的行为,我通过maven过滤web.xml,并在构建时插入值,例如
${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登录
保密的
如果有更干净的解决方案,我将不胜感激