Tapir Generated documentation behind proxy which handles authorization

Hello,

I am generating documentation for an API with Tapir and the service sits behind a gateway (kong), which already handles the authx and authz portions of every request used in the API.

It’s a bearer token flow - so the gateway validates/extracts the token, and puts the pertinent user information into headers before proxying the request to my scala application which hosts the API via tapir.
I’m wondering if there is a good way to generate the authentication logic with the rest of the documentation of my endpoints without impacting the endpoints at all?

So I want the documentation to indicate that the user should send along the bearer token Authorization: Bearer ${TOKEN} but i don’t want the endpoint to actually handle a bearer token since that will be dealt with by the gateway before the request reaches the app… hoping that makes sense?

I think it’s easiest to pass an amended list of endpoints to the documentation interpreter.

Sth like:

val myEndpoints: List[ServerEndpoint[Any, F]] = ...

val endpointsForDocs = myEndpoints.map(_.endpoint).map(_.in(auth.bearer[String]))
val swaggerEndpoints = SwaggerInterpreter().fromEndpoints[F](endpointsForDocs, "My App", "1.0")

Yessss! i’ve been playing around with stuff like this and wasn’t sure if it was “right”.

This is exactly what i needed!

Thank you!