简体   繁体   中英

Wildfly 26 elytron security domain config is not working

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM