forked from loafle/openapi-generator-original
fixed more warnings and spacing issues (#15743)
This commit is contained in:
parent
3cff040fe8
commit
e06e2cce69
@ -457,7 +457,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
.put("required", new RequiredParameterLambda().generator(this))
|
||||
.put("optional", new OptionalParameterLambda().generator(this))
|
||||
.put("joinWithComma", new JoinWithCommaLambda())
|
||||
.put("trimLineBreaks", new TrimLineBreaksLambda());
|
||||
.put("trimLineBreaks", new TrimLineBreaksLambda())
|
||||
.put("trimTrailingWhiteSpace", new TrimTrailingWhiteSpaceLambda());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.openapitools.codegen.templating.mustache;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
import com.samskivert.mustache.Mustache;
|
||||
import com.samskivert.mustache.Template.Fragment;
|
||||
|
||||
/**
|
||||
* Replaces duplicate line break characters in a fragment with single line break.
|
||||
*
|
||||
* Register:
|
||||
* <pre>
|
||||
* additionalProperties.put("trimTrailingWhiteSpace", new TrimTrailingWhiteSpaceLambda());
|
||||
* </pre>
|
||||
*
|
||||
* Use:
|
||||
* <pre>
|
||||
* {{#trimTrailingWhiteSpace}}{{name}}{{/trimTrailingWhiteSpace}}
|
||||
* </pre>
|
||||
*/
|
||||
public class TrimTrailingWhiteSpaceLambda implements Mustache.Lambda {
|
||||
@Override
|
||||
public void execute(Fragment fragment, Writer writer) throws IOException {
|
||||
writer.write(fragment.execute().stripTrailing());
|
||||
}
|
||||
}
|
@ -28,21 +28,36 @@ namespace {{packageName}}.Test.{{apiPackage}}
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.Configure{{apiName}}((context, services, options) =>
|
||||
{
|
||||
{{#hasApiKeyMethods}}ApiKeyToken apiKeyToken = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
{{#lambda.trimTrailingWhiteSpace}}
|
||||
{{#hasApiKeyMethods}}
|
||||
string apiKeyTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
ApiKeyToken apiKeyToken = new{{^net70OrLater}} ApiKeyToken{{/net70OrLater}}(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken);
|
||||
{{/hasApiKeyMethods}}{{#hasHttpBearerMethods}}
|
||||
BearerToken bearerToken = new{{^net70OrLater}} BearerToken{{/net70OrLater}}(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
{{/hasApiKeyMethods}}
|
||||
{{#hasHttpBearerMethods}}
|
||||
string bearerTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
BearerToken bearerToken = new{{^net70OrLater}} BearerToken{{/net70OrLater}}(bearerTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(bearerToken);
|
||||
{{/hasHttpBearerMethods}}{{#hasHttpBasicMethods}}
|
||||
BasicToken basicToken = new{{^net70OrLater}} BasicToken{{/net70OrLater}}(context.Configuration["<username>"], context.Configuration["<password>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
{{/hasHttpBearerMethods}}
|
||||
{{#hasHttpBasicMethods}}
|
||||
string basicTokenUsername = context.Configuration["<username>"] ?? throw new Exception("Username not found.");
|
||||
string basicTokenPassword = context.Configuration["<password>"] ?? throw new Exception("Password not found.");
|
||||
BasicToken basicToken = new{{^net70OrLater}} BasicToken{{/net70OrLater}}(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(basicToken);
|
||||
{{/hasHttpBasicMethods}}{{#hasHttpSignatureMethods}}
|
||||
|
||||
{{/hasHttpBasicMethods}}
|
||||
{{#hasHttpSignatureMethods}}
|
||||
HttpSigningConfiguration config = new{{^net70OrLater}} HttpSigningConfiguration{{/net70OrLater}}("<keyId>", "<keyFilePath>", null, new List<string>(), HashAlgorithmName.SHA256, "<signingAlgorithm>", 0);
|
||||
HttpSignatureToken httpSignatureToken = new{{^net70OrLater}} HttpSignatureToken{{/net70OrLater}}(config, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(httpSignatureToken);
|
||||
{{/hasHttpSignatureMethods}}{{#hasOAuthMethods}}
|
||||
OAuthToken oauthToken = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(oauthToken);{{/hasOAuthMethods}}
|
||||
|
||||
{{/hasHttpSignatureMethods}}
|
||||
{{#hasOAuthMethods}}
|
||||
string oauthTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
OAuthToken oauthToken = new{{^net70OrLater}} OAuthToken{{/net70OrLater}}(oauthTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(oauthToken);{{/hasOAuthMethods}}{{/lambda.trimTrailingWhiteSpace}}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ namespace {{packageName}}.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void Add{{apiName}}<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}>(this IServiceCollection services)
|
||||
{{#apiInfo}}
|
||||
{{#apis}}
|
||||
@ -29,7 +28,7 @@ namespace {{packageName}}.Extensions
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
{
|
||||
HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}> config = new HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}>(services);
|
||||
HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}> config = new{{^net70OrLater}} HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}>{{/net70OrLater}}(services);
|
||||
Add{{apiName}}(services, config);
|
||||
}
|
||||
|
||||
@ -37,7 +36,6 @@ namespace {{packageName}}.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void Add{{apiName}}(this IServiceCollection services)
|
||||
{
|
||||
HostConfiguration<{{>DefaultApis}}> config = new HostConfiguration<{{>DefaultApis}}>(services);
|
||||
@ -57,7 +55,7 @@ namespace {{packageName}}.Extensions
|
||||
{{/apis}}
|
||||
{{/apiInfo}}
|
||||
{
|
||||
HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}> config = new HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}>(services);
|
||||
HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}> config = new{{^net70OrLater}} HostConfiguration<{{#apiInfo}}{{#apis}}T{{classname}}{{^-last}}, {{/-last}}{{/apis}}{{/apiInfo}}>{{/net70OrLater}}(services);
|
||||
options(config);
|
||||
Add{{apiName}}(services, config);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@
|
||||
{{/validatable}}
|
||||
</ItemGroup>
|
||||
|
||||
{{^net60OrLater}}
|
||||
{{^useGenericHost}}
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
{{#net48}}
|
||||
@ -64,5 +64,5 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
{{/net48}}
|
||||
</ItemGroup>
|
||||
{{/net60OrLater}}
|
||||
{{/useGenericHost}}
|
||||
{{>netcore_project.additions}}</Project>
|
||||
|
@ -52,20 +52,25 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.ConfigureApi((context, services, options) =>
|
||||
{
|
||||
ApiKeyToken apiKeyToken = new(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
string apiKeyTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
ApiKeyToken apiKeyToken = new(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken);
|
||||
|
||||
BearerToken bearerToken = new(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string bearerTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
BearerToken bearerToken = new(bearerTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(bearerToken);
|
||||
|
||||
BasicToken basicToken = new(context.Configuration["<username>"], context.Configuration["<password>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string basicTokenUsername = context.Configuration["<username>"] ?? throw new Exception("Username not found.");
|
||||
string basicTokenPassword = context.Configuration["<password>"] ?? throw new Exception("Password not found.");
|
||||
BasicToken basicToken = new(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(basicToken);
|
||||
|
||||
|
||||
HttpSigningConfiguration config = new("<keyId>", "<keyFilePath>", null, new List<string>(), HashAlgorithmName.SHA256, "<signingAlgorithm>", 0);
|
||||
HttpSignatureToken httpSignatureToken = new(config, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(httpSignatureToken);
|
||||
|
||||
OAuthToken oauthToken = new(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string oauthTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
OAuthToken oauthToken = new(oauthTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(oauthToken);
|
||||
});
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace Org.OpenAPITools.Extensions
|
||||
where TStoreApi : class, IApi.IStoreApi
|
||||
where TUserApi : class, IApi.IUserApi
|
||||
{
|
||||
HostConfiguration<TAnotherFakeApi, TDefaultApi, TFakeApi, TFakeClassnameTags123Api, TPetApi, TStoreApi, TUserApi> config = new HostConfiguration<TAnotherFakeApi, TDefaultApi, TFakeApi, TFakeClassnameTags123Api, TPetApi, TStoreApi, TUserApi>(services);
|
||||
HostConfiguration<TAnotherFakeApi, TDefaultApi, TFakeApi, TFakeClassnameTags123Api, TPetApi, TStoreApi, TUserApi> config = new(services);
|
||||
options(config);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
@ -52,20 +52,25 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.ConfigureApi((context, services, options) =>
|
||||
{
|
||||
ApiKeyToken apiKeyToken = new(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
string apiKeyTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
ApiKeyToken apiKeyToken = new(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken);
|
||||
|
||||
BearerToken bearerToken = new(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string bearerTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
BearerToken bearerToken = new(bearerTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(bearerToken);
|
||||
|
||||
BasicToken basicToken = new(context.Configuration["<username>"], context.Configuration["<password>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string basicTokenUsername = context.Configuration["<username>"] ?? throw new Exception("Username not found.");
|
||||
string basicTokenPassword = context.Configuration["<password>"] ?? throw new Exception("Password not found.");
|
||||
BasicToken basicToken = new(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(basicToken);
|
||||
|
||||
|
||||
HttpSigningConfiguration config = new("<keyId>", "<keyFilePath>", null, new List<string>(), HashAlgorithmName.SHA256, "<signingAlgorithm>", 0);
|
||||
HttpSignatureToken httpSignatureToken = new(config, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(httpSignatureToken);
|
||||
|
||||
OAuthToken oauthToken = new(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string oauthTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
OAuthToken oauthToken = new(oauthTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(oauthToken);
|
||||
});
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace Org.OpenAPITools.Extensions
|
||||
where TStoreApi : class, IApi.IStoreApi
|
||||
where TUserApi : class, IApi.IUserApi
|
||||
{
|
||||
HostConfiguration<TAnotherFakeApi, TDefaultApi, TFakeApi, TFakeClassnameTags123Api, TPetApi, TStoreApi, TUserApi> config = new HostConfiguration<TAnotherFakeApi, TDefaultApi, TFakeApi, TFakeClassnameTags123Api, TPetApi, TStoreApi, TUserApi>(services);
|
||||
HostConfiguration<TAnotherFakeApi, TDefaultApi, TFakeApi, TFakeClassnameTags123Api, TPetApi, TStoreApi, TUserApi> config = new(services);
|
||||
options(config);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.ConfigureApi((context, services, options) =>
|
||||
{
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,10 @@ namespace Org.OpenAPITools.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void AddApi<TDefaultApi>(this IServiceCollection services)
|
||||
where TDefaultApi : class, IApi.IDefaultApi
|
||||
{
|
||||
HostConfiguration<TDefaultApi> config = new HostConfiguration<TDefaultApi>(services);
|
||||
HostConfiguration<TDefaultApi> config = new(services);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
||||
@ -38,7 +37,6 @@ namespace Org.OpenAPITools.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void AddApi(this IServiceCollection services)
|
||||
{
|
||||
HostConfiguration<DefaultApi> config = new HostConfiguration<DefaultApi>(services);
|
||||
@ -53,7 +51,7 @@ namespace Org.OpenAPITools.Extensions
|
||||
public static void AddApi<TDefaultApi>(this IServiceCollection services, Action<HostConfiguration<TDefaultApi>> options)
|
||||
where TDefaultApi : class, IApi.IDefaultApi
|
||||
{
|
||||
HostConfiguration<TDefaultApi> config = new HostConfiguration<TDefaultApi>(services);
|
||||
HostConfiguration<TDefaultApi> config = new(services);
|
||||
options(config);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.ConfigureApi((context, services, options) =>
|
||||
{
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,10 @@ namespace Org.OpenAPITools.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void AddApi<TDefaultApi>(this IServiceCollection services)
|
||||
where TDefaultApi : class, IApi.IDefaultApi
|
||||
{
|
||||
HostConfiguration<TDefaultApi> config = new HostConfiguration<TDefaultApi>(services);
|
||||
HostConfiguration<TDefaultApi> config = new(services);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
||||
@ -38,7 +37,6 @@ namespace Org.OpenAPITools.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void AddApi(this IServiceCollection services)
|
||||
{
|
||||
HostConfiguration<DefaultApi> config = new HostConfiguration<DefaultApi>(services);
|
||||
@ -53,7 +51,7 @@ namespace Org.OpenAPITools.Extensions
|
||||
public static void AddApi<TDefaultApi>(this IServiceCollection services, Action<HostConfiguration<TDefaultApi>> options)
|
||||
where TDefaultApi : class, IApi.IDefaultApi
|
||||
{
|
||||
HostConfiguration<TDefaultApi> config = new HostConfiguration<TDefaultApi>(services);
|
||||
HostConfiguration<TDefaultApi> config = new(services);
|
||||
options(config);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.ConfigureApi((context, services, options) =>
|
||||
{
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -26,11 +26,10 @@ namespace Org.OpenAPITools.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void AddApi<TDefaultApi>(this IServiceCollection services)
|
||||
where TDefaultApi : class, IApi.IDefaultApi
|
||||
{
|
||||
HostConfiguration<TDefaultApi> config = new HostConfiguration<TDefaultApi>(services);
|
||||
HostConfiguration<TDefaultApi> config = new(services);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
||||
@ -38,7 +37,6 @@ namespace Org.OpenAPITools.Extensions
|
||||
/// Add the api to your host builder.
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="options"></param>
|
||||
public static void AddApi(this IServiceCollection services)
|
||||
{
|
||||
HostConfiguration<DefaultApi> config = new HostConfiguration<DefaultApi>(services);
|
||||
@ -53,7 +51,7 @@ namespace Org.OpenAPITools.Extensions
|
||||
public static void AddApi<TDefaultApi>(this IServiceCollection services, Action<HostConfiguration<TDefaultApi>> options)
|
||||
where TDefaultApi : class, IApi.IDefaultApi
|
||||
{
|
||||
HostConfiguration<TDefaultApi> config = new HostConfiguration<TDefaultApi>(services);
|
||||
HostConfiguration<TDefaultApi> config = new(services);
|
||||
options(config);
|
||||
AddApi(services, config);
|
||||
}
|
||||
|
@ -52,20 +52,25 @@ namespace Org.OpenAPITools.Test.Api
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args)
|
||||
.ConfigureApi((context, services, options) =>
|
||||
{
|
||||
ApiKeyToken apiKeyToken = new ApiKeyToken(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
string apiKeyTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
ApiKeyToken apiKeyToken = new ApiKeyToken(apiKeyTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(apiKeyToken);
|
||||
|
||||
BearerToken bearerToken = new BearerToken(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string bearerTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
BearerToken bearerToken = new BearerToken(bearerTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(bearerToken);
|
||||
|
||||
BasicToken basicToken = new BasicToken(context.Configuration["<username>"], context.Configuration["<password>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string basicTokenUsername = context.Configuration["<username>"] ?? throw new Exception("Username not found.");
|
||||
string basicTokenPassword = context.Configuration["<password>"] ?? throw new Exception("Password not found.");
|
||||
BasicToken basicToken = new BasicToken(basicTokenUsername, basicTokenPassword, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(basicToken);
|
||||
|
||||
|
||||
HttpSigningConfiguration config = new HttpSigningConfiguration("<keyId>", "<keyFilePath>", null, new List<string>(), HashAlgorithmName.SHA256, "<signingAlgorithm>", 0);
|
||||
HttpSignatureToken httpSignatureToken = new HttpSignatureToken(config, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(httpSignatureToken);
|
||||
|
||||
OAuthToken oauthToken = new OAuthToken(context.Configuration["<token>"], timeout: TimeSpan.FromSeconds(1));
|
||||
|
||||
string oauthTokenValue = context.Configuration["<token>"] ?? throw new Exception("Token not found.");
|
||||
OAuthToken oauthToken = new OAuthToken(oauthTokenValue, timeout: TimeSpan.FromSeconds(1));
|
||||
options.AddTokens(oauthToken);
|
||||
});
|
||||
}
|
||||
|
@ -28,10 +28,4 @@
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -28,4 +28,10 @@
|
||||
<PackageReference Include="Polly" Version="7.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -28,4 +28,10 @@
|
||||
<PackageReference Include="Polly" Version="7.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="System.Web" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Web" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user