An open API service indexing awesome lists of open source software.

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

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
email

```

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.html

Now restart Openfire and enjoy!