[GO] Bad Multiple Authentication Key setting
Created by: emreakca
Description
Multiple Authentication settings won't work, since the API is setting the same key for multiple Headers.
openapi-generator version
3.1
OpenAPI declaration file content or url
in yaml:
[...]
security:
- ApiKeyAuth1: []
- ApiKeyAuth2: []
[...]
components:
securitySchemes:
ApiKeyAuth1:
type: apiKey
in: header
name: X-Auth-Key-1
ApiKeyAuth2:
type: apiKey
in: header
name: X-Auth-Key-2
in go:
if ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
var key string
if auth.Prefix != "" {
key = auth.Prefix + " " + auth.Key
} else {
key = auth.Key
}
localVarHeaderParams["X-Auth-Key-1"] = key
}
}
if ctx != nil {
// API Key Authentication
if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
var key string
if auth.Prefix != "" {
key = auth.Prefix + " " + auth.Key
} else {
key = auth.Key
}
localVarHeaderParams["X-Auth-Key-2"] = key
}
}