Wildfly 26 elytron 安全域配置不起作用

发布于 2025-01-09 14:43:38 字数 2362 浏览 1 评论 0 原文

我正在尝试将应用程序迁移到 wildfly 26,并且我正在尝试使用 elytron 来保护该应用程序。

我使用 jboss cli 成功运行此命令

/subsystem=elytron/jdbc-realm=myapp-security-realm:add(principal-query=[{sql="select clave from admin.usuario where usuario = ?", data-source="SISMedicalDS", simple-digest-mapper={algorithm=simple-digest-sha-256,password-index=1}},{sql="select r.nombre, 'Roles' from admin.rol r join admin.perfil p on r.id = p.rol_id join admin.usuario u on u.id = p.usuario_id where u.usuario = ?", data-source="SISMedicalDS", attribute-mapping=[{index=1, to=roles}]}])

/subsystem=elytron/security-domain=myapp-security-domain:add(realms=[{realm=myapp-security-realm}], default-realm=myapp-security-realm, permission-mapper=default-permission-mapper)

/subsystem=elytron/http-authentication-factory=myapp-security-http:add(http-server-mechanism-factory=global, security-domain=myapp-security-domain, mechanism-configurations=[{mechanism-name=FORM}])

/subsystem=undertow/application-security-domain=myapp-application-security-domain:add(http-authentication-factory=myapp-security-http)

并且我还将 jboss-web.xml 和 web.xml 文件更改为建议的配置

jboss-web.xml

<!DOCTYPE jboss-web>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/schema/jbossas/jboss-web_13_0.xsd"
               version="13.0">
    <security-domain>nmedical-application-security-domain</security-domain>
</jboss-web>

web.xml (仅登录配置)

<login-config>
        <auth-method>FORM</auth-method>
        <realm-name>nmedical-application-security-domain</realm-name>       
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/login.jsp?error=true</form-error-page>
        </form-login-config>
    </login-config>

当我尝试在wildfly 26 服务器我总是收到此错误

"WFLYCTL0412: Required services that are not installed:" => ["jboss.security.security-domain.myapp-application-security-domain"]

我检查了服务器控制台,在 web (undertow) 子系统下我可以看到 myapp-application-security-domain 存在,所以我真的不知道问题可能是什么

任何帮助表示赞赏

I am trying to migrate an application to wildfly 26, and i am trying to use elytron to secure the application.

I successfully run this commands using the jboss cli

/subsystem=elytron/jdbc-realm=myapp-security-realm:add(principal-query=[{sql="select clave from admin.usuario where usuario = ?", data-source="SISMedicalDS", simple-digest-mapper={algorithm=simple-digest-sha-256,password-index=1}},{sql="select r.nombre, 'Roles' from admin.rol r join admin.perfil p on r.id = p.rol_id join admin.usuario u on u.id = p.usuario_id where u.usuario = ?", data-source="SISMedicalDS", attribute-mapping=[{index=1, to=roles}]}])

/subsystem=elytron/security-domain=myapp-security-domain:add(realms=[{realm=myapp-security-realm}], default-realm=myapp-security-realm, permission-mapper=default-permission-mapper)

/subsystem=elytron/http-authentication-factory=myapp-security-http:add(http-server-mechanism-factory=global, security-domain=myapp-security-domain, mechanism-configurations=[{mechanism-name=FORM}])

/subsystem=undertow/application-security-domain=myapp-application-security-domain:add(http-authentication-factory=myapp-security-http)

And i also changed my jboss-web.xml and web.xml files to the suggested configuration

jboss-web.xml

<!DOCTYPE jboss-web>
<jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/schema/jbossas/jboss-web_13_0.xsd"
               version="13.0">
    <security-domain>nmedical-application-security-domain</security-domain>
</jboss-web>

web.xml (login config only)

<login-config>
        <auth-method>FORM</auth-method>
        <realm-name>nmedical-application-security-domain</realm-name>       
        <form-login-config>
            <form-login-page>/login.jsp</form-login-page>
            <form-error-page>/login.jsp?error=true</form-error-page>
        </form-login-config>
    </login-config>

When i try to deploy the application in the wildfly 26 server i always get this error

"WFLYCTL0412: Required services that are not installed:" => ["jboss.security.security-domain.myapp-application-security-domain"]

I have checked the server console and under the web (undertow) subsystem i can see that the myapp-application-security-domain exists, so i really don't know what the problem might be

Any help appreciated

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一桥轻雨一伞开 2025-01-16 14:43:38

命名空间 jboss.security.security-domain 与旧安全相关,而不是 Elytron。 Elytron 可能未在某些资源中启用,并且该资源将 myapp-application-security-domain 引用为旧安全域,并且会引发错误。

the namespace jboss.security.security-domain is related to the legacy security and not Elytron. Elytron is probably not enabled in some resource and that resource is referring to the myapp-application-security-domain as a legacy security domain and the error gets thrown.

星軌x 2025-01-16 14:43:38

感谢 diavil 的回复和这篇文章,我终于让它工作了:

如何配置 Elytron

我最终做的是在 ejb3 和 undertow 子系统中配置名为 other 的安全配置;这不是我太喜欢的解决方案,但它就是这样

I finally have it working thanks to diavil response and this post:

How to configure Elytron

What i ended up doing was configuring the security config named other both in the ejb3 and undertow subsystem; it's not a solution that i like too much but it is what it is

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文