Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/security/4.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
Java YAML中配置的Wildfly Swarm安全约束的行为与WEB.XML中的不同_Java_Security_Yaml_Java Security_Wildfly Swarm - Fatal编程技术网

Java YAML中配置的Wildfly Swarm安全约束的行为与WEB.XML中的不同

Java YAML中配置的Wildfly Swarm安全约束的行为与WEB.XML中的不同,java,security,yaml,java-security,wildfly-swarm,Java,Security,Yaml,Java Security,Wildfly Swarm,我想使用KeyClope作为我基于wildfly swarm的应用程序的安全提供商。只有一个资源需要“公共访问”(/api/systemInfo)。。。所有其他资源都应该受到keydepeat的保护。如果我将其添加到web.xml(在src/main/web-INF中),web.xml如下所示: <web-app> <module-name>amigo</module-name> <security-constraint> <web-

我想使用KeyClope作为我基于wildfly swarm的应用程序的安全提供商。只有一个资源需要“公共访问”(/api/systemInfo)。。。所有其他资源都应该受到keydepeat的保护。如果我将其添加到web.xml(在src/main/web-INF中),web.xml如下所示:

<web-app>
<module-name>amigo</module-name>
<security-constraint>
    <web-resource-collection>
        <url-pattern>/api/systemInfo</url-pattern>
    </web-resource-collection>
</security-constraint>
<security-constraint>
    <web-resource-collection>
        <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
        <role-name>admin</role-name>
    </auth-constraint>
</security-constraint>
<login-config>
    <auth-method>KEYCLOAK</auth-method>
    <realm-name>amigo</realm-name>
</login-config>
在我看来,这应该像第一个代码片段(web.xml)一样。但事实并非如此。似乎(/api/systemInfo)的规则被忽略了,或者至少它没有按预期工作。在/api/systemInfo上,我得到一个403,而在所有其他请求上,我得到预期的重定向到keydape登录

有人知道我需要调整什么以获得与使用web.xml相同的行为吗


非常感谢您的帮助。

嗯,听起来可能是个bug。你能在会议上提出一个问题吗?因为这两个人的行为肯定是一样的。如果你能提供一个项目的例子,那就太好了。我刚才提出了一个你所描述的问题。让我们看看我们能得到什么。应使用Thorntail 2.0.0.Final版解决此问题
swarm:
  context:
    path: /
  deployment:
    app.war:
      web:
        login-config:
          auth-method: KEYCLOAK
        security-constraints:
          - url-pattern: /api/systemInfo
          - url-pattern: /*
            roles: [admin]