当前位置: 首页 > 知识库问答 >
问题:

Wildfly 16:忽略jboss-web.xml中指定的安全域

谢承颜
2023-03-14

运行Wildfly16,我在应用程序的WEB-INF/jboss-web.xml中指定一个安全域,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <security-domain>MyDomain</security-domain>
</jboss-web> 

在Wildfly的standalone.xml中,我将该安全域指定为应用程序安全域,如下所示:

<subsystem xmlns="urn:jboss:domain:undertow:8.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other" statistics-enabled="${wildfly.undertow.statistics-enabled:${wildfly.statistics-enabled:false}}">
    <buffer-cache name="default"/>
    <server name="default-server">
        <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
        <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
        <host name="default-host" alias="localhost">
            <location name="/" handler="welcome-content"/>
            <http-invoker security-realm="ApplicationRealm"/>
        </host>
    </server>
    ...
    <application-security-domains>
        <application-security-domain name="MyDomain" security-domain="OAuth2Domain"/>
    </application-security-domains>
<subsystem xmlns="urn:wildfly:elytron:6.0" final-providers="combined-providers" disallowed-providers="OracleUcrypto">
...   
    <security-domain name="OAuth2Domain" default-realm="OAuth2Realm" permission-mapper="default-permission-mapper">
       <realm name="OAuth2Realm"/>
    </security-domain>

当然,随后还定义了OAuth2Realm,并且Wildfly毫无怨言地启动。但是,当通过http访问应用程序时,Wildfly总是在legacy security部分使用安全域“Other”,而不是在elytron部分使用my security domain。我如何强制Wildfly使用我的Elytron安全域?

共有1个答案

相化
2023-03-14

找到了解决方案:应用程序使用JAAS登录上下文进行编程登录,但它只知道遗留安全系统中定义的安全域。要以编程方式登录elytron系统中的域,必须使用elytron身份验证上下文,如https://docs.jboss.org/author/display/wfly/client%20authentication%20with%20elytron%20client.html中所述

 类似资料:
  • 我正在尝试配置Spring Security注释,我已经设法在xml中设置了Spring Security配置(由intercept-url元素配置),但是现在我想在我的beans中使用安全注释。但是当试图在没有记录的情况下访问安全控制器方法时,安全注释被完全忽略。这是我的控制器bean: 和登录控制器: 和配置:web.xml Spring-套筒.xml 和Spring安全.xml 如果需要,我

  • 我试图在wildfly上保护一个演示web应用程序。我已经在单机版中定义了这个安全域。xml 然后在web-inf下,我在web.xml中定义了这个安全约束 以及jboss网站上的这些内容。xml 问题是,如果我转到/projects URL,我不会重定向到登录页面,就好像忽略了约束一样。

  • 我想使用下面的连接器配置将多个表数据发布到同一个Kafka主题,但我看到了下面的异常 例外 原因:io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException:正在注册的架构与早期架构不兼容;错误代码:409 连接器似乎忽略了主题策略属性集,并继续使用旧的${主题}-key和${主题}-value主题。 连

  • 我试图保护我的Spring启动应用程序(1.21)看起来像我的antMatcher("/报告**"). hasRole("报告")的一些URL模式被忽略。 e、 g.如果我浏览到localhost:9000/report/books之类的内容,我需要登录,它只适用于我的用户名密码组合,但我没有将角色报告设置为我的用户“user”。所以我希望我不被允许访问报告网站,但页面会显示出来。 我必须如何更改

  • 我已经为这个问题挣扎了几天了,希望有人能帮上忙。 当我的应用程序尝试构建Hibernate3 SessionFactory时,我遇到以下错误: 下面是我的/WEB-INF/jboss网站。xml: Hibernate在我的单元测试中运行良好,只有当我将其部署到测试服务器时才会发生这种情况。 从我发现的情况来看,这似乎是因为jboss已经有了dom4j的副本。 不,我无法从我的项目中删除dom4j,

  • 这里有一个简单的endpoint,存在于/api/v1/jwt中 返回一个有效的JWT令牌。 但我的安全配置不再起作用,现在所有endpoint似乎都受到保护, Edit:antPathRequestMatcher没有为configure启动,但我甚至添加了websecurity configure的路径,我得到了以下日志记录