Browse Source

Merge pull request #10359 from abpframework/maliming/DataProtection

Set same application name  for `DataProtection`.
pull/10373/head
Halil İbrahim Kalkan 4 years ago
committed by GitHub
parent
commit
7cc616a097
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs
  2. 9
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
  3. 5
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs
  4. 9
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs
  5. 5
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
  6. 5
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs
  7. 9
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs

17
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.Server.Tiered/MyProjectNameBlazorModule.cs

@ -98,7 +98,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Tiered
ConfigureBlazorise(context);
ConfigureRouter(context);
ConfigureMenu(configuration);
ConfigureRedis(context, configuration, hostingEnvironment);
ConfigureDataProtection(context, configuration, hostingEnvironment);
ConfigureSwaggerServices(context.Services);
}
@ -109,7 +109,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Tiered
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
});
}
private void ConfigureCache()
{
Configure<AbpDistributedCacheOptions>(options =>
@ -143,7 +143,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Tiered
);
});
}
private void ConfigureMultiTenancy()
{
Configure<AbpMultiTenancyOptions>(options =>
@ -253,7 +253,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Tiered
{
options.MenuContributors.Add(new MyProjectNameMenuContributor(configuration));
});
Configure<AbpToolbarOptions>(options =>
{
options.Contributors.Add(new MyProjectNameToolbarContributor());
@ -275,7 +275,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Tiered
options.AddMaps<MyProjectNameBlazorModule>();
});
}
private void ConfigureSwaggerServices(IServiceCollection services)
{
services.AddAbpSwaggerGen(
@ -288,17 +288,16 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Tiered
);
}
private void ConfigureRedis(
private void ConfigureDataProtection(
ServiceConfigurationContext context,
IConfiguration configuration,
IWebHostEnvironment hostingEnvironment)
{
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}

9
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs

@ -51,7 +51,7 @@ namespace MyCompanyName.MyProjectName
ConfigureLocalization();
ConfigureCache(configuration);
ConfigureVirtualFileSystem(context);
ConfigureRedis(context, configuration, hostingEnvironment);
ConfigureDataProtection(context, configuration, hostingEnvironment);
ConfigureCors(context, configuration);
ConfigureSwaggerServices(context, configuration);
}
@ -145,17 +145,16 @@ namespace MyCompanyName.MyProjectName
});
}
private void ConfigureRedis(
private void ConfigureDataProtection(
ServiceConfigurationContext context,
IConfiguration configuration,
IWebHostEnvironment hostingEnvironment)
{
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}

5
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs

@ -133,12 +133,11 @@ namespace MyCompanyName.MyProjectName
options.KeyPrefix = "MyProjectName:";
});
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
context.Services.AddCors(options =>

9
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs

@ -81,7 +81,7 @@ namespace MyCompanyName.MyProjectName.Web
ConfigureBundles();
ConfigureCache();
ConfigureRedis(context, configuration, hostingEnvironment);
ConfigureDataProtection(context, configuration, hostingEnvironment);
ConfigureUrls(configuration);
ConfigureAuthentication(context, configuration);
ConfigureAutoMapper();
@ -214,17 +214,16 @@ namespace MyCompanyName.MyProjectName.Web
);
}
private void ConfigureRedis(
private void ConfigureDataProtection(
ServiceConfigurationContext context,
IConfiguration configuration,
IWebHostEnvironment hostingEnvironment)
{
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}

5
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs

@ -126,12 +126,11 @@ namespace MyCompanyName.MyProjectName
options.KeyPrefix = "MyProjectName:";
});
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
context.Services.AddCors(options =>

5
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs

@ -153,12 +153,11 @@ namespace MyCompanyName.MyProjectName
options.IsEnabled = MultiTenancyConsts.IsEnabled;
});
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
context.Services.AddCors(options =>

9
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs

@ -100,7 +100,7 @@ namespace MyCompanyName.MyProjectName
ConfigureVirtualFileSystem(hostingEnvironment);
ConfigureSwaggerServices(context.Services);
ConfigureMultiTenancy();
ConfigureRedis(context, configuration, hostingEnvironment);
ConfigureDataProtection(context, configuration, hostingEnvironment);
}
private void ConfigureMenu(IConfiguration configuration)
@ -207,17 +207,16 @@ namespace MyCompanyName.MyProjectName
);
}
private void ConfigureRedis(
private void ConfigureDataProtection(
ServiceConfigurationContext context,
IConfiguration configuration,
IWebHostEnvironment hostingEnvironment)
{
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("MyProjectName");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "MyProjectName-Protection-Keys");
}
}

Loading…
Cancel
Save