Problems with Wildfly 11 (Database Identity Store)
samerjamal Nov 22, 2017 6:31 AMIm migrating from version 10 to 11.
This part of the configuration has changed a lot, I'm following this link https://docs.jboss.org/author/display/WFLY/WildFly+Elytron+Security#WildFlyElytronSecurity-RealmMappers
And the following error is occurring when deploying:
Error:
09:02:28,630 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "labcontrol.war")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.security.security-domain.labcontrolRealm"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.deployment.unit.\"labcontrol.war\".component.TamanhoDAO.CREATE is missing [jboss.security.security-domain.labcontrolRealm]",
Configure a datasource:
standalone.xml
<datasource jta="true" jndi-name="java:/labcontrolDS" pool-name="labcontrolDS" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:mysql://127.0.0.1:3306/labcontrol</connection-url>
<driver>mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
Configure a jdbc-realm in WildFly:
standalone.xml
<jdbc-realm name="exampleDbRealm">
<principal-query sql="SELECT u.senha FROM labcontrol.usuario u INNER JOIN labcontrol.email e ON u.email_id = e.id where e.email=?" data-source="labcontrolDS">
<clear-password-mapper password-index="1"/>
</principal-query>
<principal-query sql="SELECT p.nome, 'Roles' FROM labcontrol.permissao p INNER JOIN labcontrol.gruposistema_permissao gr ON p.id = gr.permissao_id INNER JOIN labcontrol.usuario_gruposistema ug ON gr.gruposistema_id = ug.gruposistema_id INNER JOIN labcontrol.usuario u ON ug.usuario_id = u.id INNER JOIN email e ON u.email_id = e.id WHERE e.email=?" data-source="labcontrolDS">
<attribute-mapping>
<attribute to="groups" index="1"/>
</attribute-mapping>
</principal-query>
</jdbc-realm>
Configure a security-domain:
standalone.xml
<security-domain name="exampleDbSD" default-realm="exampleDbRealm" permission-mapper="default-permission-mapper">
<realm name="exampleDbRealm" role-decoder="groups-to-roles"/>
</security-domain>
Configure an http-authentication-factory:
standalone.xml
<http-authentication-factory name="example-db-http-auth" http-server-mechanism-factory="global" security-domain="exampleDbSD">
<mechanism-configuration>
<mechanism mechanism-name="FORM">
<mechanism-realm realm-name="exampleDbSD"/>
</mechanism>
</mechanism-configuration>
</http-authentication-factory>
Configure an application-security-domain in the Undertow subsystem:
standalone.xml
<application-security-domains>
<application-security-domain name="labcontrolRealm" http-authentication-factory="example-db-http-auth"/>
</application-security-domains>
Configure my application jboss-web.xml:
jboss-web.xml
<jboss-web>
<context-root>labcontrol</context-root>
<security-domain>labcontrolRealm</security-domain>
</jboss-web>
Configure my application web.xml
web.xml
<login-config>
<auth-method>FORM</auth-method>
<realm-name>labcontrolRealm</realm-name>
<form-login-config>
<form-login-page>/login.xhtml</form-login-page>
<form-error-page>/login.xhtml</form-error-page>
</form-login-config>
</login-config>
Tks for help