[keycloak-user] Outbound SSL Connection in SPI

Dmitry Telegin dt at acutus.pro
Wed Jul 25 20:32:25 EDT 2018


Hi Henning,

The HttpClientProvider scenario is more correct. But can you try session.getProvider(HttpClientProvider.class), instead of creating it manually? Does it make any difference?

If no, what does session.getProvider(TruststoreProvider.class) return?

If it is null, the next question I'm going to ask you will be "do you know how to attach debugger to you Keycloak process?" :)

Cheers,
Dmitry Telegin
CTO, Acutus s.r.o.
Keycloak Consulting and Training

Pod lipami street 339/52, 130 00 Prague 3, Czech Republic
+42 (022) 888-30-71
E-mail: info at acutus.pro

On Wed, 2018-07-25 at 09:45 +0200, Henning Waack wrote:
> Any input on this? Kinda stuck with this issue... Thanks!
> 
> Am 24. Juli 2018 um 11:18 schrieb Henning Waack <
> henning.waack at codecentric.de>:
> 
> > Hi.
> > 
> > I am implementing a custom OIDC Protocol Mapper. Within I have to make a
> > https connection, which currently fails because I do not have a truststore
> > configured on my http connection.
> > 
> > I have added a truststore SPI to my standalone.xml:
> > 
> >             <spi name="truststore">
> >                 <provider name="file" enabled="true">
> >                     <properties>
> >                         <property name="file" value="${jboss.server.config.
> > dir}/nak.test.jks"/>
> >                         <property name="password" value="****"/>
> >                         <property name="hostname-verification-policy"
> > value="WILDCARD"/>
> >                         <property name="disabled" value="false"/>
> >                     </properties>
> >                 </provider>
> >             </spi>
> > 
> > 
> > But I do not know how to get a HttpClient instance which uses this
> > truststore. I have tried with:
> > 
> > 
> > org.apache.http.client.HttpClient httpClient = new
> > org.keycloak.connections.httpclient.HttpClientBuilder().build();
> > 
> > and
> > 
> > DefaultHttpClientFactory factory = new DefaultHttpClientFactory();
> > HttpClientProvider httpClientProvider = factory.create((
> > KeycloakSession)session);
> > return httpClientProvider.getHttpClient();
> > 
> > whereas the first just does not have the truststore configured, and the
> > second fails with a NPE.
> > 
> > So how do I get an outbound http connection which uses my truststore SPI?
> > 
> > Thanks & greetings
> > 
> > Henning
> > --
> > 
> > 
> > -----------
> > 
> > Henning Waack | IT Consultant
> > 
> > 
> > codecentric AG | Hochstraße 11
> > <https://maps.google.com/?q=Hochstra%C3%9Fe+11%C2%A0+%7C+%C2%A0+42697+Solingen+%C2%A0%7CDeutschland&entry=gmail&source=g>
> > > 
> > 
> > <https://maps.google.com/?q=Hochstra%C3%9Fe+11%C2%A0+%7C+%C2%A0+42697+Solingen+%C2%A0%7CDeutschland&entry=gmail&source=g>
> > 
> > <https://maps.google.com/?q=Hochstra%C3%9Fe+11%C2%A0+%7C+%C2%A0+42697+Solingen+%C2%A0%7CDeutschland&entry=gmail&source=g>42697
> > Solingen
> > <https://maps.google.com/?q=Hochstra%C3%9Fe+11%C2%A0+%7C+%C2%A0+42697+Solingen+%C2%A0%7CDeutschland&entry=gmail&source=g>
> >  |Deutschland
> > <https://maps.google.com/?q=Hochstra%C3%9Fe+11%C2%A0+%7C+%C2%A0+42697+Solingen+%C2%A0%7CDeutschland&entry=gmail&source=g>
> > 
> > 
> > tel: +49 (0)151 108 515 29
> > 
> > www.codecentric.de | blog.codecentric.de | www.meettheexperts.de
> > 
> > Sitz der Gesellschaft: Solingen | HRB 25917 | Amtsgericht Wuppertal
> > 
> > Vorstand: Michael Hochgürtel . Ulrich Kühn . Rainer Vehns
> > Aufsichtsrat: Patric Fedlmeier (Vorsitzender) . Klaus Jäger . Jürgen Schütz
> > 
> > Diese E-Mail einschließlich evtl. beigefügter Dateien enthält vertrauliche
> > und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige
> > Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie
> > bitte sofort den Absender und löschen Sie diese E-Mail und evtl.
> > beigefügter Dateien umgehend. Das unerlaubte Kopieren, Nutzen oder Öffnen
> > evtl. beigefügter Dateien sowie die unbefugte Weitergabe dieser E-Mail ist
> > nicht gestattet.
> > 
> 
> 
> 


More information about the keycloak-user mailing list