Trying to send http rest request from keycloak X user storage spi to an external api

Hey
we just started using keycloak x quarkus distribution, and we have made a user storage and user federation spi.
they problem we are facing now is that we are unable to configure our spi in keycloak.properties to set up rest client to send request to an external quarkus api.

before moving to keycloak x we used to use unirest to send http rest requests, but since we moved to the quarkus distribution we started to use quarkus-rest-client dependency (which we use in all of our quarkus applications)

when we startup the keycloak x locally we get the following log

Unrecognized configuration key "quarkus.rest-client."path-to-rest-client-class".url" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo

which indicate to that keycloak x is unable to use the following dependency:

        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-rest-client</artifactId>
        </dependency>

and unable to convert the following property in keycloak.properties quarkus.rest-client."path-to-rest-client-class".url to a property in keycloak behind the scene.

we have look at the following Keycloak.X Server Configuration which explain in details about the rules we should follow in order to write configurations in keycloak.properties, and its says that keycloak should have a custom config property for each quarkus property unless it was considered an advanced usage and not supported configuration
so is there an equivalent config property for that? and what is the best way to send a http request from quarkus based user storage spi to an external api?

Please don’t use outdated documentation on a github repo, which was never meant as documentation, but only a draft discussion. Use the official documentation from the keycloak.org website.

For simple and easy HTTP client usage, I suggest to use the SimpleHttp class provided by Keycloak. Perhaps it’s not as convenient as the Quarkus client, but it’s completely maintained by Keycloak, all of the lifecycle and configuration, etc. It’s the preferred way of implementing outgoing HTTP calls.

1 Like

thanks for your help.
i am trying to use SimpleHttp but i couldn’t find a maven dependency that i can put in pom file!?
also am i able to write custom properties like greeting.message=hello in keycloak.properties and then get it in the code?

I think you should read the Server Developer Documentation first, to get an understanding, how to extend Keycloak.

1 Like

i am trying to bring a config property like greeting.message from keycloak.properties to the spi code, is it possible? if so, How?
we need this because also we have few environment variables that we need to inject in the spi, so if that possible too, what is the right way to do it?
@dasniko