diff --git a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache index eb5be40d3ae..0d826c87c9d 100644 --- a/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/ApiClient.mustache @@ -474,6 +474,7 @@ namespace {{packageName}}.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache index a765ebf138d..71ff47f971d 100644 --- a/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/Configuration.mustache @@ -366,6 +366,12 @@ namespace {{packageName}}.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string{{nrt?}} OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -711,6 +717,7 @@ namespace {{packageName}}.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, {{/hasOAuthMethods}} {{/useRestSharp}} diff --git a/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache b/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache index 78c998b3458..5981728b466 100644 --- a/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/IReadableConfiguration.mustache @@ -43,6 +43,12 @@ namespace {{packageName}}.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string{{nrt?}} OAuthScope { get; } + /// /// Gets the OAuth flow. /// diff --git a/modules/openapi-generator/src/main/resources/csharp/auth/OAuthAuthenticator.mustache b/modules/openapi-generator/src/main/resources/csharp/auth/OAuthAuthenticator.mustache index ae8f3c75391..d71f262a810 100644 --- a/modules/openapi-generator/src/main/resources/csharp/auth/OAuthAuthenticator.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/auth/OAuthAuthenticator.mustache @@ -16,6 +16,7 @@ namespace {{packageName}}.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string{{nrt?}} _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -27,6 +28,7 @@ namespace {{packageName}}.Client.Auth string tokenUrl, string clientId, string clientSecret, + string{{nrt?}} scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -34,6 +36,7 @@ namespace {{packageName}}.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -80,6 +83,12 @@ namespace {{packageName}}.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs index 7f9fc8d8a17..7d3e7d96adf 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/ApiClient.cs @@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs index b0da60f1df6..516b93d2f6a 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs @@ -24,6 +24,7 @@ namespace Org.OpenAPITools.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -35,6 +36,7 @@ namespace Org.OpenAPITools.Client.Auth string tokenUrl, string clientId, string clientSecret, + string scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -42,6 +44,7 @@ namespace Org.OpenAPITools.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -88,6 +91,12 @@ namespace Org.OpenAPITools.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs index b79f1a1a38c..26df7661dd5 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/Configuration.cs @@ -294,6 +294,12 @@ namespace Org.OpenAPITools.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -622,6 +628,7 @@ namespace Org.OpenAPITools.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, diff --git a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/IReadableConfiguration.cs index cc6fc6c592c..063daeb1b56 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/MultipleFrameworks/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string OAuthScope { get; } + /// /// Gets the OAuth flow. /// diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 0ad9a7e2d52..a55d7f34afc 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs index f900e716ae8..d7fb1293b34 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs @@ -24,6 +24,7 @@ namespace Org.OpenAPITools.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -35,6 +36,7 @@ namespace Org.OpenAPITools.Client.Auth string tokenUrl, string clientId, string clientSecret, + string scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -42,6 +44,7 @@ namespace Org.OpenAPITools.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -88,6 +91,12 @@ namespace Org.OpenAPITools.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index f27abb3d78b..b213df44c00 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -736,6 +742,7 @@ namespace Org.OpenAPITools.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, diff --git a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs index 90ec4a6f193..8713a816f35 100644 --- a/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string OAuthScope { get; } + /// /// Gets the OAuth flow. /// diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 0ad9a7e2d52..a55d7f34afc 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs index f900e716ae8..d7fb1293b34 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs @@ -24,6 +24,7 @@ namespace Org.OpenAPITools.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -35,6 +36,7 @@ namespace Org.OpenAPITools.Client.Auth string tokenUrl, string clientId, string clientSecret, + string scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -42,6 +44,7 @@ namespace Org.OpenAPITools.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -88,6 +91,12 @@ namespace Org.OpenAPITools.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index f27abb3d78b..b213df44c00 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -736,6 +742,7 @@ namespace Org.OpenAPITools.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, diff --git a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs index 90ec4a6f193..8713a816f35 100644 --- a/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net4.8/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string OAuthScope { get; } + /// /// Gets the OAuth flow. /// diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs index 69279ed569c..05e2ddb4de8 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/ApiClient.cs @@ -473,6 +473,7 @@ namespace Org.OpenAPITools.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs index f900e716ae8..ce6261390c3 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs @@ -24,6 +24,7 @@ namespace Org.OpenAPITools.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string? _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -35,6 +36,7 @@ namespace Org.OpenAPITools.Client.Auth string tokenUrl, string clientId, string clientSecret, + string? scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -42,6 +44,7 @@ namespace Org.OpenAPITools.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -88,6 +91,12 @@ namespace Org.OpenAPITools.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs index f27abb3d78b..ee437ae11e5 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/Configuration.cs @@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string? OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -736,6 +742,7 @@ namespace Org.OpenAPITools.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, diff --git a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs index 90ec4a6f193..986123acb8c 100644 --- a/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net7/EnumMappings/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string? OAuthScope { get; } + /// /// Gets the OAuth flow. /// diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 69279ed569c..05e2ddb4de8 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -473,6 +473,7 @@ namespace Org.OpenAPITools.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs index f900e716ae8..ce6261390c3 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs @@ -24,6 +24,7 @@ namespace Org.OpenAPITools.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string? _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -35,6 +36,7 @@ namespace Org.OpenAPITools.Client.Auth string tokenUrl, string clientId, string clientSecret, + string? scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -42,6 +44,7 @@ namespace Org.OpenAPITools.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -88,6 +91,12 @@ namespace Org.OpenAPITools.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index f27abb3d78b..ee437ae11e5 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string? OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -736,6 +742,7 @@ namespace Org.OpenAPITools.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, diff --git a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs index 90ec4a6f193..986123acb8c 100644 --- a/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/net7/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string? OAuthScope { get; } + /// /// Gets the OAuth flow. /// diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs index 0ad9a7e2d52..a55d7f34afc 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/ApiClient.cs @@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs index f900e716ae8..d7fb1293b34 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs @@ -24,6 +24,7 @@ namespace Org.OpenAPITools.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -35,6 +36,7 @@ namespace Org.OpenAPITools.Client.Auth string tokenUrl, string clientId, string clientSecret, + string scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -42,6 +44,7 @@ namespace Org.OpenAPITools.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -88,6 +91,12 @@ namespace Org.OpenAPITools.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs index 672bff291b8..513d074d882 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/Configuration.cs @@ -394,6 +394,12 @@ namespace Org.OpenAPITools.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -731,6 +737,7 @@ namespace Org.OpenAPITools.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs index 90ec4a6f193..8713a816f35 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/ConditionalSerialization/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string OAuthScope { get; } + /// /// Gets the OAuth flow. /// diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs index 0ad9a7e2d52..a55d7f34afc 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/ApiClient.cs @@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client configuration.OAuthTokenUrl, configuration.OAuthClientId, configuration.OAuthClientSecret, + configuration.OAuthScope, configuration.OAuthFlow, SerializerSettings, configuration); diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs index f900e716ae8..d7fb1293b34 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Auth/OAuthAuthenticator.cs @@ -24,6 +24,7 @@ namespace Org.OpenAPITools.Client.Auth readonly string _tokenUrl; readonly string _clientId; readonly string _clientSecret; + readonly string _scope; readonly string _grantType; readonly JsonSerializerSettings _serializerSettings; readonly IReadableConfiguration _configuration; @@ -35,6 +36,7 @@ namespace Org.OpenAPITools.Client.Auth string tokenUrl, string clientId, string clientSecret, + string scope, OAuthFlow? flow, JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) : base("") @@ -42,6 +44,7 @@ namespace Org.OpenAPITools.Client.Auth _tokenUrl = tokenUrl; _clientId = clientId; _clientSecret = clientSecret; + _scope = scope; _serializerSettings = serializerSettings; _configuration = configuration; @@ -88,6 +91,12 @@ namespace Org.OpenAPITools.Client.Auth .AddParameter("grant_type", _grantType) .AddParameter("client_id", _clientId) .AddParameter("client_secret", _clientSecret); + + if (!string.IsNullOrEmpty(_scope)) + { + request.AddParameter("scope", _scope); + } + var response = await client.PostAsync(request).ConfigureAwait(false); // RFC6749 - token_type is case insensitive. diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs index 672bff291b8..513d074d882 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/Configuration.cs @@ -394,6 +394,12 @@ namespace Org.OpenAPITools.Client /// The OAuth Client Secret. public virtual string OAuthClientSecret { get; set; } + /// + /// Gets or sets the client scope for OAuth2 authentication. + /// + /// The OAuth Client Scope. + public virtual string OAuthScope { get; set; } + /// /// Gets or sets the flow for OAuth2 authentication. /// @@ -731,6 +737,7 @@ namespace Org.OpenAPITools.Client OAuthTokenUrl = second.OAuthTokenUrl ?? first.OAuthTokenUrl, OAuthClientId = second.OAuthClientId ?? first.OAuthClientId, OAuthClientSecret = second.OAuthClientSecret ?? first.OAuthClientSecret, + OAuthScope = second.OAuthScope ?? first.OAuthScope, OAuthFlow = second.OAuthFlow ?? first.OAuthFlow, HttpSigningConfiguration = second.HttpSigningConfiguration ?? first.HttpSigningConfiguration, TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, diff --git a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs index 90ec4a6f193..8713a816f35 100644 --- a/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ b/samples/client/petstore/csharp/restsharp/standard2.0/Petstore/src/Org.OpenAPITools/Client/IReadableConfiguration.cs @@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client /// OAuth Client Secret. string OAuthClientSecret { get; } + /// + /// Gets the OAuth token scope. + /// + /// OAuth Token scope. + string OAuthScope { get; } + /// /// Gets the OAuth flow. ///