mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
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.
78 lines
2.8 KiB
78 lines
2.8 KiB
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.Extensions.Configuration;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Swashbuckle.AspNetCore.Swagger;
|
|
using Volo.Abp;
|
|
using Volo.Abp.AspNetCore.Modularity;
|
|
using Volo.Abp.AuditLogging.EntityFrameworkCore;
|
|
using Volo.Abp.Autofac;
|
|
using Volo.Abp.EntityFrameworkCore;
|
|
using Volo.Abp.EntityFrameworkCore.SqlServer;
|
|
using Volo.Abp.Identity;
|
|
using Volo.Abp.Identity.EntityFrameworkCore;
|
|
using Volo.Abp.Localization;
|
|
using Volo.Abp.Modularity;
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore;
|
|
|
|
namespace IdentityService.Host
|
|
{
|
|
[DependsOn(
|
|
typeof(AbpAutofacModule),
|
|
typeof(AbpEntityFrameworkCoreSqlServerModule),
|
|
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
|
|
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
|
|
typeof(AbpSettingManagementEntityFrameworkCoreModule),
|
|
typeof(AbpIdentityHttpApiModule),
|
|
typeof(AbpIdentityEntityFrameworkCoreModule),
|
|
typeof(AbpIdentityApplicationModule)
|
|
)]
|
|
public class IdentityServiceHostModule : AbpModule
|
|
{
|
|
public override void ConfigureServices(ServiceConfigurationContext context)
|
|
{
|
|
var configuration = context.Services.GetConfiguration();
|
|
var x = configuration.GetConnectionString("Default");
|
|
|
|
context.Services.AddAuthentication("Bearer")
|
|
.AddIdentityServerAuthentication(options =>
|
|
{
|
|
options.Authority = "http://localhost:64999"; //TODO: Update
|
|
options.RequireHttpsMetadata = false;
|
|
options.ApiName = "IdentityService";
|
|
});
|
|
|
|
context.Services.AddSwaggerGen(options =>
|
|
{
|
|
options.SwaggerDoc("v1", new Info {Title = "Identity Service API", Version = "v1"});
|
|
options.DocInclusionPredicate((docName, description) => true);
|
|
});
|
|
|
|
Configure<AbpLocalizationOptions>(options =>
|
|
{
|
|
options.Languages.Add(new LanguageInfo("en", "en", "English"));
|
|
});
|
|
|
|
Configure<AbpDbContextOptions>(options =>
|
|
{
|
|
options.UseSqlServer();
|
|
});
|
|
}
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context)
|
|
{
|
|
var app = context.GetApplicationBuilder();
|
|
|
|
app.UseVirtualFiles();
|
|
app.UseAuthentication();
|
|
app.UseAbpRequestLocalization(); //TODO: localization?
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI(options =>
|
|
{
|
|
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Identity Service API");
|
|
});
|
|
app.UseAuditing();
|
|
app.UseMvcWithDefaultRouteAndArea();
|
|
}
|
|
}
|
|
}
|
|
|