[keycloak-user] Authentication SPI and connection management

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[keycloak-user] Authentication SPI and connection management

Julian Wermes
This post has NOT been accepted by the mailing list yet.

I've followed the instructions from


But instead of changing the existing DS and provider, I added
another one, because I have to implement additional check and/or actions against the data in the second database:

   <subsystem xmlns="urn:jboss:domain:datasources:4.0">
        <datasource jndi-name="java:jboss/datasources/KeycloakDS"
pool-name="KeycloakDS" enabled="true" use-java-context="true">
        <datasource jndi-name="java:jboss/datasources/myDbDS"
pool-name="mydb" enabled="true" use-java-context="true">
   <subsystem xmlns="urn:jboss:domain:keycloak-server:1.1">

      <spi name="connectionsJpa">
         <provider name="default" enabled="true">
         <provider name="mydb" enabled="true">
                 <property name="dataSource"
                 <property name="initializeEmpty" value="false"/>
                 <property name="migrationStrategy" value="validate"/>

Now I can't find this connection provider in the admin console. Only the
default is listed in Server Info > Providers. In the log file I've found initialization of both datasources

 (MSC service thread 1-8) WFLYJCA0001: Bound data source [java:jboss/datasources/KeycloakDS
 (MSC service thread 1-1) WFLYJCA0001: Bound data source [java:jboss/datasources/myDbDS

but only one PersistenceUnit was processed:

HHH000204: Processing PersistenceUnitInfo [
        name: keycloak-default

As result the call

context.getSession().keycloakSession.getProvider(JpaConnectionProvider.class, "default")

does return me an instance of JpaConnectionProvider Class, but the call

context.getSession().keycloakSession.getProvider(JpaConnectionProvider.class, "mydb")

returns null.

Would you suggest possible solution of the problem?

Server Version: 3.1.0.Final

Thank a lot in advance.