Browse Source
Merge pull request #1522 from colinin/module-configuration
feat: Optimize module configuration
pull/1529/head
yx lin
3 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with
17 additions and
5 deletions
-
aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.Configure.cs
-
aspnet-core/aspire/LINGYUN.Abp.MicroService.AuthServer/AuthServerModule.cs
-
aspnet-core/services/LY.MicroService.Applications.Single/MicroServiceApplicationsSingleModule.Configure.cs
|
|
|
@ -108,13 +108,20 @@ public partial class AuthServerModule |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void PreConfigureAuthServer() |
|
|
|
private void PreConfigureAuthServer(IConfiguration configuration) |
|
|
|
{ |
|
|
|
PreConfigure<OpenIddictBuilder>(builder => |
|
|
|
{ |
|
|
|
builder.AddValidation(options => |
|
|
|
{ |
|
|
|
//options.AddAudiences("lingyun-abp-application");
|
|
|
|
var validAudiences = configuration.GetSection("AuthServer:ValidAudiences").Get<List<string>>(); |
|
|
|
if (validAudiences?.Count > 0) |
|
|
|
{ |
|
|
|
foreach (var audience in validAudiences) |
|
|
|
{ |
|
|
|
options.AddAudiences(audience); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
options.UseLocalServer(); |
|
|
|
|
|
|
|
|
|
|
|
@ -88,9 +88,9 @@ public partial class AuthServerModule : AbpModule |
|
|
|
PreConfigureWrapper(); |
|
|
|
PreConfigureFeature(); |
|
|
|
PreForwardedHeaders(); |
|
|
|
PreConfigureAuthServer(); |
|
|
|
PreConfigureApp(configuration); |
|
|
|
PreConfigureCAP(configuration); |
|
|
|
PreConfigureAuthServer(configuration); |
|
|
|
PreConfigureCertificate(configuration, hostingEnvironment); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -961,11 +961,16 @@ public partial class MicroServiceApplicationsSingleModule |
|
|
|
|
|
|
|
if (!isDevelopment) |
|
|
|
{ |
|
|
|
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); |
|
|
|
services |
|
|
|
.AddDataProtection() |
|
|
|
.SetApplicationName("LINGYUN.Abp.Application") |
|
|
|
.PersistKeysToStackExchangeRedis(redis, "LINGYUN.Abp.Application:DataProtection:Protection-Keys"); |
|
|
|
.PersistKeysToStackExchangeRedis(() => |
|
|
|
{ |
|
|
|
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!); |
|
|
|
|
|
|
|
return redis.GetDatabase(); |
|
|
|
}, |
|
|
|
"LINGYUN.Abp.Application:DataProtection:Protection-Keys"); |
|
|
|
} |
|
|
|
|
|
|
|
services.AddSameSiteCookiePolicy(); |
|
|
|
|