[keycloak-user] Additional jpaConnectionProvider for UserFederation via database

Stian Thorgersen sthorger at redhat.com
Wed Nov 11 08:12:46 EST 2015


At the moment when the provider is specified in keycloak-server.json we
only load that one provider. If you only need to use the
EntityManagerFactory within your user federation provider you don't need a
JpaConnectionProvider at all. Just create the EntityManagerFactory within
your UserFederationProviderFactory. We only use the JpaConnectionProvider
as we have multiple providers using the same EntityManagerFactory.

On 29 October 2015 at 13:57, Matuszak, Eduard <eduard.matuszak at atos.net>
wrote:

> Hello
>
> 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">
>                     <connection-url>jdbc:oracle:thin:@servername
> :1521:schemaname</connection-url>
> ..
>
> , 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* <eduard.matuszak at atos.net>
> Max-Stromeyer-Straße 116
> 78467 Konstanz
> Germany
> *de.worldline.com* <http://worldline.com/de/1/Home.html>
> *worldline.jobs.de* <http://worldline.jobs.de>
> *facebook.com/WorldlineKarriere*
> <http://www.facebook.com/WorldlineKarriere>
>
>
> 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 * * * * * * * *
>
>
>
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20151111/14d0ab1c/attachment.html 


More information about the keycloak-user mailing list