Open tnoborio opened 3 years ago
I am afraid this is not possible.
Given that the need for authentication is defined dynamically per route from the spec, we don't authenticate before we get a chance to match the route.
Dealing with a spec that determines which endpoints are subject to authentication is very different from doing it manually by injecting, say, some authentication middleware at the top of your routing tree or on a subtree.
I would like to output the Principal to the log if the authentication is successful. when the API routing exists, I could log it out by writing the following.
However, when the routing is not hit, the middleware handler is not called.
https://github.com/go-openapi/runtime/blob/master/middleware/router.go#L82-L88
Is there any way to deal with this?