[keycloak-user] User Storage SPI for multiple db

Ilya Korol llivezking at gmail.com
Thu Apr 20 20:50:57 EDT 2017


As you can see in docs and examples there two main interfaces for 
implementing User Storage Providers (USP):

UserStorageProvider and UserStorageProviderFactory, so any DAO should be 
initialized within USPFactory concrete class and then be injected to 
UserStorageProvider object within create() method of Fabric class.

For connecting with MySQL you could use any libraries as you usually do 
it in other applications, but there could be some troubles with 
packaging, because by default you lib jars(MySQL connectors etc.) will 
not be linked with your USP, so for testing convenience you could add 
those libs as modules to wildfly (where keycloak runs) and refer to them 
in dependencies from USP deployment descriptor. Google jar module.xml 
wildfly.


On 20.04.2017 20:15, rohit chaudhary wrote:
> Hi,
>
> Each db contains users which can be merged on basis of username. But I 
> can't find an example to connect to mysql server using User storage 
> SPI, being a newbie basically I'm having doubts on how to connect to 
> mysql db.
>
> Thanks,
> Rohit
>
> On Wed, Apr 19, 2017 at 5:40 PM, Король Илья <llivezking at gmail.com 
> <mailto:llivezking at gmail.com>> wrote:
>
>     Hi. If every of your apps has separate users db what do you want
>     to have
>     in ideal circumstances? Do you databases include equal users? For
>     example if you want to have "merged" user storage you could implement
>     custom user storage for every db, so when user would be redirected to
>     keycloak for login, keycloak will consecutively try to extract
>     user data
>     from this user storages. And you will have opportunity to set
>     priorities
>     of this storages in keycloak admin console.
>
>     As for examples you should check examples from git repo and also
>     carefully read tutorial in docs.
>
>     Also your implementations could have ability to create users in
>     keycloak
>     itself on the fly while extracting users from user storages (so later
>     you will have merged user db in keycloak). Dee details in docs (Server
>     development -> User Storage Spi -> Import Implementation Strategy).
>
>
>     19.04.2017 11:35, rohit chaudhary пишет:
>     > Hi,
>     >
>     > I am implementing Keycloak SSO for Django and .NET apps. I have
>     a doubt on
>     > how to go with the user database. All apps have separate db. How to
>     > proceed? Need some suggestions and please refer some examples of
>     custom
>     > user storage SPI.
>     >
>     > Thanks,
>     > Rohit
>     > _______________________________________________
>     > keycloak-user mailing list
>     > keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
>     > https://lists.jboss.org/mailman/listinfo/keycloak-user
>     <https://lists.jboss.org/mailman/listinfo/keycloak-user>
>
>     _______________________________________________
>     keycloak-user mailing list
>     keycloak-user at lists.jboss.org <mailto:keycloak-user at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/keycloak-user
>     <https://lists.jboss.org/mailman/listinfo/keycloak-user>
>
>



More information about the keycloak-user mailing list