Skip to content

Commit

Permalink
feat : 升级到.net 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
KawhiWei committed Nov 10, 2021
1 parent 5c397c0 commit 39b45d7
Show file tree
Hide file tree
Showing 27 changed files with 102 additions and 106 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/sukt-admin-k8s-deployment.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfilepublish
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IdentityModel.AspNetCore.OAuth2Introspection" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/Sukt.AuthServer.Domain/Sukt.AuthServer.Domain.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Sukt.AuthServer/Configuration/ObjectSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
24 changes: 24 additions & 0 deletions src/Sukt.AuthServer/EndpointHandler/AuthorizeEndpoint.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -20,6 +23,27 @@ internal class AuthorizeEndpoint : AuthorizeEndpointBase
/// <returns></returns>
public override async Task<IEndpointResult> 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();
}
Expand Down
6 changes: 3 additions & 3 deletions src/Sukt.AuthServer/EndpointRouterHandler/EndpointRouter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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;
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Sukt.AuthServer/Generator/DefaultTokenCreationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -53,7 +52,7 @@ protected virtual async Task<JwtHeader> 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)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Sukt.AuthServer/Sukt.AuthServer.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.PlatformAbstractions" Version="1.1.0" />
</ItemGroup>

Expand Down

This file was deleted.

This file was deleted.

4 changes: 2 additions & 2 deletions src/Sukt.AuthServerHost/Sukt.AuthServerHost.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>4dcd749b-8b18-4224-9313-98f3edb84a42</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />
<PackageReference Include="Sukt.SeriLog" Version="1.0.19" />
<PackageReference Include="Sukt.SeriLog" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Sukt.AuthServerHost/appsettings.Development.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
//"IInterceptorsModule": "Sukt.Core.Application.Contracts", //AOP需要代理的层;这个位置根据生成项目的名称去做代理;我这里代理的是服务接口层
"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, //是否自动迁移
Expand Down
2 changes: 1 addition & 1 deletion src/Sukt.Core.API/Startups/SuktAppWebModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public override void ConfigureServices(ConfigureServicesContext context)
var basePath = Microsoft.DotNet.PlatformAbstractions.ApplicationEnvironment.ApplicationBasePath; //获取项目路径
context.Services.AddSingleton<IFileProvider>(new PhysicalFileProvider(basePath));
service.Configure<AppOptionSettings>(configuration.GetSection("SuktCore"));
AppOptionSettings option = new AppOptionSettings();
AppOptionSettings option = new ();
if (configuration != null)
{
configuration.Bind("SuktCore", option);
Expand Down
12 changes: 6 additions & 6 deletions src/Sukt.Core.API/Sukt.Core.API.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>cceb6c5c-9aca-466d-9fe6-a019e910f92b</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
Expand Down Expand Up @@ -33,7 +33,7 @@

<ItemGroup>
<PackageReference Include="AspectCore.Extensions.Hosting" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.10" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
Expand All @@ -42,12 +42,12 @@
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.11.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="Sukt.WebSocketServer" Version="1.0.19" />
<PackageReference Include="Sukt.WebSocketServer" Version="1.1.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.3" />
<PackageReference Include="Sukt.AspNetCore" Version="1.0.0" />
<PackageReference Include="Sukt.Swagger" Version="1.0.19" />
<PackageReference Include="Sukt.SeriLog" Version="1.0.19" />
<PackageReference Include="Sukt.AspNetCore" Version="1.0.19" />
<PackageReference Include="Sukt.Swagger" Version="1.1.0" />
<PackageReference Include="Sukt.SeriLog" Version="1.1.0" />
<PackageReference Include="Sukt.AspNetCore" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/Sukt.Core.Application/Sukt.Core.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.ViewFeatures" Version="2.2.0" />
<PackageReference Include="Sukt.MQTransaction" Version="1.0.19" />
<PackageReference Include="Sukt.MQTransaction.RabbitMQ" Version="1.0.19" />
<PackageReference Include="Sukt.Redis" Version="1.0.19" />
<PackageReference Include="Sukt.MQTransaction" Version="1.1.0" />
<PackageReference Include="Sukt.MQTransaction.RabbitMQ" Version="1.1.0" />
<PackageReference Include="Sukt.Redis" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>0a03eb02-23b5-4147-8cf1-b319d806e1f9</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
Expand Down
2 changes: 1 addition & 1 deletion src/Sukt.Core.Domain.Models/Sukt.Core.Domain.Models.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Sukt.Core.Identity\Sukt.Core.Identity.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Sukt.Core.Domain.Models\Sukt.Core.Domain.Models.csproj" />
Expand Down
14 changes: 7 additions & 7 deletions src/Sukt.Core.Dtos/Menu/MenuInputDto.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public class MenuInputDto
/// 菜单名称
/// </summary>
[DisplayName("菜单名称")]
public string Name { get; set; }
public string Name { get; set; } = "";

/// <summary>
/// 路由地址(前端)
/// </summary>
[DisplayName("路由")]
public string Path { get; set; }
public string Path { get; set; } = "";

/// <summary>
/// 父级菜单ID
Expand All @@ -31,25 +31,25 @@ public class MenuInputDto
/// 菜单图标
/// </summary>
[DisplayName("菜单图标")]
public string Icon { get; set; }
public string Icon { get; set; } = "";

/// <summary>
/// 当前菜单以上所有的父级
/// </summary>
[DisplayName("当前菜单以上所有的父级")]
public string ParentNumber { get; set; }
public string ParentNumber { get; set; } = "";

/// <summary>
/// 组件地址
/// </summary>
[DisplayName("组件地址")]
public string Component { get; set; }
public string Component { get; set; } = "";

/// <summary>
/// 组件名称
/// </summary>
[DisplayName("组件名称")]
public string ComponentName { get; set; }
public string ComponentName { get; set; } = "";

/// <summary>
/// 是否显示
Expand Down Expand Up @@ -79,7 +79,7 @@ public class MenuInputDto
/// 当前菜单对应的子应用
/// </summary>
[DisplayName("菜单对应子应用")]
public string MicroName { get; set; }
public string MicroName { get; set; } = "";
/// <summary>
/// API接口id
/// </summary>
Expand Down
6 changes: 4 additions & 2 deletions src/Sukt.Core.Dtos/Sukt.Core.Dtos.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>

</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 39b45d7

Please sign in to comment.