有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Wildfly安全子系统:从Legacy迁移到Elytron,未找到securitydomain

我正在尝试将一个项目从使用遗留安全性迁移到使用Elytron安全性

到目前为止(遗留),认证工作所需的全部工作就是在子系统中创建一个安全域->;具有正确名称的安全性(“referencesApplicationDomain”)

我的网络。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网站。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中找到安全域。但我不明白为什么

小注:我想使用applicationrealm,使用jboss配置文件中的用户和组


共 (1) 个答案

  1. # 1 楼答案

    事实证明,这对于爱丽特龙来说是不必要的(事实上,这只是为了遗产)。因此,解决方案只是从xml文件中删除以下内容:

    网络。xml

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

    jbossweb。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作为默认安全域。 您可以通过查看单机版来验证这一点。xml