Merge branch 'master' of https://git.konsoft.top/konsoft/KonSoft.Clean
This commit is contained in:
1
applications/KonSoft.AuthServer/.yarnrc
Normal file
1
applications/KonSoft.AuthServer/.yarnrc
Normal file
@ -0,0 +1 @@
|
|||||||
|
registry "https://registry.npmmirror.com"
|
||||||
@ -38,8 +38,6 @@ RUN dotnet nuget locals all --clear
|
|||||||
RUN dotnet nuget add source https://mirrors.huaweicloud.com/repository/nuget/v3/index.json -n HuaweiCloud
|
RUN dotnet nuget add source https://mirrors.huaweicloud.com/repository/nuget/v3/index.json -n HuaweiCloud
|
||||||
RUN dotnet tool install -g Volo.Abp.Cli --version 8.3.4
|
RUN dotnet tool install -g Volo.Abp.Cli --version 8.3.4
|
||||||
ENV PATH="$PATH:/root/.dotnet/tools"
|
ENV PATH="$PATH:/root/.dotnet/tools"
|
||||||
RUN npm config set registry https://registry.npmmirror.com
|
|
||||||
RUN yarn config set registry https://registry.npmmirror.com
|
|
||||||
RUN abp install-libs
|
RUN abp install-libs
|
||||||
RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
RUN dotnet build "./KonSoft.AuthServer.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||||
|
|
||||||
|
|||||||
@ -5,15 +5,17 @@ using KonSoft.Shared.Hosting.Microservices;
|
|||||||
using KonSoft.Shared.Localization.Localization;
|
using KonSoft.Shared.Localization.Localization;
|
||||||
using Localization.Resources.AbpUi;
|
using Localization.Resources.AbpUi;
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Cors;
|
||||||
using Microsoft.AspNetCore.HttpOverrides;
|
using Microsoft.AspNetCore.HttpOverrides;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.Account;
|
using Volo.Abp.Account;
|
||||||
using Volo.Abp.Account.Localization;
|
using Volo.Abp.Account.Localization;
|
||||||
using Volo.Abp.Account.Web;
|
using Volo.Abp.Account.Web;
|
||||||
using Volo.Abp.AspNetCore.Mvc.AntiForgery;
|
|
||||||
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
|
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
|
||||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic;
|
||||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
|
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Bundling;
|
||||||
@ -24,6 +26,7 @@ using Volo.Abp.Localization;
|
|||||||
using Volo.Abp.Modularity;
|
using Volo.Abp.Modularity;
|
||||||
using Volo.Abp.OpenIddict;
|
using Volo.Abp.OpenIddict;
|
||||||
using Volo.Abp.Security.Claims;
|
using Volo.Abp.Security.Claims;
|
||||||
|
using IPNetwork = Microsoft.AspNetCore.HttpOverrides.IPNetwork;
|
||||||
|
|
||||||
namespace KonSoft;
|
namespace KonSoft;
|
||||||
|
|
||||||
@ -55,10 +58,14 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
|
|
||||||
if (!hostingEnvironment.IsDevelopment())
|
if (!hostingEnvironment.IsDevelopment())
|
||||||
{
|
{
|
||||||
PreConfigure<AbpAntiForgeryOptions>(options =>
|
PreConfigure<ForwardedHeadersOptions>(options =>
|
||||||
{
|
{
|
||||||
options.TokenCookie.SecurePolicy = CookieSecurePolicy.Always;
|
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor |
|
||||||
options.TokenCookie.SameSite = SameSiteMode.Lax;
|
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"));
|
||||||
});
|
});
|
||||||
|
|
||||||
PreConfigure<AbpOpenIddictAspNetCoreOptions>(options =>
|
PreConfigure<AbpOpenIddictAspNetCoreOptions>(options =>
|
||||||
@ -110,35 +117,23 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
options.IsDynamicClaimsEnabled = true;
|
options.IsDynamicClaimsEnabled = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>ͷ
|
context.Services.AddCors(options =>
|
||||||
context.Services.Configure<ForwardedHeadersOptions>(options =>
|
|
||||||
{
|
{
|
||||||
options.ForwardedHeaders = ForwardedHeaders.All;
|
options.AddDefaultPolicy(builder =>
|
||||||
options.KnownNetworks.Clear();
|
{
|
||||||
options.KnownProxies.Clear();
|
builder
|
||||||
});
|
.WithOrigins(
|
||||||
|
configuration["App:CorsOrigins"]?
|
||||||
// <20><><EFBFBD><EFBFBD>Cookie<69><65><EFBFBD><EFBFBD>
|
.Split(",", StringSplitOptions.RemoveEmptyEntries)
|
||||||
context.Services.Configure<CookiePolicyOptions>(options =>
|
.Select(o => o.RemovePostFix("/"))
|
||||||
{
|
.ToArray() ?? Array.Empty<string>()
|
||||||
options.CheckConsentNeeded = context => false;
|
)
|
||||||
options.MinimumSameSitePolicy = SameSiteMode.Lax;
|
.WithAbpExposedHeaders()
|
||||||
options.Secure = CookieSecurePolicy.Always;
|
.SetIsOriginAllowedToAllowWildcardSubdomains()
|
||||||
});
|
.AllowAnyHeader()
|
||||||
|
.AllowAnyMethod()
|
||||||
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6>Cookie
|
.AllowCredentials();
|
||||||
context.Services.ConfigureApplicationCookie(options =>
|
});
|
||||||
{
|
|
||||||
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
|
|
||||||
options.Cookie.SameSite = SameSiteMode.Lax;
|
|
||||||
options.Cookie.HttpOnly = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF>֤Cookie
|
|
||||||
context.Services.ConfigureExternalCookie(options =>
|
|
||||||
{
|
|
||||||
options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
|
|
||||||
options.Cookie.SameSite = SameSiteMode.Lax;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,18 +142,16 @@ public class KonSoftAuthServerModule : AbpModule
|
|||||||
var app = context.GetApplicationBuilder();
|
var app = context.GetApplicationBuilder();
|
||||||
var env = context.GetEnvironment();
|
var env = context.GetEnvironment();
|
||||||
|
|
||||||
if (env.IsDevelopment())
|
|
||||||
{
|
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseForwardedHeaders();
|
app.UseForwardedHeaders();
|
||||||
app.UseAbpRequestLocalization();
|
app.Use(async (ctx, next) =>
|
||||||
|
|
||||||
if (!env.IsDevelopment())
|
|
||||||
{
|
{
|
||||||
app.UseErrorPage();
|
ctx.Request.Scheme = "https";
|
||||||
}
|
await next();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.UseDeveloperExceptionPage();
|
||||||
|
app.UseAbpRequestLocalization();
|
||||||
|
app.UseErrorPage();
|
||||||
|
|
||||||
app.UseCorrelationId();
|
app.UseCorrelationId();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|||||||
Reference in New Issue
Block a user