keycloak

Using a Database as Provider for Keycloak Application Realm


I'm currently storing my users' credentials in a RDBMs and using a set of libraries to generate and check JWT Tokens, upon user verification. I'd like to replace those libraries with Keycloak. However I cannot find a RDBMs as provider in Keycloak.

My understanding is that Keycloak does uses a Database but for storing the Realms data. I'd like to keep using my own DB for the credentials. Any suggestion or example how to do it? Should I create a custom Keycloak Provider and perform credentials check there?

Thanks a lot


Solution

  • To perform user federation you need to implement a main Class org.keycloak.storage.UserStorageProvider and a set of extra interfaces for locating or managing users.

    Also, you need to define the Entity Classes mapping the Storage Schema where Users are available for each Client and Realm. You can find a quickstart and detailed example here: Keycloak Database User Federation