[keycloak-user] Additional jpaConnectionProvider for UserFederation via database

Matuszak, Eduard eduard.matuszak at atos.net
Thu Oct 29 08:57:50 EDT 2015


I am trying to implement a userfederation-provider based on a jpa-connection. My approach was:

According to an additional datasource-defintion for  the federated DB in the standalone.xml

                <datasource jta="true" jndi-name="java:jboss/datasources/CCPDS" pool-name="CCPDS" enabled="true" use-ccm="true">

, I tried to register this datasource as an additional connectionJpa-entry in keycloak-server.json as follows:

    "connectionsJpa": {
        "default": {
            "dataSource": "java:jboss/datasources/CCPKCDS",
            "databaseSchema": "update"
        "FED-DB": {
            "dataSource": "java:jboss/datasources/CCPDS"

According to these configuration I hoped to be able to establish the appropriate entity manager by coding:

        // Get the appropriate entity manager from the KeycloakSession
        EntityManager em = session.getProvider(JpaConnectionProvider.class, "FED-DB").getEntityManager();

This did not work, indeed there is still only one (default) JpaConnectionProvider available in the session (JpaConnectionProviderList size is 1):

        Set<JpaConnectionProvider> JpaConnectionProviderList = session.getAllProviders(JpaConnectionProvider.class);

My question is: isn't it in principle possible to register a second jpaConnector additionally to the default one or is there something missing or wrong in my approach?

Thanks for any help in advance.

Best regards, Eduard Matuszak

Dr. Eduard Matuszak

Worldline, an atos company
T  +49 (211)399 398 63
M +49 (163)166 23 67
F +49(211) 399 22 430
eduard.matuszak at atos.net<mailto:eduard.matuszak at atos.net>
Max-Stromeyer-Straße 116
78467 Konstanz

Worldline GmbH
Geschäftsführer: Wolf Kunisch
Aufsichtsratsvorsitzender: Christophe Duquenne
Sitz der Gesellschaft: Frankfurt/Main
Handelsregister: Frankfurt/Main HRB 40 417

* * * * * * * * L E G A L D I S C L A I M E R * * * * * * * *
This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail by error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the internet, the Atos group liability cannot be triggered for the message content. Although the sender endeavors to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and shall not be liable for any damages resulting from any virus transmitted.
* * * * * * * * L E G A L D I S C L A I M E R * * * * * * * *

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151029/379d202f/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture (Device Independent Bitmap) 1.jpg
Type: image/jpeg
Size: 1226 bytes
Desc: Picture (Device Independent Bitmap) 1.jpg
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20151029/379d202f/attachment-0002.jpg 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture (Device Independent Bitmap) 2.jpg
Type: image/jpeg
Size: 2886 bytes
Desc: Picture (Device Independent Bitmap) 2.jpg
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20151029/379d202f/attachment-0003.jpg 

More information about the keycloak-user mailing list