You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

65 lines
2.3 KiB

using API;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Autofac;
using Volo.Abp.AutoMapper;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.IdentityModel;
using Volo.Abp.Identity;
using Volo.Abp.IdentityModel;
using Volo.Abp.Modularity;
namespace WinFormsApp
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(AbpHttpClientModule),
typeof(APIApplicationContractsModule),
typeof(AbpHttpClientIdentityModelModule),
typeof(AbpIdentityHttpApiClientModule)
)]
public class WinFormModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(APIApplicationContractsModule).Assembly,
remoteServiceConfigurationName: "Default"
);
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<WinFormModule>();
});
//var configuration = context.Services.GetConfiguration();
//ConfigureIdentityClientOption(context, configuration);
//context.Services.AddSingleton<FinancialMainWindow>();
// context.Services.AddSingleton<Form1>();
}
private static void ConfigureIdentityClientOption(ServiceConfigurationContext context, IConfiguration configuration)
{
var defaultClientConfiguration = new IdentityClientConfiguration(
configuration["IdentityClients:Default:Authority"],
configuration["IdentityClients:Default:Scope"],
configuration["IdentityClients:Default:ClientId"],
configuration["IdentityClients:Default:ClientSecret"],
configuration["IdentityClients:Default:GrantType"],
configuration["IdentityClients:Default:UserName"],
configuration["IdentityClients:Default:UserPassword"],
false,
1800
);
context.Services.AddOptions<AbpIdentityClientOptions>().Configure(option =>
{
option.IdentityClients.Default = defaultClientConfiguration;
});
}
}
}