# Keycloak 17: developing SPI with RestClient dependency

**URL:** <https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275>\
**Category:** Extending the server\
**Created:** [March 14, 2022, 2:29pm UTC](https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275 "2022-03-14T14:29:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrepra](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@andrepra](https://forum.keycloak.org/u/andrepra)\
**Post date:** [March 14, 2022, 2:29pm UTC](https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275/1 "2022-03-14T14:29:23Z")

</div>

Hi  
I’ve developed a SPI that implements UserStorageProvider.  
This provider uses the RestClient to connect an external service. Deploying the SPI on the new version (17) I got an error with only the RestClient class name as message. It seems that Keycloak didn’t find the implementation of the RestClient.  
Looking at the logs I saw that quarkus starts without the features quarkus-rest-client and quarkus-rest-client-jackson.  
Which is the best way to add this dependencies?  
Thanks  
ps  
I tried with either resteasy RestClient either microprofile RestClient

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [March 14, 2022, 2:45pm UTC](https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275/2 "2022-03-14T14:45:34Z")

</div>

As Keycloak 17 doesn‘t use RestEasyClient, it‘s not bundled anymore. Before, with Wildfly, there was a whole bloated application server which had more modules than Keycloak needed. With Quarkus, only the libs which are needed by Keycloak are contained.

You can deploy your custom libraries together with your custom extension to the `/providers` folder of Keycloak. But be careful, the resteasy version in the pom‘s are still on 3.x, while at runtime they are currently 4.7.5.Final!

Alternatively, you can rewrite your extension to use Keycloak‘s `SimpleHttp` class, which provides some simple to use convenience methods for all HTTP verbs. Going this way, you don‘t need additional libs.

---

<div class="post-metadata">

**Author:** ![andrepra](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@andrepra](https://forum.keycloak.org/u/andrepra)\
**Post date:** [March 14, 2022, 3:14pm UTC](https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275/3 "2022-03-14T15:14:34Z")

</div>

I’ve added this libraries, that are the dependecies of resteasy rest client 4.75, and that are missing in the keycloak lib

quarkus-rest-client-jackson  
quarkus-rest-client  
quarkus-apache-httpclient  
quarkus-rest-client-config  
microprofile-rest-client-api  
resteasy-client-microprofile  
resteasy-client-microprofile-base  
resteasy-client,resteasy-client-api  
resteasy-cdi  
httpasyncclient  
httpcore-nio

But I got this error  
ERROR: RESTEASY010615: Unable to obtain ResteasyCdiExtension instance.

---

<div class="post-metadata">

**Author:** ![andrepra](https://avatars.discourse-cdn.com/v4/letter/a/a5b964/32.png) [@andrepra](https://forum.keycloak.org/u/andrepra)\
**Post date:** [March 18, 2022, 9:30am UTC](https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275/4 "2022-03-18T09:30:51Z")

</div>

After many attempts I decided to proceed with the second option, reimplementing my SPI using `SimpleHttp` class

---

<div class="post-metadata">

**Author:** ![yasammez](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/yasammez/32/6712_2.png) [@yasammez](https://forum.keycloak.org/u/yasammez)\
**Post date:** [November 3, 2022, 9:47am UTC](https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275/5 "2022-11-03T09:47:13Z")

</div>

I too gave up on the RestEasyHttpClient after way too many hours. Since we’re using OpenAPI, using `SimpleHttp` was not an option. But seeing that `SimpleHttp` depends on the standard apache httpclient, using the OpenAPI `java` generator with library `apache-httpclient` led to something usable. Request Filters need to be rewritten to Interceptors but apart from that it worked out pretty straightforward.

---

<div class="post-metadata">

**Author:** ![gatschet](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/gatschet/32/4502_2.png) [@gatschet](https://forum.keycloak.org/u/gatschet)\
**Post date:** [December 20, 2022, 1:12pm UTC](https://forum.keycloak.org/t/keycloak-17-developing-spi-with-restclient-dependency/14275/6 "2022-12-20T13:12:20Z")

</div>

I spent also many many hours to get the RestEasyHttpClient way working on Keycloak 19 but ended up in the same “Unable to obtain ResteasyCdiExtension instance” Error. The only way was to use SimpleHttp, which was a terrible mess. No usable documentation for this!  
I still not understand, why there was a ResteasyCdiExtension instance Error. Did anyone get this to work?
