Reputation: 485
We are looking to use Keycloak as an identity management system. What is the best way to get Keycloak to use a custom messaging protocol (that is not HTTP)? I'm looking at the Keycloak Server Developer Guide section about extending the server by adding a custom SPI. Is this the correct way to do this?
Upvotes: 1
Views: 200
Reputation: 5632
Yes. I would implement SPI and the corresponding ProviderFactory and Provider, as you've mentioned.
In the past, I wrote a Kafka listener that picks messages off of a topic using this SPI strategy, and it works quite nicely. You'll need to do the following to get it to work:
META-INF/services/org.keycloak.provider.Spi
ProviderFactory
in META-INF/services
and add your provider factory impl class theremodule.xml
config in the same directory as above. You'll need to add dependencies as appropriate here. Since you're implementing a custom protocol, you'll probably need to add a module containing that library and add it as a dependency. For example, I had to add kafka-clients.jar as a separate module and then list it as a dependency in my custom provider.standalone.xml
and/or standalone-ha.xml
to add the provider (see the existing <providers>
block under the keycloak-server subsystem). Keycloak has some documentation on how to do this.Upvotes: 1