oapi-codegen icon indicating copy to clipboard operation
oapi-codegen copied to clipboard

Gin authentication

Open apachejuice opened this issue 3 years ago • 1 comments

Is it possible to use securitySchemes with gin? It appears there are only functions to create echo middleware for this. What I found from the documentation is something along the lines of this:

validator := middleware.OapiRequestValidatorWithOptions(
	spec,
	&middleware.Options{
		Options: openapi3filter.Options{
			AuthenticationFunc: authFn,
		},
	},
)

The obvious issue here is that validator is of type echo.MiddlewareFunc which ostensibly does not work with gin routers. How to do this with gin?

apachejuice avatar Oct 30 '22 16:10 apachejuice

Yep, there's Gin middleware which should work with what you want? (example)

jamietanna avatar Nov 13 '22 18:11 jamietanna