修改代码格式

This commit is contained in:
falcon 2023-01-03 09:58:11 +08:00
parent 01798a02be
commit 956e3349fe

View File

@ -3,7 +3,6 @@ using Falcon.SugarApi.JsonSerialize;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
using System; using System;
using System.Text.Json;
namespace Falcon.SugarApi.FalconClaim namespace Falcon.SugarApi.FalconClaim
{ {
@ -13,19 +12,20 @@ namespace Falcon.SugarApi.FalconClaim
public static class IServiceCollectionExtend public static class IServiceCollectionExtend
{ {
/// <summary> /// <summary>
/// 增加FalconCalom相关服务 /// 增加FalconClaim相关服务
/// </summary> /// </summary>
public static IServiceCollection AddFalconClaim(this IServiceCollection services,Action<FalconClaimOption>? optionBuilder = null) { public static IServiceCollection AddFalconClaim(this IServiceCollection services, Action<FalconClaimOption>? optionBuilder = null) {
optionBuilder?.Invoke(new FalconClaimOption()); var option = new FalconClaimOption();
optionBuilder?.Invoke(option);
services.TryAddSingleton<JsonSerializeFactory>(); services.TryAddSingleton<JsonSerializeFactory>();
services.TryAddSingleton<ITokenBuilter,AesTokenBuilder>(); services.TryAddSingleton<ITokenBuilter, AesTokenBuilder>();
services.TryAddSingleton<AESConfig>(); services.TryAddSingleton<AESConfig>();
services.TryAddSingleton<IAESEncryption,AESProvider>(); services.TryAddSingleton<IAESEncryption, AESProvider>();
services.AddAuthentication(b => { services.AddAuthentication(b => {
b.DefaultAuthenticateScheme = FalconClaimOption.SchemeName; b.DefaultAuthenticateScheme = FalconClaimOption.SchemeName;
b.DefaultChallengeScheme = FalconClaimOption.SchemeName; b.DefaultChallengeScheme = FalconClaimOption.SchemeName;
b.DefaultForbidScheme = FalconClaimOption.SchemeName; b.DefaultForbidScheme = FalconClaimOption.SchemeName;
b.AddScheme<FalconAuthenticationHandler>(FalconClaimOption.SchemeName,FalconClaimOption.SchemeName); b.AddScheme<FalconAuthenticationHandler>(FalconClaimOption.SchemeName, FalconClaimOption.SchemeName);
}); });
return services; return services;
} }