【问题标题】:Wildfly Security Subsystem: Migrating from Legacy to Elytron, security-domain not foundWildfly 安全子系统:从 Legacy 迁移到 Elytron,未找到安全域
【发布时间】:2019-06-11 12:45:24
【问题描述】:

我正在尝试将项目从使用 Legacy Security 迁移到使用 Elytron Security。

直到现在(旧版),身份验证工作所需要做的就是在子系统中创建一个安全域 -> 具有正确名称的安全域(“referencesApplicationDomain”)。

我的 web.xml:

<web-app ..>
    ...
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>referencesApplicationDomain</realm-name>
    </login-config>
    <security-role>
        <role-name>authenticated</role-name>
    </security-role>
    <security-role>
        <role-name>anonymous</role-name>
    </security-role>
    <security-constraint>
        <web-resource-collection>
            ....
        </web-resource-collection>
    </security-constraint>
        <auth-constraint>
            <role-name>authenticated</role-name>
        </auth-constraint>
    </security-constraint>
...
</web-app>

我的 jboss-web.xml:

<jboss-web ...>
    <deny-uncovered-http-methods>false</deny-uncovered-http-methods>
    <context-root>/references</context-root>
    <security-domain>referencesApplicationDomain</security-domain>
</jboss-web>

当然,我们的想法是让我们的应用程序只与 Elytron 一起工作。

但问题是,我看不到在 Elytron 中创建安全域的位置。

我按照Wildfly Elytron Documentation 使用 jboss-cli 创建了安全域和 http 工厂。

当我签入 jboss-cli 时,我看到安全域已创建。

但是,当我尝试启动 Wildfly 服务器时,我收到以下错误:

"WFLYCTL0412: Required services that are not installed:" => [
        "jboss.security.security-domain.referencesApplicationDomain"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.deployment.unit.\"references-war-1.0.11-SNAPSHOT.war\".component.BranchService.CREATE is missing [jboss.security.security-domain.java:/jaas/referencesApplicationDomain]"
    ]

似乎 jboss 正在尝试在旧的安全子系统中而不是 Elytron 中查找安全域。但我不明白为什么?

小备注:我想用ApplicaationRealm,来使用jboss配置文件里面的用户和组。

【问题讨论】:

    标签: java jboss wildfly elytron


    【解决方案1】:

    事实证明,Elytron 不需要这样做(事实上,它仅适用于 Legacy)。所以解决方案只是从 xml 文件中删除这些:

    web.xml

    <web-app ..>
        ...
        <login-config>
            <auth-method>BASIC</auth-method>
            <!--<realm-name>referencesApplicationDomain</realm-name>-->
        </login-config>
    </web-app>
    

    jboss-web.xml:

    <jboss-web ...>
        <deny-uncovered-http-methods>false</deny-uncovered-http-methods>
        <context-root>/references</context-root>
        <!--<security-domain>referencesApplicationDomain</security-domain>-->
    </jboss-web>
    

    这是可行的,因为默认情况下,Wildlfly 的 undertow 系统使用 ApplicationRealm 作为默认安全域。 您可以通过查看您的standalone.xml 来验证这一点。

    【讨论】:

      猜你喜欢
      • 2014-09-15
      • 1970-01-01
      • 1970-01-01
      • 2015-10-29
      • 2017-08-07
      • 1970-01-01
      • 1970-01-01
      • 2012-06-19
      • 2022-09-23
      相关资源
      最近更新 更多