[keycloak-dev] Add custom REST paths? New SPI?

Erik Mulder erik.mulder at docdatapayments.com
Mon Dec 7 09:46:39 EST 2015


As some of you might know, our team is busy adding data to the keycloak
system to incorporate some custom authorization information in the
access token.
So far we've successfully extended the JPA entities, Liquibase table
definitions and added a custom mapper to put that data in the access
token. All of this without custom modifications to the original keycloak
sources. This is working great, thanks for the support so far!
I know I've promised some PR's for this and they will come, but first
we'd like to get everything fully working, so we know it's a well
functioning whole.

The last piece of the puzzle is extending the REST services to include
CRUD actions for our custom resources. I've been looking into the way
RESTEasy/JAX-RS works and it seems to me that in the current
implementation there is no way to add extra paths. As I see it now, the
KeycloakApplication class will register some singletons in it's
constructor and that's that. No way to extend or to 'interfere' there.

So my question is: is there any 'official' way to add extra REST paths
to Keycloak?

If not, is it an idea to add this as a new SPI? The current code for
adding root paths in the KeycloakApplication constructor lists:

        singletons.add(new ServerVersionResource());
        singletons.add(new RealmsResource());
        singletons.add(new AdminRoot());

So just plain contructor calls. That seems like an easy target for
'SPI-ing' :-).
Or just leave the current ones 'hardcoded' and add an SPI for custom
extensions.
Your thoughts on this please.

As before, I'm happy to implement this myself, but I'd like to discuss
it first, so a future PR will be honored.




More information about the keycloak-dev mailing list