Skip to content

Commit

Permalink
[go-experimental] Support aliasing of API keys (#4940)
Browse files Browse the repository at this point in the history
* [go-experimental] Support aliasing of API keys

* Use {{.}} inside condition

* Use name instead of keyParamName for lookup

* x-lookup to x-auth-id-alias
  • Loading branch information
jirikuncar authored Mar 1, 2020
1 parent 10d5d27 commit 35e90a5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (r api{{operationId}}Request) Execute() ({{#returnType}}{{{.}}}, {{/returnT
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if auth, ok := auth["{{keyParamName}}"]; ok {
if auth, ok := auth["{{#vendorExtensions.x-auth-id-alias}}{{.}}{{/vendorExtensions.x-auth-id-alias}}{{^vendorExtensions.x-auth-id-alias}}{{name}}{{/vendorExtensions.x-auth-id-alias}}"]; ok {
var key string
if auth.Prefix != "" {
key = auth.Prefix + " " + auth.Key
Expand Down

0 comments on commit 35e90a5

Please sign in to comment.