1

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

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

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

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

接下来,在 elytron 部分中,我指定安全域,如下所示:

<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 安全部分使用安全域“other”,而不是在 elytron 部分使用我的安全域。如何强制 Wildfly 使用我的 Elytron 安全域?

4

1 回答 1

0

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

于 2021-02-06T22:39:21.303 回答