forked from loafle/openapi-generator-original
[csharp][generichost] Allow multiple auth methods of same type (#17129)
* allow multiple auth methods of same type * allow multiple auth methods of same type
This commit is contained in:
@@ -262,6 +262,7 @@ paths:
|
||||
description: Pet not found
|
||||
security:
|
||||
- api_key: []
|
||||
- api_key_query: []
|
||||
summary: Find pet by ID
|
||||
tags:
|
||||
- pet
|
||||
|
||||
@@ -410,6 +410,10 @@ namespace Example
|
||||
config.AddApiKey("api_key", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// config.AddApiKeyPrefix("api_key", "Bearer");
|
||||
// Configure API key authorization: api_key_query
|
||||
config.AddApiKey("api_key_query", "YOUR_API_KEY");
|
||||
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
|
||||
// config.AddApiKeyPrefix("api_key_query", "Bearer");
|
||||
|
||||
var apiInstance = new PetApi(config);
|
||||
var petId = 789L; // long | ID of pet to return
|
||||
@@ -463,7 +467,7 @@ catch (ApiException e)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
[api_key](../README.md#api_key), [api_key_query](../README.md#api_key_query)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
|
||||
@@ -1461,6 +1461,11 @@ namespace Org.OpenAPITools.Api
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key"));
|
||||
}
|
||||
// authentication (api_key_query) required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query")))
|
||||
{
|
||||
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query")));
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
var localVarResponse = this.Client.Get<Pet>("/pet/{petId}", localVarRequestOptions, this.Configuration);
|
||||
@@ -1534,6 +1539,11 @@ namespace Org.OpenAPITools.Api
|
||||
{
|
||||
localVarRequestOptions.HeaderParameters.Add("api_key", this.Configuration.GetApiKeyWithPrefix("api_key"));
|
||||
}
|
||||
// authentication (api_key_query) required
|
||||
if (!string.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key_query")))
|
||||
{
|
||||
localVarRequestOptions.QueryParameters.Add(Org.OpenAPITools.Client.ClientUtils.ParameterToMultiMap("", "api_key_query", this.Configuration.GetApiKeyWithPrefix("api_key_query")));
|
||||
}
|
||||
|
||||
// make the HTTP request
|
||||
var localVarResponse = await this.AsynchronousClient.GetAsync<Pet>("/pet/{petId}", localVarRequestOptions, this.Configuration, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
Reference in New Issue
Block a user