{"id":18330321,"url":"https://github.com/rsatrio/keycloak-federation-existingdb","last_synced_at":"2025-04-06T01:33:03.904Z","repository":{"id":208393506,"uuid":"471689686","full_name":"rsatrio/Keycloak-Federation-ExistingDB","owner":"rsatrio","description":"Keycloak Custom Module for User Federation with Existing DB","archived":false,"fork":false,"pushed_at":"2023-11-21T08:26:10.000Z","size":14,"stargazers_count":50,"open_issues_count":2,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T15:41:57.930Z","etag":null,"topics":["java","keycloak","keycloak-spi"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rsatrio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-03-19T12:31:18.000Z","updated_at":"2025-03-18T11:54:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"29480710-a0f4-4518-b04e-fc431d57b0f1","html_url":"https://github.com/rsatrio/Keycloak-Federation-ExistingDB","commit_stats":null,"previous_names":["rsatrio/keycloak-federation-existingdb"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsatrio%2FKeycloak-Federation-ExistingDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsatrio%2FKeycloak-Federation-ExistingDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsatrio%2FKeycloak-Federation-ExistingDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rsatrio%2FKeycloak-Federation-ExistingDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rsatrio","download_url":"https://codeload.github.com/rsatrio/Keycloak-Federation-ExistingDB/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423460,"owners_count":20936621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","keycloak","keycloak-spi"],"created_at":"2024-11-05T19:21:41.212Z","updated_at":"2025-04-06T01:33:03.897Z","avatar_url":"https://github.com/rsatrio.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Keycloak User Federation From Existing Database\n\nA simple example of creating custom User Federation module for keycloak. Tested on KeyCloak 11.0.2 with Java 8.\n\n## Features\n- Can connect with existing database in any database (as long JDBC can connect to it)\n- Using Email as Login-name\n- Enter query to get password in existing database, based on email\n- Enter query to get several user attribute in existing database, based on email\n\n\n## Build\n- Edit the \"keycloak.version\" properties to the keycloak version you are using. In this example we use version 11.0.2\n- Use mvn package to build the module into jar file\n\n\u003e mvn package\n\n## Installation into KeyCloak\n- Add new jdbc driver and datasource in KeyCloak's Wildfly. For mysql, you can follow these configuration example:\n[https://www.tutorialsbuddy.com/keycloak-mysql-setup](https://www.tutorialsbuddy.com/keycloak-mysql-setup)\n- Put the .jar file into standalone/deployments folder of keycloak. And then start/restart keycloak\n\n## Configuration in KeyCloak\n- Goto your realm, and then choose User Federation\n- Choose Add Provider, and select \"Federation DB Provider\"\n- Configure these mandatory settings:\n\t- Database JNDI name: The JNDI name of the datasource you want to use (example: java:jboss/datasources/UserDS)\n\t- Query to Get Password by Email: The query used to get password from the table. Only one column permitted(example:\n\tselect password from wp_users where email=?)\n\t- Query to Get User Data: Query to get the user data to be imported to keycloak. Only two columns permitted and the name have to be email and firstName (example:select  email,nama as firstName from wp_users where email=?)\n\t- Klik save\n\t- We are done, you can try to login in the realm's client with username/password from existing DB  \n\n## Blog\nYou can freely posted any qeustions about this repository on [this medium blog](https://mrizkysatrio.medium.com/keycloak-integration-with-existing-database-587c119db3ae).\n\n\n## Feedback\nFor feedback, please raise issues in the issue section of the repository. Periodically, I will update the code. Enjoy!!.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsatrio%2Fkeycloak-federation-existingdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frsatrio%2Fkeycloak-federation-existingdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frsatrio%2Fkeycloak-federation-existingdb/lists"}