forked from loafle/openapi-generator-original
[csharp] Add scope for oauth2 (#19234)
* feat: add scope for oauth2
* fix: add parameter AlwaysMultipartFormData
* fix: string to boolean
* fix: optional bool
* fix: null checks
* Optional string
* Remove all references to OAuthMultipartFormData
* Remove _multipartFormData = multipartFormData;
* Remove typo
* Run generate-samples and export_docs_generators
* Revert "Run generate-samples and export_docs_generators"
This reverts commit f051f268a5.
* Switch to string.IsNullOrEmpty, add langVersion 8
* Add langVersion 8 in ConditionalSerialization
* Use regular strings for netstandard2.0
* Remove references to langVersion 8
* Fix variable
* Use template engine to toggle nullable string
* Trigger tests
* Generate samples
* Trigger build
* Use {{nrt?}}
* update samples
---------
Co-authored-by: Morten Jansrud <morten.jansrud@snokam.no>
This commit is contained in:
@@ -474,6 +474,7 @@ namespace {{packageName}}.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
@@ -366,6 +366,12 @@ namespace {{packageName}}.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string{{nrt?}} OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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}}
|
||||
|
||||
+6
@@ -43,6 +43,12 @@ namespace {{packageName}}.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string{{nrt?}} OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+1
@@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+7
@@ -294,6 +294,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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,
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
+1
@@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+7
@@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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,
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
+1
@@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+7
@@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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,
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
+1
@@ -473,6 +473,7 @@ namespace Org.OpenAPITools.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+7
@@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string? OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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,
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string? OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
+1
@@ -473,6 +473,7 @@ namespace Org.OpenAPITools.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+7
@@ -399,6 +399,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string? OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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,
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string? OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
+1
@@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+7
@@ -394,6 +394,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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,
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
+1
@@ -474,6 +474,7 @@ namespace Org.OpenAPITools.Client
|
||||
configuration.OAuthTokenUrl,
|
||||
configuration.OAuthClientId,
|
||||
configuration.OAuthClientSecret,
|
||||
configuration.OAuthScope,
|
||||
configuration.OAuthFlow,
|
||||
SerializerSettings,
|
||||
configuration);
|
||||
|
||||
+9
@@ -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<TokenResponse>(request).ConfigureAwait(false);
|
||||
|
||||
// RFC6749 - token_type is case insensitive.
|
||||
|
||||
+7
@@ -394,6 +394,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>The OAuth Client Secret.</value>
|
||||
public virtual string OAuthClientSecret { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the client scope for OAuth2 authentication.
|
||||
/// </summary>
|
||||
/// <value>The OAuth Client Scope.</value>
|
||||
public virtual string OAuthScope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the flow for OAuth2 authentication.
|
||||
/// </summary>
|
||||
@@ -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,
|
||||
|
||||
+6
@@ -46,6 +46,12 @@ namespace Org.OpenAPITools.Client
|
||||
/// <value>OAuth Client Secret.</value>
|
||||
string OAuthClientSecret { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth token scope.
|
||||
/// </summary>
|
||||
/// <value>OAuth Token scope.</value>
|
||||
string OAuthScope { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the OAuth flow.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user