https://kotlinlang.org logo
Title
d

dave

03/23/2020, 6:09 PM
the default jetty implementation will not give you access to the certificates. If you really "need" the cert inside your app (rather than just rejecting requests without it), then I suggest using an RequestContext. OTOH, if you just want to reject, you can write a custom Jetty Handler which will do it and just handle it in that layer
c

Cosmin Victor Celea

03/23/2020, 8:35 PM
So the idea is I only want to accept requests that are signed by a specific certificates provider.
I should do this in a Jetty handler?
Any examples on how to write a custom Jetty handler?
d

dave

03/24/2020, 8:51 AM
Looking at it, we would do this in Jetty using a standard Servlet so try searching for that (I've never done it personally so can't help). Here's the way in which we do it in the lib: https://github.com/http4k/http4k/blob/master/http4k-core/src/main/kotlin/org/http4k/servlet/servlet.kt
c

Cosmin Victor Celea

03/24/2020, 8:59 AM
Thank you David
I have managed to find a way
d

dave

03/24/2020, 8:59 AM
👍
c

Cosmin Victor Celea

03/24/2020, 8:59 AM
val handlerCollection = HandlerCollection()
handlerCollection.addHandler(HelloHandler())
handlerCollection.addHandler(httpHandler?.toJettyHandler())
Thanks for your help and sorry for bothering you so much.
d

dave

03/24/2020, 9:02 AM
@Cosmin Victor Celea it's absolutely fine - it's what we're here for (whenever we're not busy scavanging for food in the local plague-ridden wasteland outside 🙂 )