diff --git a/.github/workflows/sukt-admin-k8s-deployment.yml b/.github/workflows/sukt-admin-k8s-deployment.yml index cb4bcbb..b586033 100644 --- a/.github/workflows/sukt-admin-k8s-deployment.yml +++ b/.github/workflows/sukt-admin-k8s-deployment.yml @@ -1,15 +1,15 @@ -name: CD -on: - - push +# name: CD +# on: +# - push -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: 触发部署到K8S - uses: phamquyhai/kubernetes-action@master - env: - KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} - with: - args: apply /home/runner/work/Sukt.Core/Sukt.Core/K8sdeploy/sukt-core-admin-deployment-and-service.yaml +# jobs: +# deploy: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v2 +# - name: 触发部署到K8S +# uses: phamquyhai/kubernetes-action@master +# env: +# KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }} +# with: +# args: apply /home/runner/work/Sukt.Core/Sukt.Core/K8sdeploy/sukt-core-admin-deployment-and-service.yaml diff --git a/Dockerfile b/Dockerfile index 4d06791..feff5fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app ENV TZ=Asia/Shanghai EXPOSE 80 diff --git a/Dockerfilepublish b/Dockerfilepublish index 281eb6e..6fca58b 100644 --- a/Dockerfilepublish +++ b/Dockerfilepublish @@ -1,6 +1,6 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base WORKDIR /app EXPOSE 80 ENV TZ=Asia/Shanghai diff --git a/src/Sukt.AuthServer.AccessTokenValidation/Sukt.AuthServer.AccessTokenValidation.csproj b/src/Sukt.AuthServer.AccessTokenValidation/Sukt.AuthServer.AccessTokenValidation.csproj index b552669..32e5909 100644 --- a/src/Sukt.AuthServer.AccessTokenValidation/Sukt.AuthServer.AccessTokenValidation.csproj +++ b/src/Sukt.AuthServer.AccessTokenValidation/Sukt.AuthServer.AccessTokenValidation.csproj @@ -1,12 +1,12 @@ - net5.0 + net6.0 - + diff --git a/src/Sukt.AuthServer.Domain/Sukt.AuthServer.Domain.csproj b/src/Sukt.AuthServer.Domain/Sukt.AuthServer.Domain.csproj index 61e43af..18bd85e 100644 --- a/src/Sukt.AuthServer.Domain/Sukt.AuthServer.Domain.csproj +++ b/src/Sukt.AuthServer.Domain/Sukt.AuthServer.Domain.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/src/Sukt.AuthServer/Configuration/ObjectSerializer.cs b/src/Sukt.AuthServer/Configuration/ObjectSerializer.cs index 881eb8a..ef9867c 100644 --- a/src/Sukt.AuthServer/Configuration/ObjectSerializer.cs +++ b/src/Sukt.AuthServer/Configuration/ObjectSerializer.cs @@ -9,7 +9,7 @@ namespace Sukt.AuthServer.Configuration { internal static class ObjectSerializer { - private static readonly JsonSerializerOptions Options = new JsonSerializerOptions + private static readonly JsonSerializerOptions Options = new() { IgnoreNullValues = true }; diff --git a/src/Sukt.AuthServer/EndpointHandler/AuthorizeEndpoint.cs b/src/Sukt.AuthServer/EndpointHandler/AuthorizeEndpoint.cs index 1e2a84e..7c6a2b9 100644 --- a/src/Sukt.AuthServer/EndpointHandler/AuthorizeEndpoint.cs +++ b/src/Sukt.AuthServer/EndpointHandler/AuthorizeEndpoint.cs @@ -1,8 +1,11 @@ using Microsoft.AspNetCore.Http; using Sukt.AuthServer.EndpointHandler.EndpointHandlerResult; +using Sukt.AuthServer.Extensions; using System; using System.Collections.Generic; +using System.Collections.Specialized; using System.Linq; +using System.Net; using System.Text; using System.Threading.Tasks; @@ -20,6 +23,27 @@ internal class AuthorizeEndpoint : AuthorizeEndpointBase /// public override async Task HandlerProcessAsync(HttpContext context) { + NameValueCollection values; + //判断是否是get请求 如果是get请求拿出后面的请求参数 + if (HttpMethods.IsGet(context.Request.Method)) + { + values = context.Request.Query.AsNameValueCollection(); + } + else if (HttpMethods.IsPost(context.Request.Method)) + { + if (!context.Request.HasApplicationFormContentType()) + { + return new StatusCodeResult(HttpStatusCode.UnsupportedMediaType); + } + + values = context.Request.Form.AsNameValueCollection(); + } + else + { + return new StatusCodeResult(HttpStatusCode.MethodNotAllowed); + } + + await Task.CompletedTask; return new AuthorizeResult(); } diff --git a/src/Sukt.AuthServer/EndpointRouterHandler/EndpointRouter.cs b/src/Sukt.AuthServer/EndpointRouterHandler/EndpointRouter.cs index 9dccff4..e89b936 100644 --- a/src/Sukt.AuthServer/EndpointRouterHandler/EndpointRouter.cs +++ b/src/Sukt.AuthServer/EndpointRouterHandler/EndpointRouter.cs @@ -33,7 +33,7 @@ public IEndpointHandler FindHandler(HttpContext context) if (context.Request.Path.Equals(handlerpath, StringComparison.OrdinalIgnoreCase)) { var endpointName = endpoint.Name; - _logger.LogDebug("请求路由地址与端点路由匹配成功!", context.Request.Path, endpointName); + _logger.LogDebug("请求路由地址与端点路由匹配成功!{}", new object[] { context.Request.Path, endpointName }); return GetEndpointHandler(endpoint, context); } } @@ -51,10 +51,10 @@ private IEndpointHandler GetEndpointHandler(Endpoint endpoint, HttpContext conte //获取处理器 if (context.RequestServices.GetService(endpoint.Handler) is IEndpointHandler handler) { - _logger.LogDebug("处理器获取成功!", endpoint.Name, endpoint.Handler.FullName); + _logger.LogDebug("处理器获取成功!{}",new object[] { endpoint.Name, endpoint.Handler.FullName }); return handler; } - _logger.LogDebug("处理器获取失败!", endpoint.Name, endpoint.Handler.FullName); + _logger.LogDebug("处理器获取失败!{}", new object[] { endpoint.Name, endpoint.Handler.FullName }); return null; } } diff --git a/src/Sukt.AuthServer/Generator/DefaultTokenCreationService.cs b/src/Sukt.AuthServer/Generator/DefaultTokenCreationService.cs index 103098b..69e1f14 100644 --- a/src/Sukt.AuthServer/Generator/DefaultTokenCreationService.cs +++ b/src/Sukt.AuthServer/Generator/DefaultTokenCreationService.cs @@ -7,7 +7,6 @@ using Microsoft.IdentityModel.Tokens; using Microsoft.AspNetCore.Authentication; using Microsoft.Extensions.Logging; -using Sukt.AuthServer.Extensions; using static Sukt.Module.Core.SuktAuthServerConstants; using System.Text.Json; using Sukt.Module.Core; @@ -53,7 +52,7 @@ protected virtual async Task CreateHeaderAsync(TokenRequest request) Logger.LogWarning("Certificate {subjectName} has expired on {expiration}", cert.Subject, cert.NotAfter.ToString(CultureInfo.InvariantCulture)); } - header["x5t"] = Base64Url.Encode(cert.GetCertHash()); + header["x5t"] = Sukt.AuthServer.Extensions.Base64Url.Encode(cert.GetCertHash()); } if (request.Type == TokenTypes.AccessToken) { diff --git a/src/Sukt.AuthServer/Sukt.AuthServer.csproj b/src/Sukt.AuthServer/Sukt.AuthServer.csproj index 5434096..701c38f 100644 --- a/src/Sukt.AuthServer/Sukt.AuthServer.csproj +++ b/src/Sukt.AuthServer/Sukt.AuthServer.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 @@ -11,8 +11,8 @@ - - + + diff --git a/src/Sukt.AuthServer/Validation/ImplicitGrantType/AuthorizeRequestValidator.cs b/src/Sukt.AuthServer/Validation/ImplicitGrantType/AuthorizeRequestValidator.cs deleted file mode 100644 index 15ed796..0000000 --- a/src/Sukt.AuthServer/Validation/ImplicitGrantType/AuthorizeRequestValidator.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.Extensions.Logging; -using Sukt.AuthServer.Domain.SuktAuthServer.SuktApplicationStore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Sukt.AuthServer.Validation -{ - public class AuthorizeRequestValidator: IAuthorizeRequestValidator - { - private readonly ISuktApplicationStore _suktApplicationStore; - private readonly ILogger _logger; - } -} diff --git a/src/Sukt.AuthServer/Validation/ImplicitGrantType/IAuthorizeRequestValidator.cs b/src/Sukt.AuthServer/Validation/ImplicitGrantType/IAuthorizeRequestValidator.cs deleted file mode 100644 index 683c054..0000000 --- a/src/Sukt.AuthServer/Validation/ImplicitGrantType/IAuthorizeRequestValidator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Sukt.AuthServer.Validation -{ - public interface IAuthorizeRequestValidator - { - - } -} diff --git a/src/Sukt.AuthServerHost/Sukt.AuthServerHost.csproj b/src/Sukt.AuthServerHost/Sukt.AuthServerHost.csproj index 89cd786..4ca8bdd 100644 --- a/src/Sukt.AuthServerHost/Sukt.AuthServerHost.csproj +++ b/src/Sukt.AuthServerHost/Sukt.AuthServerHost.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 4dcd749b-8b18-4224-9313-98f3edb84a42 Linux ..\.. @@ -9,7 +9,7 @@ - + diff --git a/src/Sukt.AuthServerHost/appsettings.Development.json b/src/Sukt.AuthServerHost/appsettings.Development.json index 8e57dc5..c8750e1 100644 --- a/src/Sukt.AuthServerHost/appsettings.Development.json +++ b/src/Sukt.AuthServerHost/appsettings.Development.json @@ -52,7 +52,7 @@ //"IInterceptorsModule": "Sukt.Core.Application.Contracts", //AOPҪIJ㣻λøĿȥ;Ƿӿڲ "Cors": { "PolicyName": "SuktCore.API", - "Url": "http://localhost:8080,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084" ////ֶ֧˿ڣע˿ںźҪ/бˣlocalhost:8000/Ǵ + "Url": "http://localhost:8080,http://localhost:8081,http://localhost:8082,http://localhost:8083,http://localhost:8084,http://localhost:6017" ////ֶ֧˿ڣע˿ںźҪ/бˣlocalhost:8000/Ǵ }, "Migrations": { "IsAutoMigration": true, //ǷԶǨ diff --git a/src/Sukt.Core.API/Startups/SuktAppWebModule.cs b/src/Sukt.Core.API/Startups/SuktAppWebModule.cs index 4651437..60867b6 100644 --- a/src/Sukt.Core.API/Startups/SuktAppWebModule.cs +++ b/src/Sukt.Core.API/Startups/SuktAppWebModule.cs @@ -67,7 +67,7 @@ public override void ConfigureServices(ConfigureServicesContext context) var basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath; //获取项目路径 context.Services.AddSingleton(new PhysicalFileProvider(basePath)); service.Configure(configuration.GetSection("SuktCore")); - AppOptionSettings option = new AppOptionSettings(); + AppOptionSettings option = new (); if (configuration != null) { configuration.Bind("SuktCore", option); diff --git a/src/Sukt.Core.API/Sukt.Core.API.csproj b/src/Sukt.Core.API/Sukt.Core.API.csproj index de28057..b07abb4 100644 --- a/src/Sukt.Core.API/Sukt.Core.API.csproj +++ b/src/Sukt.Core.API/Sukt.Core.API.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 cceb6c5c-9aca-466d-9fe6-a019e910f92b Linux ..\.. @@ -33,7 +33,7 @@ - + @@ -42,12 +42,12 @@ - + - - - + + + diff --git a/src/Sukt.Core.Application/Sukt.Core.Application.csproj b/src/Sukt.Core.Application/Sukt.Core.Application.csproj index 581b4cc..2d926b6 100644 --- a/src/Sukt.Core.Application/Sukt.Core.Application.csproj +++ b/src/Sukt.Core.Application/Sukt.Core.Application.csproj @@ -1,14 +1,14 @@ - net5.0 + net6.0 - - - + + + diff --git a/src/Sukt.Core.AuthenticationCenter/Sukt.Core.AuthenticationCenter.csproj b/src/Sukt.Core.AuthenticationCenter/Sukt.Core.AuthenticationCenter.csproj index eeb6da0..20a2268 100644 --- a/src/Sukt.Core.AuthenticationCenter/Sukt.Core.AuthenticationCenter.csproj +++ b/src/Sukt.Core.AuthenticationCenter/Sukt.Core.AuthenticationCenter.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 0a03eb02-23b5-4147-8cf1-b319d806e1f9 Linux ..\.. diff --git a/src/Sukt.Core.Domain.Models/Sukt.Core.Domain.Models.csproj b/src/Sukt.Core.Domain.Models/Sukt.Core.Domain.Models.csproj index e77c33e..d607fee 100644 --- a/src/Sukt.Core.Domain.Models/Sukt.Core.Domain.Models.csproj +++ b/src/Sukt.Core.Domain.Models/Sukt.Core.Domain.Models.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 diff --git a/src/Sukt.Core.Domain.Services/Sukt.Core.Domain.Services.csproj b/src/Sukt.Core.Domain.Services/Sukt.Core.Domain.Services.csproj index 5c6194f..1d93de4 100644 --- a/src/Sukt.Core.Domain.Services/Sukt.Core.Domain.Services.csproj +++ b/src/Sukt.Core.Domain.Services/Sukt.Core.Domain.Services.csproj @@ -1,7 +1,7 @@ - net5.0 + net6.0 diff --git a/src/Sukt.Core.Dtos/Menu/MenuInputDto.cs b/src/Sukt.Core.Dtos/Menu/MenuInputDto.cs index 0a12cb0..5a3559c 100644 --- a/src/Sukt.Core.Dtos/Menu/MenuInputDto.cs +++ b/src/Sukt.Core.Dtos/Menu/MenuInputDto.cs @@ -13,13 +13,13 @@ public class MenuInputDto /// 菜单名称 /// [DisplayName("菜单名称")] - public string Name { get; set; } + public string Name { get; set; } = ""; /// /// 路由地址(前端) /// [DisplayName("路由")] - public string Path { get; set; } + public string Path { get; set; } = ""; /// /// 父级菜单ID @@ -31,25 +31,25 @@ public class MenuInputDto /// 菜单图标 /// [DisplayName("菜单图标")] - public string Icon { get; set; } + public string Icon { get; set; } = ""; /// /// 当前菜单以上所有的父级 /// [DisplayName("当前菜单以上所有的父级")] - public string ParentNumber { get; set; } + public string ParentNumber { get; set; } = ""; /// /// 组件地址 /// [DisplayName("组件地址")] - public string Component { get; set; } + public string Component { get; set; } = ""; /// /// 组件名称 /// [DisplayName("组件名称")] - public string ComponentName { get; set; } + public string ComponentName { get; set; } = ""; /// /// 是否显示 @@ -79,7 +79,7 @@ public class MenuInputDto /// 当前菜单对应的子应用 /// [DisplayName("菜单对应子应用")] - public string MicroName { get; set; } + public string MicroName { get; set; } = ""; /// /// API接口id /// diff --git a/src/Sukt.Core.Dtos/Sukt.Core.Dtos.csproj b/src/Sukt.Core.Dtos/Sukt.Core.Dtos.csproj index 6c3c520..42dc004 100644 --- a/src/Sukt.Core.Dtos/Sukt.Core.Dtos.csproj +++ b/src/Sukt.Core.Dtos/Sukt.Core.Dtos.csproj @@ -1,7 +1,9 @@ - + - net5.0 + net6.0 + enable + diff --git a/src/Sukt.Core.EntityFrameworkCore/Sukt.Core.EntityFrameworkCore.csproj b/src/Sukt.Core.EntityFrameworkCore/Sukt.Core.EntityFrameworkCore.csproj index 18fde22..efd9f20 100644 --- a/src/Sukt.Core.EntityFrameworkCore/Sukt.Core.EntityFrameworkCore.csproj +++ b/src/Sukt.Core.EntityFrameworkCore/Sukt.Core.EntityFrameworkCore.csproj @@ -1,14 +1,14 @@  - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + @@ -16,7 +16,7 @@ - net5.0 + net6.0 diff --git a/src/Sukt.Core.Identity/Sukt.Core.Identity.csproj b/src/Sukt.Core.Identity/Sukt.Core.Identity.csproj index f1c14d0..f74572c 100644 --- a/src/Sukt.Core.Identity/Sukt.Core.Identity.csproj +++ b/src/Sukt.Core.Identity/Sukt.Core.Identity.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/Sukt.Core.IdentityServer4Store/Sukt.Core.IdentityServer4Store.csproj b/src/Sukt.Core.IdentityServer4Store/Sukt.Core.IdentityServer4Store.csproj index 41cefca..940f08d 100644 --- a/src/Sukt.Core.IdentityServer4Store/Sukt.Core.IdentityServer4Store.csproj +++ b/src/Sukt.Core.IdentityServer4Store/Sukt.Core.IdentityServer4Store.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 diff --git a/src/Sukt.Core.Shared/Sukt.Core.Shared.csproj b/src/Sukt.Core.Shared/Sukt.Core.Shared.csproj index 21fc96e..4fe534d 100644 --- a/src/Sukt.Core.Shared/Sukt.Core.Shared.csproj +++ b/src/Sukt.Core.Shared/Sukt.Core.Shared.csproj @@ -1,16 +1,16 @@  - net5.0 + net6.0 - - - - - + + + + + diff --git a/test/Sukt.Core.Test/Sukt.Core.Test.csproj b/test/Sukt.Core.Test/Sukt.Core.Test.csproj index bb94f3d..a4b2016 100644 --- a/test/Sukt.Core.Test/Sukt.Core.Test.csproj +++ b/test/Sukt.Core.Test/Sukt.Core.Test.csproj @@ -1,7 +1,7 @@  - net5.0 + net6.0 false @@ -16,11 +16,11 @@ - - - - - + + + + + @@ -41,8 +41,8 @@ - - + + all