[keycloak-dev] Add your custom Spi to the Keycloak session?

Erik Mulder erik.mulder at docdatapayments.com
Mon Nov 23 10:54:05 EST 2015


We are extending KeyCloak with some custom functionality and we like to
add an extra org.keycloak.provider.Spi and 'piggy-back' on the
KeycloakSession.getProvider mechanism at various places. So we added a
org.keycloak.provider.Spi file in the META-INF/services of our provider
jar with the Spi implementation we made. But unfortunately, it's not
picked up by the DefaultKeycloakSessionFactory, since the classloader
that is used in ServiceLoader.load (DefaultKeycloakSessionFactory:56)
doesn't have the custom provider jars in scope. Is this intentional?

I can understand if you don't want some external Spi 'entering' the
KeyCloak system. On the other hand, that's the 'own risk' of the
developer creating it. We would like this constraint lifted if possible.
If not, is there another way we can get our own Spi's added to the
keycloak session without changing any KeyCloak sources? Like using a
module instead of a 'plain' provider jar? Are these added modules in
scope of the DefaultKeycloakSessionFactory classloader?




More information about the keycloak-dev mailing list