From 8594e5f7464fbb70f2e670f11b1debfa052be1fe Mon Sep 17 00:00:00 2001 From: devhl Date: Sun, 15 Mar 2026 16:07:44 -0400 Subject: [PATCH] multiple oauth tokens --- .../DependencyInjectionTests.mustache | 4 +-- ...odels-for-testing-with-http-signature.yaml | 11 +++++++ .../net10/FormModels/api/openapi.yaml | 11 +++++++ .../net10/FormModels/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net10/NullReferenceTypes/api/openapi.yaml | 11 +++++++ .../NullReferenceTypes/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net10/Petstore/api/openapi.yaml | 11 +++++++ .../net10/Petstore/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net10/SourceGeneration/api/openapi.yaml | 11 +++++++ .../SourceGeneration/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net4.7/FormModels/api/openapi.yaml | 11 +++++++ .../net4.7/FormModels/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net4.7/Petstore/api/openapi.yaml | 11 +++++++ .../net4.7/Petstore/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net4.8/FormModels/api/openapi.yaml | 11 +++++++ .../net4.8/FormModels/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net4.8/Petstore/api/openapi.yaml | 11 +++++++ .../net4.8/Petstore/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net8/FormModels/api/openapi.yaml | 11 +++++++ .../net8/FormModels/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net8/NullReferenceTypes/api/openapi.yaml | 11 +++++++ .../NullReferenceTypes/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net8/Petstore/api/openapi.yaml | 11 +++++++ .../net8/Petstore/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net8/SourceGeneration/api/openapi.yaml | 11 +++++++ .../net8/SourceGeneration/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net9/FormModels/api/openapi.yaml | 11 +++++++ .../net9/FormModels/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net9/NullReferenceTypes/api/openapi.yaml | 11 +++++++ .../NullReferenceTypes/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net9/Petstore/api/openapi.yaml | 11 +++++++ .../net9/Petstore/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../net9/SourceGeneration/api/openapi.yaml | 11 +++++++ .../net9/SourceGeneration/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../standard2.0/Petstore/api/openapi.yaml | 11 +++++++ .../standard2.0/Petstore/docs/apis/PetApi.md | 2 +- .../Org.OpenAPITools.Test/Api/ApiTestsBase.cs | 3 ++ .../Api/DependencyInjectionTests.cs | 16 ++++++++-- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++-- .../httpclient/net10/Petstore/README.md | 10 ++++++ .../net10/Petstore/api/openapi.yaml | 11 +++++++ .../httpclient/net10/Petstore/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++++ .../csharp/httpclient/net9/Petstore/README.md | 10 ++++++ .../httpclient/net9/Petstore/api/openapi.yaml | 11 +++++++ .../httpclient/net9/Petstore/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++++ .../httpclient/standard2.0/Petstore/README.md | 10 ++++++ .../standard2.0/Petstore/api/openapi.yaml | 11 +++++++ .../standard2.0/Petstore/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++++ .../csharp/restsharp/net8/Petstore/README.md | 10 ++++++ .../restsharp/net8/Petstore/api/openapi.yaml | 11 +++++++ .../restsharp/net8/Petstore/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 32 +++++++++++++++++++ .../ConditionalSerialization/README.md | 10 ++++++ .../ConditionalSerialization/api/openapi.yaml | 11 +++++++ .../ConditionalSerialization/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 32 +++++++++++++++++++ .../unityWebRequest/net10/Petstore/README.md | 10 ++++++ .../net10/Petstore/api/openapi.yaml | 11 +++++++ .../net10/Petstore/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++++ .../unityWebRequest/net9/Petstore/README.md | 10 ++++++ .../net9/Petstore/api/openapi.yaml | 11 +++++++ .../net9/Petstore/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++++ .../standard2.0/Petstore/README.md | 10 ++++++ .../standard2.0/Petstore/api/openapi.yaml | 11 +++++++ .../standard2.0/Petstore/docs/PetApi.md | 4 ++- .../src/Org.OpenAPITools/Api/PetApi.cs | 12 +++++++ 119 files changed, 987 insertions(+), 112 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache index 6085b51e5e45..db70ca5e7d18 100644 --- a/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/libraries/generichost/DependencyInjectionTests.mustache @@ -76,8 +76,8 @@ namespace {{packageName}}.Test.{{apiPackage}} {{/httpSignatureMethods}} {{#oauthMethods}} - OAuthToken oauthToken = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken{{-index}} = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken{{-index}}); {{/oauthMethods}} {{/lambda.trimTrailingWithNewLine}} diff --git a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml index 2edf96c9c3c3..2abbde0932ad 100644 --- a/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/csharp/petstore-with-fake-endpoints-models-for-testing-with-http-signature.yaml @@ -73,6 +73,9 @@ paths: - petstore_auth: - 'write:pets' - 'read:pets' + - petstore_auth2: + - 'write:pets' + - 'read:pets' requestBody: $ref: '#/components/requestBodies/Pet' put: @@ -1430,6 +1433,14 @@ components: scopes: 'write:pets': modify pets in your account 'read:pets': read your pets + petstore_auth2: + type: oauth2 + flows: + implicit: + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets api_key: type: apiKey name: api-key diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml index 7017affc0b9c..02a7e6c2b775 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3116,6 +3119,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net10/FormModels/docs/apis/PetApi.md index 59d4ef8e6df0..a11953eabd3b 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index aa542fd9c05b..d8908da17343 100644 --- a/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs index 01f96fd91373..21dd4381953d 100644 --- a/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs @@ -849,14 +849,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net10/Petstore/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 20f9ce2ce945..6b52f9352cd5 100644 --- a/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs index 01f96fd91373..21dd4381953d 100644 --- a/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net10/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs @@ -849,14 +849,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml index 7017affc0b9c..02a7e6c2b775 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3116,6 +3119,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md index 59d4ef8e6df0..a11953eabd3b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index c178aac4eabe..dd86930b3b7d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new OAuthToken(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new OAuthToken(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index bbccd77b29c1..f821411614d0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index 0daa375c9f6f..cc9b681f9c33 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index c178aac4eabe..dd86930b3b7d 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new OAuthToken(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new OAuthToken(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index bbccd77b29c1..f821411614d0 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 432c4e94b1f6..af420004026e 100644 --- a/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.7/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml index 7017affc0b9c..02a7e6c2b775 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3116,6 +3119,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md index 59d4ef8e6df0..a11953eabd3b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index c178aac4eabe..dd86930b3b7d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new OAuthToken(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new OAuthToken(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index bbccd77b29c1..f821411614d0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index 0daa375c9f6f..cc9b681f9c33 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index c178aac4eabe..dd86930b3b7d 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new OAuthToken(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new OAuthToken(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index bbccd77b29c1..f821411614d0 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 432c4e94b1f6..af420004026e 100644 --- a/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net4.8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml index 7017affc0b9c..02a7e6c2b775 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3116,6 +3119,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md index 59d4ef8e6df0..a11953eabd3b 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index aa542fd9c05b..d8908da17343 100644 --- a/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs index 01f96fd91373..21dd4381953d 100644 --- a/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs @@ -849,14 +849,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 20f9ce2ce945..6b52f9352cd5 100644 --- a/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs index 01f96fd91373..21dd4381953d 100644 --- a/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net8/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs @@ -849,14 +849,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml index 7017affc0b9c..02a7e6c2b775 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3116,6 +3119,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/PetApi.md index 59d4ef8e6df0..a11953eabd3b 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/PetApi.cs index aa542fd9c05b..d8908da17343 100644 --- a/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/FormModels/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs index 01f96fd91373..21dd4381953d 100644 --- a/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/NullReferenceTypes/src/Org.OpenAPITools/Api/PetApi.cs @@ -849,14 +849,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 20f9ce2ce945..6b52f9352cd5 100644 --- a/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -847,14 +847,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index 03ad026fa146..8108b6df28de 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index 028d71f43359..e7ed8b2af672 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs index 01f96fd91373..21dd4381953d 100644 --- a/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/net9/SourceGeneration/src/Org.OpenAPITools/Api/PetApi.cs @@ -849,14 +849,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md index b42ee516b313..4102dc14f06b 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/docs/apis/PetApi.md @@ -34,7 +34,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs index c178aac4eabe..dd86930b3b7d 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs @@ -76,6 +76,9 @@ public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaul string oauthTokenValue1 = context.Configuration[""] ?? throw new Exception("Token not found."); OAuthToken oauthToken1 = new OAuthToken(oauthTokenValue1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + string oauthTokenValue2 = context.Configuration[""] ?? throw new Exception("Token not found."); + OAuthToken oauthToken2 = new OAuthToken(oauthTokenValue2, timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); } } diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs index bbccd77b29c1..f821411614d0 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs @@ -45,6 +45,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }) .Build(); @@ -67,8 +70,11 @@ public class DependencyInjectionTest HttpSignatureToken httpSignatureToken1 = new HttpSignatureToken(config1, timeout: TimeSpan.FromSeconds(1)); options.AddTokens(httpSignatureToken1); - OAuthToken oauthToken = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); - options.AddTokens(oauthToken); + OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }) .Build(); @@ -96,6 +102,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); }); }) .Build(); @@ -123,6 +132,9 @@ public class DependencyInjectionTest OAuthToken oauthToken1 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); options.AddTokens(oauthToken1); + + OAuthToken oauthToken2 = new OAuthToken("token", timeout: TimeSpan.FromSeconds(1)); + options.AddTokens(oauthToken2); options.AddApiHttpClients(client => client.BaseAddress = new Uri(ClientUtils.BASE_ADDRESS)); }); }) diff --git a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 71b38eb5b6cf..fbe086c29120 100644 --- a/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/generichost/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -846,14 +846,20 @@ public async Task AddPetAsync(Pet pet, System.Threading.Canc oauthTokenLocalVar1.UseInHeader(httpRequestMessageLocalVar, ""); - HttpSignatureToken httpSignatureTokenLocalVar2 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + OAuthToken oauthTokenLocalVar2 = (OAuthToken) await OauthTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); - tokenBaseLocalVars.Add(httpSignatureTokenLocalVar2); + tokenBaseLocalVars.Add(oauthTokenLocalVar2); + + oauthTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, ""); + + HttpSignatureToken httpSignatureTokenLocalVar3 = (HttpSignatureToken) await HttpSignatureTokenProvider.GetAsync(cancellation: cancellationToken).ConfigureAwait(false); + + tokenBaseLocalVars.Add(httpSignatureTokenLocalVar3); if (httpRequestMessageLocalVar.Content != null) { string requestBodyLocalVar = await httpRequestMessageLocalVar.Content.ReadAsStringAsync().ConfigureAwait(false); - httpSignatureTokenLocalVar2.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); + httpSignatureTokenLocalVar3.UseInHeader(httpRequestMessageLocalVar, requestBodyLocalVar, cancellationToken); } string[] contentTypes = new string[] { diff --git a/samples/client/petstore/csharp/httpclient/net10/Petstore/README.md b/samples/client/petstore/csharp/httpclient/net10/Petstore/README.md index a3b01252f2f9..f32dd0e14fca 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/README.md +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore/README.md @@ -309,6 +309,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/httpclient/net10/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/net10/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/httpclient/net10/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/httpclient/net10/Petstore/docs/PetApi.md index 934a829307a0..f3ddcee1670f 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore/docs/PetApi.md @@ -40,6 +40,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes HttpClient httpClient = new HttpClient(); @@ -92,7 +94,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index c84a19eb0d8e..3e5707a0b259 100644 --- a/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/httpclient/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -752,6 +752,12 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -833,6 +839,12 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.C { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md b/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md index a3b01252f2f9..f32dd0e14fca 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/README.md @@ -309,6 +309,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/PetApi.md index 934a829307a0..f3ddcee1670f 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/docs/PetApi.md @@ -40,6 +40,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes HttpClient httpClient = new HttpClient(); @@ -92,7 +94,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index c84a19eb0d8e..3e5707a0b259 100644 --- a/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/httpclient/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -752,6 +752,12 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -833,6 +839,12 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.C { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md index 250cb665532c..bb60372b0345 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/README.md @@ -297,6 +297,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md index eb03434c366b..0a07f9b4d8ed 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/docs/PetApi.md @@ -40,6 +40,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; // create instances of HttpClient, HttpClientHandler to be reused later with different Api classes HttpClient httpClient = new HttpClient(); @@ -92,7 +94,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index fb1604fe0013..da21efe2cbea 100644 --- a/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/httpclient/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -752,6 +752,12 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -833,6 +839,12 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.C { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md index d97d3d03f070..d6f6267ddd34 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/README.md @@ -284,6 +284,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PetApi.md index 829ca6d25184..6fdeb40cd684 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/docs/PetApi.md @@ -39,6 +39,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(config); var pet = new Pet(); // Pet | Pet object that needs to be added to the store @@ -88,7 +90,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 1ea79a1c545a..8cfc6e2f0b18 100644 --- a/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/restsharp/net8/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -723,6 +723,22 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i localVarRequestOptions.OAuth = true; } } + // authentication (petstore_auth2) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -828,6 +844,22 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex localVarRequestOptions.OAuth = true; } } + // authentication (petstore_auth2) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md index dca663d44c9d..3c259507e697 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/README.md @@ -272,6 +272,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md index cb3a65d239b4..ce05c87cd305 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/docs/PetApi.md @@ -39,6 +39,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(config); var pet = new Pet(); // Pet | Pet object that needs to be added to the store @@ -88,7 +90,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs index 8e0e14cc18dc..2f9731e06076 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Api/PetApi.cs @@ -723,6 +723,22 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet, i localVarRequestOptions.OAuth = true; } } + // authentication (petstore_auth2) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -828,6 +844,22 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, int operationIndex localVarRequestOptions.OAuth = true; } } + // authentication (petstore_auth2) required + // oauth required + if (!localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + if (!string.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } + else if (!string.IsNullOrEmpty(this.Configuration.OAuthTokenUrl) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientId) && + !string.IsNullOrEmpty(this.Configuration.OAuthClientSecret) && + this.Configuration.OAuthFlow != null) + { + localVarRequestOptions.OAuth = true; + } + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { diff --git a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/README.md b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/README.md index dcd02de1c6e7..ef7b868c5571 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/README.md +++ b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/README.md @@ -258,6 +258,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/docs/PetApi.md index 829ca6d25184..6fdeb40cd684 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/docs/PetApi.md @@ -39,6 +39,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(config); var pet = new Pet(); // Pet | Pet object that needs to be added to the store @@ -88,7 +90,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index d23685664bc2..2fde86d32640 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net10/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -682,6 +682,12 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -768,6 +774,12 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.C { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md index dcd02de1c6e7..ef7b868c5571 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/README.md @@ -258,6 +258,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/PetApi.md index 829ca6d25184..6fdeb40cd684 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/docs/PetApi.md @@ -39,6 +39,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(config); var pet = new Pet(); // Pet | Pet object that needs to be added to the store @@ -88,7 +90,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index d23685664bc2..2fde86d32640 100644 --- a/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/unityWebRequest/net9/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -682,6 +682,12 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -768,6 +774,12 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.C { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md index dcd02de1c6e7..ef7b868c5571 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/README.md @@ -258,6 +258,16 @@ Authentication schemes defined for the API: ### petstore_auth +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets + + +### petstore_auth2 + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml index ca451f3fb832..19998598b25e 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/api/openapi.yaml @@ -90,6 +90,9 @@ paths: - petstore_auth: - write:pets - read:pets + - petstore_auth2: + - write:pets + - read:pets summary: Add a new pet to the store tags: - pet @@ -3136,6 +3139,14 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + petstore_auth2: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 api_key: in: header name: api-key diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md index cb3a65d239b4..ce05c87cd305 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/docs/PetApi.md @@ -39,6 +39,8 @@ namespace Example config.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth config.AccessToken = "YOUR_ACCESS_TOKEN"; + // Configure OAuth2 access token for authorization: petstore_auth2 + config.AccessToken = "YOUR_ACCESS_TOKEN"; var apiInstance = new PetApi(config); var pet = new Pet(); // Pet | Pet object that needs to be added to the store @@ -88,7 +90,7 @@ void (empty response body) ### Authorization -[petstore_auth](../README.md#petstore_auth), [http_signature_test](../README.md#http_signature_test) +[petstore_auth](../README.md#petstore_auth), [petstore_auth2](../README.md#petstore_auth2), [http_signature_test](../README.md#http_signature_test) ### HTTP request headers diff --git a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs index 767573545c91..877e369103a7 100644 --- a/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/unityWebRequest/standard2.0/Petstore/src/Org.OpenAPITools/Api/PetApi.cs @@ -682,6 +682,12 @@ public Org.OpenAPITools.Client.ApiResponse AddPetWithHttpInfo(Pet pet) { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) { @@ -768,6 +774,12 @@ public async System.Threading.Tasks.Task AddPetAsync(Pet pet, System.Threading.C { localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); } + // authentication (petstore_auth2) required + // oauth required + if (!string.IsNullOrEmpty(this.Configuration.AccessToken) && !localVarRequestOptions.HeaderParameters.ContainsKey("Authorization")) + { + localVarRequestOptions.HeaderParameters.Add("Authorization", "Bearer " + this.Configuration.AccessToken); + } // authentication (http_signature_test) required if (this.Configuration.HttpSigningConfiguration != null) {