Open gcastillo-bakkt opened 3 years ago
If the info is in the http context object, you can access it. https://github.com/go-swagger/go-swagger/blob/b49f50b58d021e303ce819ab8310add9bad3a99d/examples/auto-configure/restapi/operations/todos/destroy_one_parameters.go#L29
HTTPRequest.Context()
Can give you the context, and extract the values in side.
Thank you for this, I'm using an untyped api though. With this workflow I don't the RequestBinder interface comes into play.
principal := middleware.SecurityPrincipalFrom(req)
should do the job.
Other information is stored in the request context can be extracted with similar helpers:
Hi, i'm trying to figure out a way to get the Principal or request context from within the OperationHandler. I need to be able to take the caller's credentials to make a call to a downstream system. Right now, I am able to work around this by defining the api_key as a header parameter but that doesn't play well with swagger-ui and other tools.