Merge branch 'master' of https://git.konsoft.top/konsoft/KonSoft.Clean
This commit is contained in:
@ -26,6 +26,7 @@ using Volo.Abp.Localization;
|
||||
using Volo.Abp.Modularity;
|
||||
using Volo.Abp.OpenIddict;
|
||||
using Volo.Abp.Security.Claims;
|
||||
using Volo.Abp.UI.Navigation.Urls;
|
||||
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
|
||||
|
||||
namespace KonSoft;
|
||||
@ -50,17 +51,20 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
{
|
||||
builder.AddValidation(options =>
|
||||
{
|
||||
options.AddAudiences("KonSoft");
|
||||
options.AddAudiences(KonSoftConsts.AuthServerAudience);
|
||||
options.UseLocalServer();
|
||||
options.UseAspNetCore();
|
||||
});
|
||||
});
|
||||
|
||||
context.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||
PreConfigure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor |
|
||||
ForwardedHeaders.XForwardedProto |
|
||||
ForwardedHeaders.XForwardedHost;
|
||||
|
||||
options.KnownNetworks.Add(new IPNetwork(IPAddress.Parse("::ffff:127.0.0.1"), 104));
|
||||
options.KnownProxies.Add(IPAddress.Parse("::ffff:127.0.0.1"));
|
||||
});
|
||||
|
||||
if (!hostingEnvironment.IsDevelopment())
|
||||
@ -107,6 +111,16 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
options.ApplicationName = "AuthServer";
|
||||
});
|
||||
|
||||
Configure<AppUrlOptions>(options =>
|
||||
{
|
||||
options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"];
|
||||
options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"]?.Split(',') ??
|
||||
Array.Empty<string>());
|
||||
|
||||
options.Applications["Angular"].RootUrl = configuration["App:ClientUrl"];
|
||||
options.Applications["Angular"].Urls[AccountUrlNames.PasswordReset] = "account/reset-password";
|
||||
});
|
||||
|
||||
Configure<AbpBackgroundJobOptions>(options => { options.IsJobExecutionEnabled = false; });
|
||||
|
||||
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
|
||||
@ -139,18 +153,16 @@ public class KonSoftAuthServerModule : AbpModule
|
||||
var app = context.GetApplicationBuilder();
|
||||
var env = context.GetEnvironment();
|
||||
|
||||
if (!env.IsDevelopment())
|
||||
{
|
||||
app.UseErrorPage();
|
||||
app.UseForwardedHeaders();
|
||||
app.UseHsts();
|
||||
}
|
||||
app.Use(async (ctx, next) =>
|
||||
{
|
||||
ctx.Request.Scheme = "https";
|
||||
await next();
|
||||
});
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
app.UseForwardedHeaders();
|
||||
}
|
||||
app.UseAbpRequestLocalization();
|
||||
app.UseErrorPage();
|
||||
|
||||
app.UseAbpRequestLocalization();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user