https://github.com/jesty/openfire-keycloak
A simple integration to use Keycloak with Openfire
https://github.com/jesty/openfire-keycloak
Last synced: 2 months ago
JSON representation
A simple integration to use Keycloak with Openfire
- Host: GitHub
- URL: https://github.com/jesty/openfire-keycloak
- Owner: jesty
- License: apache-2.0
- Created: 2016-10-04T21:14:56.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-09T11:33:25.000Z (about 8 years ago)
- Last Synced: 2025-01-25T21:11:31.699Z (4 months ago)
- Language: Java
- Size: 7.4 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# openfire-keycloak
A simple integration to use Keycloak with Openfire# Setup:
* Download the JAR in dist folder or, if you prefer, build the project.
* Download the database driver that you use for Keycloak.
* Copy the 2 jars to lib/ folder in your openfire distribution.
* Create a realm named `Openfire` and a client named `test` on Keycloak.
* Create an admin user in this realm, to ensure that you can access the Openfire admin console.
* Download your keycloak.json from Keycloak Admin console and copy in lib/ folder. The file should be like:
```json
{
"realm": "Openfire",
"auth-server-url": "http://localhost:8280/auth",
"resource": "test",
"credentials": {
"secret": "19b0c4f6-d7b6-4340-ad7d-35c2eefc41ec"
}
}
```
To connect to Keycloak I used Authorization Services, more information could be read at https://keycloak.gitbooks.io/authorization-services-guide/content/v/2.2/topics/service/client-api.html
* Open openfire.xml and configure as below:
```xml
com.nutcore.openfirekeycloak.KeyloackAuthProvider
org.jivesoftware.openfire.user.JDBCUserProvider
org.postgresql.Driver
jdbc:postgresql://localhost/keycloak?user=keycloak&password=keycloak
SELECT username, email FROM user_entity where realm_id = 'Openfire' and username=?
SELECT COUNT(*) FROM user_entity where realm_id = 'Openfire'
SELECT username FROM user_entity where realm_id = 'Openfire'
SELECT username FROM user_entity where realm_id = 'Openfire' and
username
username
```The AuthProvider connect to Keycloak and authenticate the user, while the UserProvider connect directly to Keycloak database. In future I can use the Keycloak Admin api instead of direct connection.
More information about JDBCUserProvider could be read at http://web.mit.edu/ghudson/dev/openfire/documentation/docs/db-integration-guide.htmlNow restart Openfire and enjoy!