https://kotlinlang.org logo
Title
m

mmaillot

09/27/2019, 4:10 PM
Hello, there is way to protect a route with an API-KEY header?
d

Dennis Schröder

09/27/2019, 4:21 PM
m

mmaillot

09/27/2019, 4:22 PM
Yes, but it's for authentication and return a UserIdPrincipal. Here, I just want to check if the api-key header is set and the value is valid.
d

Dennis Schröder

09/27/2019, 4:29 PM
This sounds like a custom pipeline intercepter
m

mmaillot

09/27/2019, 4:37 PM
it looks like, thank @Dennis Schröder!
d

Dennis Schröder

09/27/2019, 4:41 PM
You’re welcome
k

Kevin Schmeichel

09/27/2019, 5:25 PM
the UserIdPrincipal doesn't actually have to be a real user id...
you could just return
UserIdPrincipal(apiKey)
b

Bino

05/25/2020, 6:20 PM
@mmaillot Sorry to bother you in this old thread, but how did you solve it?