diff --git a/Common.props b/Common.props index b15a115ab8012229510d19a97fd8289c53481f79..7ae77922b994ee169c5881b14d36f24d86a4de53 100644 --- a/Common.props +++ b/Common.props @@ -1,7 +1,7 @@ latest - net8.0 + net9.0 enable enable $(NoWarn);NU1803;NU1507;1701;1702;1591;8002;CS1573; diff --git a/DaprTool.Solution.sln b/DaprTool.Solution.sln index 4eeb4328f59d18c3d25fe7e49109b29ab1334806..0498ee32dec324ddac9041f38ee58c48444b8930 100644 --- a/DaprTool.Solution.sln +++ b/DaprTool.Solution.sln @@ -81,11 +81,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "components", "components", dapr\components\dt-statestore.yaml = dapr\components\dt-statestore.yaml EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "configuration", "configuration", "{F3C8590F-504F-42D5-A120-198B742CCFF6}" - ProjectSection(SolutionItems) = preProject - dapr\configuration\dt-config.yaml = dapr\configuration\dt-config.yaml - EndProjectSection -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{957DAFBB-1DA6-4AB2-BCC3-D984E7C7F4A8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Swagger", "src\BuildingBlocks\Swagger\Swagger.csproj", "{09190F8C-A670-4D83-A692-A89637823BF2}" @@ -405,7 +400,6 @@ Global {90BDC411-E19C-4781-BD46-94C688BE797F} = {E2CF6914-DBA1-47C6-B445-A08560FB8BF9} {5A8422B2-1F0D-41BE-8C30-5810D4C7D448} = {121D78F3-3F0F-4F00-B2C9-3C797653C951} {56D45039-23D5-47CB-B12B-CE4982E85633} = {B75B1640-466C-4BAB-8EEF-2F0B3691FD77} - {F3C8590F-504F-42D5-A120-198B742CCFF6} = {B75B1640-466C-4BAB-8EEF-2F0B3691FD77} {09190F8C-A670-4D83-A692-A89637823BF2} = {121D78F3-3F0F-4F00-B2C9-3C797653C951} {7F1A5FE9-2793-4B98-B817-6D3A7F151609} = {121D78F3-3F0F-4F00-B2C9-3C797653C951} {96AB328E-BA32-499A-AF9B-B7CC67703514} = {DE45A29E-9213-401C-8D14-3157C8784072} diff --git a/Directory.Packages.props b/Directory.Packages.props index a64a94de883bc9266c0ae560d21e49f8b0c2c927..81fd3f750ee123ea3393134735bd0785e95d7d9c 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -10,66 +10,64 @@ - - - - - - + + + + + + - - + + - - - + + - - - - + + + - + - + - - - - + + + + - - - + + + - - - + + + - - - - - - - - - - + + + + + + + + + + - - + + @@ -78,26 +76,26 @@ - - - - - - - - - - + + + + + + + + + + - - - - - - - + + + + + + + @@ -106,17 +104,17 @@ - - - - + + + + - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -128,32 +126,30 @@ - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + - - - - + + + + - + diff --git a/README.md b/README.md index db1c07d33d3e9e5376c60c93adf1ad7efbc71613..8949349153e3c1237babd98b119d10485c12dfe7 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,6 @@ visual studio 2022 p > 本地测试 可插拔组件的时候 请使用 wsl 运行 dotnet run - ### IdentityServer4 #### 数据库准备 diff --git a/build/DaprTool.Solution.AppHost/DaprTool.Solution.AppHost.csproj b/build/DaprTool.Solution.AppHost/DaprTool.Solution.AppHost.csproj index 73f9d48ead0d9938df96d0d5abe1f6e14ac087cb..58c86eeb0ec044a0c3a451399cc542d74202375c 100644 --- a/build/DaprTool.Solution.AppHost/DaprTool.Solution.AppHost.csproj +++ b/build/DaprTool.Solution.AppHost/DaprTool.Solution.AppHost.csproj @@ -7,6 +7,8 @@ DaprToolSolution.AppHost + + diff --git a/build/DaprTool.Solution.AppHost/aspirate-output/docker-compose.yaml b/build/DaprTool.Solution.AppHost/aspirate-output/docker-compose.yaml index bf1eca3592b38477b6223e9bcf85d8112517d50b..f2f7ed7a79e88f6006993e86e53edcd1ca760874 100644 --- a/build/DaprTool.Solution.AppHost/aspirate-output/docker-compose.yaml +++ b/build/DaprTool.Solution.AppHost/aspirate-output/docker-compose.yaml @@ -8,126 +8,133 @@ services: - target: 18888 published: 18888 restart: unless-stopped - admin: - container_name: "admin" - image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/web-admin:1.0.12-alpha1" + auth-sts: + container_name: "auth-sts" + image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/auth-sts:1.0.13-alpha1" environment: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "8080" OTEL_EXPORTER_OTLP_ENDPOINT: "http://aspire-dashboard:18889" - OTEL_SERVICE_NAME: "admin" + OTEL_SERVICE_NAME: "auth-sts" ports: - target: 8080 published: 10000 - target: 8443 published: 10001 restart: unless-stopped - admin-dapr: - network_mode: "service:admin" + auth-sts-dapr: + network_mode: "service:auth-sts" image: "daprio/daprd:latest" command: - "./daprd" - "-app-id" - - "admin" + - "auth-sts" - "-app-port" - "8080" restart: unless-stopped depends_on: - - "admin" - auth-sts: - container_name: "auth-sts" - image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/auth-sts:1.0.12-alpha1" + - "auth-sts" + auth-admin: + container_name: "auth-admin" + image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/auth-admin:1.0.13-alpha1" environment: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "8080" OTEL_EXPORTER_OTLP_ENDPOINT: "http://aspire-dashboard:18889" - OTEL_SERVICE_NAME: "auth-sts" + OTEL_SERVICE_NAME: "auth-admin" ports: - target: 8080 published: 10002 - target: 8443 published: 10003 restart: unless-stopped - auth-sts-dapr: - network_mode: "service:auth-sts" + auth-admin-dapr: + network_mode: "service:auth-admin" image: "daprio/daprd:latest" command: - "./daprd" - "-app-id" - - "auth-sts" + - "auth-admin" - "-app-port" - "8080" restart: unless-stopped depends_on: - - "auth-sts" - auth-admin: - container_name: "auth-admin" - image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/auth-admin:1.0.12-alpha1" + - "auth-admin" + auth-api: + container_name: "auth-api" + image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/auth-api:1.0.13-alpha1" environment: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "8080" OTEL_EXPORTER_OTLP_ENDPOINT: "http://aspire-dashboard:18889" - OTEL_SERVICE_NAME: "auth-admin" + OTEL_SERVICE_NAME: "auth-api" ports: - target: 8080 published: 10004 - target: 8443 published: 10005 restart: unless-stopped - auth-admin-dapr: - network_mode: "service:auth-admin" + auth-api-dapr: + network_mode: "service:auth-api" image: "daprio/daprd:latest" command: - "./daprd" - "-app-id" - - "auth-admin" + - "auth-api" - "-app-port" - "8080" restart: unless-stopped depends_on: - - "auth-admin" - auth-api: - container_name: "auth-api" - image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/auth-api:1.0.12-alpha1" + - "auth-api" + admin: + container_name: "admin" + image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/web-admin:1.0.13-alpha1" environment: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "8080" + services__auth-sts__http__0: "http://auth-sts:8080" + services__auth-api__http__0: "http://auth-api:8080" OTEL_EXPORTER_OTLP_ENDPOINT: "http://aspire-dashboard:18889" - OTEL_SERVICE_NAME: "auth-api" + OTEL_SERVICE_NAME: "admin" ports: - target: 8080 published: 10006 - target: 8443 published: 10007 restart: unless-stopped - auth-api-dapr: - network_mode: "service:auth-api" + admin-dapr: + network_mode: "service:admin" image: "daprio/daprd:latest" command: - "./daprd" - "-app-id" - - "auth-api" + - "admin" - "-app-port" - "8080" restart: unless-stopped depends_on: - - "auth-api" + - "admin" order: container_name: "order" - image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/order-api:1.0.12-alpha1" + image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/order-api:1.0.13-alpha1" environment: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "8080" OTEL_EXPORTER_OTLP_ENDPOINT: "http://aspire-dashboard:18889" OTEL_SERVICE_NAME: "order" ports: @@ -150,12 +157,13 @@ services: - "order" proxy-server: container_name: "proxy-server" - image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/proxy-server:1.0.12-alpha1" + image: "registry.cn-shenzhen.aliyuncs.com/project-workspace/proxy-server:1.0.13-alpha1" environment: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES: "true" OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY: "in_memory" ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true" + HTTP_PORTS: "8080" services__admin__http__0: "http://admin:8080" services__auth-admin__http__0: "http://auth-admin:8080" services__auth-sts__http__0: "http://auth-sts:8080" diff --git a/build/DaprTool.Solution.AppHost/aspirate-state.json b/build/DaprTool.Solution.AppHost/aspirate-state.json index 04e60c573489953f5c33c9fd431f1753662b4432..d71b4fc988414d88dd07eb164b61ea766fd2fdf9 100644 --- a/build/DaprTool.Solution.AppHost/aspirate-state.json +++ b/build/DaprTool.Solution.AppHost/aspirate-state.json @@ -4,7 +4,7 @@ "namespace": "dapr-playground", "containerRegistry": "registry.cn-shenzhen.aliyuncs.com", "containerImageTags": [ - "1.0.12-alpha1", + "1.0.13-alpha1", "latest" ], "imagePullPolicy": "IfNotPresent", diff --git a/build/DaprTool.Solution.AppHost/aspirate.json b/build/DaprTool.Solution.AppHost/aspirate.json index a964fe5bddb44bd212f60c0a4385242568164012..e4f06cb33a51162e0936a13307e649b2c72f2043 100644 --- a/build/DaprTool.Solution.AppHost/aspirate.json +++ b/build/DaprTool.Solution.AppHost/aspirate.json @@ -4,7 +4,7 @@ "Registry": "registry.cn-shenzhen.aliyuncs.com", "RepositoryPrefix": "project-workspace", "Tags": [ - "1.0.7-alpha1", + "1.0.13-alpha1", "latest" ], "Builder": "docker" diff --git a/build/DaprTool.Solution.AppHost/manifest.json b/build/DaprTool.Solution.AppHost/manifest.json index de940a19519bb9e402c6937ad711d65e2a4dd21d..ac761ae3a6ce537b98ae87f8901d6986a5887c81 100644 --- a/build/DaprTool.Solution.AppHost/manifest.json +++ b/build/DaprTool.Solution.AppHost/manifest.json @@ -1,13 +1,15 @@ { + "$schema": "https://json.schemastore.org/aspire-8.0.json", "resources": { - "admin": { + "auth-sts": { "type": "project.v0", - "path": "../../src/Web/WebAdmin/WebAdmin.csproj", + "path": "../../src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Idsrv4.Admin.STS.Identity.csproj", "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", - "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true" + "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", + "HTTP_PORTS": "{auth-sts.bindings.http.targetPort}" }, "bindings": { "http": { @@ -24,27 +26,28 @@ } } }, - "admin-dapr": { + "auth-sts-dapr": { "type": "dapr.v0", "dapr": { - "application": "admin", - "appId": "admin", + "application": "auth-sts", + "appId": "auth-sts", "daprHttpMaxRequestSize": 60, - "daprHttpPort": 23301, + "daprHttpPort": 23304, "daprHttpReadBufferSize": 128, "resourcesPath": [ "../../dapr/components" ] } }, - "auth-sts": { + "auth-admin": { "type": "project.v0", - "path": "../../src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Idsrv4.Admin.STS.Identity.csproj", + "path": "../../src/IdentityServer4/src/Idsrv4.Admin/Idsrv4.Admin.csproj", "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", - "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true" + "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", + "HTTP_PORTS": "{auth-admin.bindings.http.targetPort}" }, "bindings": { "http": { @@ -61,27 +64,28 @@ } } }, - "auth-sts-dapr": { + "auth-admin-dapr": { "type": "dapr.v0", "dapr": { - "application": "auth-sts", - "appId": "auth-sts", + "application": "auth-admin", + "appId": "auth-admin", "daprHttpMaxRequestSize": 60, - "daprHttpPort": 23304, + "daprHttpPort": 23303, "daprHttpReadBufferSize": 128, "resourcesPath": [ "../../dapr/components" ] } }, - "auth-admin": { + "auth-api": { "type": "project.v0", - "path": "../../src/IdentityServer4/src/Idsrv4.Admin/Idsrv4.Admin.csproj", + "path": "../../src/IdentityServer4/src/Idsrv4.Admin.Api/Idsrv4.Admin.Api.csproj", "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", - "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true" + "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", + "HTTP_PORTS": "{auth-api.bindings.http.targetPort}" }, "bindings": { "http": { @@ -98,27 +102,32 @@ } } }, - "auth-admin-dapr": { + "auth-api-dapr": { "type": "dapr.v0", "dapr": { - "application": "auth-admin", - "appId": "auth-admin", + "application": "auth-api", + "appId": "auth-api", "daprHttpMaxRequestSize": 60, - "daprHttpPort": 23303, + "daprHttpPort": 23302, "daprHttpReadBufferSize": 128, "resourcesPath": [ "../../dapr/components" ] } }, - "auth-api": { + "admin": { "type": "project.v0", - "path": "../../src/IdentityServer4/src/Idsrv4.Admin.Api/Idsrv4.Admin.Api.csproj", + "path": "../../src/Web/WebAdmin/WebAdmin.csproj", "env": { "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", - "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true" + "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", + "HTTP_PORTS": "{admin.bindings.http.targetPort}", + "services__auth-sts__http__0": "{auth-sts.bindings.http.url}", + "services__auth-sts__https__0": "{auth-sts.bindings.https.url}", + "services__auth-api__http__0": "{auth-api.bindings.http.url}", + "services__auth-api__https__0": "{auth-api.bindings.https.url}" }, "bindings": { "http": { @@ -135,13 +144,13 @@ } } }, - "auth-api-dapr": { + "admin-dapr": { "type": "dapr.v0", "dapr": { - "application": "auth-api", - "appId": "auth-api", + "application": "admin", + "appId": "admin", "daprHttpMaxRequestSize": 60, - "daprHttpPort": 23302, + "daprHttpPort": 23301, "daprHttpReadBufferSize": 128, "resourcesPath": [ "../../dapr/components" @@ -155,7 +164,8 @@ "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", - "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true" + "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", + "HTTP_PORTS": "{order.bindings.http.targetPort}" }, "bindings": { "http": { @@ -193,6 +203,7 @@ "OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES": "true", "OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY": "in_memory", "ASPNETCORE_FORWARDEDHEADERS_ENABLED": "true", + "HTTP_PORTS": "{proxy-server.bindings.http.targetPort}", "services__admin__http__0": "{admin.bindings.http.url}", "services__admin__https__0": "{admin.bindings.https.url}", "services__auth-admin__http__0": "{auth-admin.bindings.http.url}", diff --git a/dapr/components/dt-configurationstore.yaml b/dapr/components/dt-configurationstore.yaml index a25b2758b66edefb1fab931a2ce7525f5a06ac91..d86e2b5ec347f6e3c338bfebce629e52ede27b33 100644 --- a/dapr/components/dt-configurationstore.yaml +++ b/dapr/components/dt-configurationstore.yaml @@ -8,8 +8,8 @@ spec: version: v1 metadata: - name: connectionString - value: "host=192.168.8.111 user=dapr password=Local@Db port=5432 connect_timeout=10 database=dapr_manager" + value: "host=192.168.10.111 user=dapr password=Local@Db port=5432 connect_timeout=10 database=dapr_manager" - name: table # name of the table which holds configuration information - value: "dapr_appsettings" + value: "appsettings" - name: connMaxIdleTime # max timeout for connection value : "15s" diff --git a/samples/Client/SampleClient.csproj b/samples/Client/SampleClient.csproj index 46d44bffcbdbae2c6a11414e35f2b6028c5c3a18..e9d7cb63577f98ed5439a5b8d4ab685278a8cdec 100644 --- a/samples/Client/SampleClient.csproj +++ b/samples/Client/SampleClient.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net9.0 enable enable diff --git a/samples/Interfaces/SampleInterfaces.csproj b/samples/Interfaces/SampleInterfaces.csproj index db850d85a0515174b813ecdbb1f2dbf2d90d2e74..9d365666e8d5f37795bef7d0b0111f8d764c5ec1 100644 --- a/samples/Interfaces/SampleInterfaces.csproj +++ b/samples/Interfaces/SampleInterfaces.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable diff --git a/samples/Service/SampleService.csproj b/samples/Service/SampleService.csproj index b81c4e04e28d3360c4f2159c462c6c5ed0e09399..f6710778dfe12e8c79c269b007a03e3ae9815aa3 100644 --- a/samples/Service/SampleService.csproj +++ b/samples/Service/SampleService.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable diff --git a/src/BuildingBlocks/ApiExtensions/ApiExtensions.xml b/src/BuildingBlocks/ApiExtensions/ApiExtensions.xml index 87a4ff264ce43f2cbdad5c9eac850d97398f19a0..4b870090e5e11eb7f18335f15c6b2d34939c33fb 100644 --- a/src/BuildingBlocks/ApiExtensions/ApiExtensions.xml +++ b/src/BuildingBlocks/ApiExtensions/ApiExtensions.xml @@ -297,6 +297,26 @@ + + + Action执行之后的事件 + + + + + + Action执行前检查数据模型是否通过验证 + + + + + + 获取验证模型的错误消息 + + + + + 统一返回格式的内容的Fileter diff --git a/src/BuildingBlocks/ApiExtensions/Filters/ModelStateFilter.cs b/src/BuildingBlocks/ApiExtensions/Filters/ModelStateFilter.cs new file mode 100644 index 0000000000000000000000000000000000000000..3e7e865eb825ce7d14d85796373e05078e397603 --- /dev/null +++ b/src/BuildingBlocks/ApiExtensions/Filters/ModelStateFilter.cs @@ -0,0 +1,62 @@ +using DaprTool.BuildingBlocks.Utils; +using DaprTool.BuildingBlocks.Utils.ValueObjects; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace Microsoft.AspNetCore.Mvc.Filters; + +public class ModelStateFilter : IActionFilter +{ + #region Action执行之后的事件 + + /// + /// Action执行之后的事件 + /// + /// + public void OnActionExecuted(ActionExecutedContext context) + { + } + + #endregion + + #region Action执行前检查数据模型是否通过验证 + + /// + /// Action执行前检查数据模型是否通过验证 + /// + /// + public void OnActionExecuting(ActionExecutingContext context) + { + if (context.ModelState.IsValid) return; + + var version = context.HttpContext.GetRequestedApiVersion()?.ToString() ?? "1.0"; + var traceId = context.HttpContext.TraceIdentifier; + context.Result = new OkObjectResult(ResponseResult.Failed(ErrorCode.ArgumentException, version, traceId, + context.ModelState.GetErrorMessage())); + } + + #endregion +} + +public static class ModelStateExtensions +{ + #region 获取验证模型的错误消息 + + /// + /// 获取验证模型的错误消息 + /// + /// + /// + /// + public static string GetErrorMessage(this ModelStateDictionary state, string split = ";") + { + var errors = state + .Where(e => e.Value != null && e.Value.Errors.Any()) + .Select(m + => $"{string.Join(",", m.Value?.Errors?.Select(error => error.ErrorMessage) ?? new[] { "" })} [{m.Key}]"); + + return string.Join(split, errors); + } + + #endregion +} \ No newline at end of file diff --git a/src/BuildingBlocks/ApiExtensions/Middleware/ResultMiddleware.cs b/src/BuildingBlocks/ApiExtensions/Middleware/ResultMiddleware.cs new file mode 100644 index 0000000000000000000000000000000000000000..8af9ab8367c0b944a98653eb830c7a3f576080f6 --- /dev/null +++ b/src/BuildingBlocks/ApiExtensions/Middleware/ResultMiddleware.cs @@ -0,0 +1,80 @@ +using System.Reflection; +using DaprTool.BuildingBlocks.Utils.ValueObjects; +using DaprTool.BuildingBlocks.Utils; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc; +using Asp.Versioning; + +namespace DaprTool.BuildingBlocks.ApiExtensions.Middleware; + + +public class ResultMiddleware(RequestDelegate next) +{ + public async Task InvokeAsync(HttpContext context) + { + // Call the next middleware in the pipeline + await next(context); + + // After the response is created, process it + if (context.Response.HasStarted) + { + return; + } + + var endpoint = context.GetEndpoint(); + var actionDescriptor = endpoint?.Metadata?.GetMetadata(); + + if (actionDescriptor != null) + { + var controlsProduces = actionDescriptor.ControllerTypeInfo.GetCustomAttribute(); + var actionProduces = actionDescriptor.MethodInfo.GetCustomAttribute(); + if (controlsProduces is null && actionProduces is null && !(context.Response.ContentType?.Contains("text/html") ?? false)) + { + var version = context.GetRequestedApiVersion(1).ToString(); + var traceId = context.TraceIdentifier; + object? returnObject = null; + + if (context.Response.StatusCode == StatusCodes.Status200OK) + { + if (context.Response.Body.Length > 0) + { + // Assuming the response body is JSON serialized and deserializing it. + context.Response.Body.Seek(0, System.IO.SeekOrigin.Begin); + using (var reader = new System.IO.StreamReader(context.Response.Body)) + { + var responseBody = await reader.ReadToEndAsync(); + returnObject = ResponseResult.Succeed(responseBody, version, traceId); + } + } + else + { + returnObject = ResponseResult.Succeed(version: version, traceId: traceId); + } + } + else if (context.Response.StatusCode != StatusCodes.Status204NoContent) + { + returnObject = ResponseResult.Failed(ErrorCode.Unknown, $"Http Code: {context.Response.StatusCode}", version, traceId); + } + + if (returnObject != null) + { + context.Response.ContentType = "application/json"; + context.Response.Body.Seek(0, System.IO.SeekOrigin.Begin); + await context.Response.WriteAsync(System.Text.Json.JsonSerializer.Serialize(returnObject)); + } + } + } + } +} + +// Extension method used to add the middleware to the HTTP request pipeline. + +public static class HttpContextExtensions +{ + public static ApiVersion GetRequestedApiVersion(this HttpContext context, int defaultVersion) + { + var ver = context.GetRequestedApiVersion(); + return ver ?? new ApiVersion(defaultVersion, 0); + } +} \ No newline at end of file diff --git a/src/BuildingBlocks/ApiExtensions/Middleware/ResultMiddlewareExtensions.cs b/src/BuildingBlocks/ApiExtensions/Middleware/ResultMiddlewareExtensions.cs new file mode 100644 index 0000000000000000000000000000000000000000..4028e143eb3595272ac2bf44bf51d113e2b77fe5 --- /dev/null +++ b/src/BuildingBlocks/ApiExtensions/Middleware/ResultMiddlewareExtensions.cs @@ -0,0 +1,11 @@ +using DaprTool.BuildingBlocks.ApiExtensions.Middleware; + +namespace Microsoft.AspNetCore.Builder; + +public static class ResultMiddlewareExtensions +{ + public static IApplicationBuilder UseResultMiddleware(this IApplicationBuilder builder) + { + return builder.UseMiddleware(); + } +} \ No newline at end of file diff --git a/src/BuildingBlocks/ApiExtensions/WebApplicationExtensions.cs b/src/BuildingBlocks/ApiExtensions/WebApplicationExtensions.cs index 5010217d2ef1a2694adbb840e5196e1c77b97e73..0d5bcd2d830446059fa95b5440684c04ea50dafb 100644 --- a/src/BuildingBlocks/ApiExtensions/WebApplicationExtensions.cs +++ b/src/BuildingBlocks/ApiExtensions/WebApplicationExtensions.cs @@ -33,7 +33,10 @@ public static class WebApplicationExtensions builder.Services.AddControllers(options => { // 注册过滤器 + // 数模模型检查过滤器 + // options.Filters.Add(new ModelStateFilter()); // options.Filters.Add(); + // 返回结果处理过滤器 (改用 Middleware/ResultMiddleware) options.Filters.Add(new ResultFilter(AspNetCore.Mvc.AppConstants.ResponseJsonContentType)); }); // 注册 自动依赖注入 diff --git a/src/IdentityServer4/src/Idsrv4.Admin.Api/Helpers/StartupHelpers.cs b/src/IdentityServer4/src/Idsrv4.Admin.Api/Helpers/StartupHelpers.cs index 11f2020a30e192b31aa079689c8911873c73e043..039bd0b0f947430059ea657bf5de87f4ee63b3d4 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.Api/Helpers/StartupHelpers.cs +++ b/src/IdentityServer4/src/Idsrv4.Admin.Api/Helpers/StartupHelpers.cs @@ -17,9 +17,7 @@ using Idsrv4.Admin.Api.Configuration.Constants; using Idsrv4.Admin.Api.Helpers.Localization; using Idsrv4.Admin.BusinessLogic.Identity.Dtos.Identity; using Idsrv4.Admin.EntityFramework.Configuration.Configuration; -using Idsrv4.Admin.EntityFramework.Configuration.MySql; using Idsrv4.Admin.EntityFramework.Configuration.PostgreSQL; -using Idsrv4.Admin.EntityFramework.Configuration.SqlServer; using Idsrv4.Admin.EntityFramework.Helpers; using Idsrv4.Admin.EntityFramework.Interfaces; using Idsrv4.Admin.AuditLogging.EntityFramework.DbContexts; diff --git a/src/IdentityServer4/src/Idsrv4.Admin.Api/Idsrv4.Admin.Api.csproj b/src/IdentityServer4/src/Idsrv4.Admin.Api/Idsrv4.Admin.Api.csproj index f2ab51e630800a3dd1dfec05dcf14cf88771bc39..2eb936e85afe8ddb148ddeaa6d03d66ba40fbb11 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.Api/Idsrv4.Admin.Api.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.Api/Idsrv4.Admin.Api.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 1cc472a2-4e4b-48ce-846b-5219f71fc643 false auth-api @@ -8,10 +8,8 @@ mcr.microsoft.com/dotnet/aspnet:8.0 - - diff --git a/src/IdentityServer4/src/Idsrv4.Admin.Api/appsettings.json b/src/IdentityServer4/src/Idsrv4.Admin.Api/appsettings.json index 06a8a13578dcc4bfadb666d22f400fa3f7de99a9..3a6e015a70ab9e568538d79b409f3994114abc1f 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.Api/appsettings.json +++ b/src/IdentityServer4/src/Idsrv4.Admin.Api/appsettings.json @@ -1,11 +1,11 @@ { "ConnectionStrings": { - "ConfigurationDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "PersistedGrantDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "IdentityDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminLogDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminAuditLogDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "DataProtectionDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "ConfigurationDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "PersistedGrantDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "IdentityDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "AdminLogDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "AdminAuditLogDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "DataProtectionDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" }, "AdminApiConfiguration": { "ApiName": "IdentityServer4 Admin Api", diff --git a/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging.EntityFramework/Idsrv4.Admin.AuditLogging.EntityFramework.csproj b/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging.EntityFramework/Idsrv4.Admin.AuditLogging.EntityFramework.csproj index 1815f1806368f64fae3753635f0197ad039bcb7c..fb682eab4ddd872920a3300c3829ebae98f339eb 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging.EntityFramework/Idsrv4.Admin.AuditLogging.EntityFramework.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging.EntityFramework/Idsrv4.Admin.AuditLogging.EntityFramework.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 diff --git a/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Helpers/HttpContextHelpers/HttpContextHelpers.cs b/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Helpers/HttpContextHelpers/HttpContextHelpers.cs index 715e7c5807d68768c14e6cb4bc56e055ff3adc48..f38b1b185b20e3603235d0e64d1b32bbf9b16622 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Helpers/HttpContextHelpers/HttpContextHelpers.cs +++ b/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Helpers/HttpContextHelpers/HttpContextHelpers.cs @@ -38,7 +38,7 @@ namespace Idsrv4.Admin.AuditLogging.Helpers.HttpContextHelpers IDictionary dict = new Dictionary(); foreach (var k in col) { - dict.Add(k.Key, string.Join(", ", k.Value)); + dict.Add(k.Key, string.Join(", ", k.Value.ToString())); } return dict; } diff --git a/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Idsrv4.Admin.AuditLogging.csproj b/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Idsrv4.Admin.AuditLogging.csproj index 91c8c8495b32a55cec8bd6e24853f765dadbc9fd..82f63163de48e4d0bc82e5b00d4861d372c33906 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Idsrv4.Admin.AuditLogging.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.AuditLogging/Idsrv4.Admin.AuditLogging.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Identity/Idsrv4.Admin.BusinessLogic.Identity.csproj b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Identity/Idsrv4.Admin.BusinessLogic.Identity.csproj index 35e35544195a90cb1acba2bd854a17a4916c0379..d7a716be3b86e733254e670826821fcdf9a44800 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Identity/Idsrv4.Admin.BusinessLogic.Identity.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Identity/Idsrv4.Admin.BusinessLogic.Identity.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Business Logic layer for the administration of the Asp.Net Core Identity and IdentityServer4 diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Shared/Idsrv4.Admin.BusinessLogic.Shared.csproj b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Shared/Idsrv4.Admin.BusinessLogic.Shared.csproj index 58d5df15bbf8c3a11be6a9d0ebe09ac2f915ebc8..9bfa3265465cd8e882043eba14572d83365080f1 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Shared/Idsrv4.Admin.BusinessLogic.Shared.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic.Shared/Idsrv4.Admin.BusinessLogic.Shared.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Shared Business Logic layer for the administration of the IdentityServer4 and Asp.Net Core Identity \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Idsrv4.Admin.BusinessLogic.csproj b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Idsrv4.Admin.BusinessLogic.csproj index 3adfca6fc2d98226c8751904ae30d2798318d25f..20ac6c5772de275c239361de38ed805a14c4f3ab 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Idsrv4.Admin.BusinessLogic.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.BusinessLogic/Idsrv4.Admin.BusinessLogic.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Business Logic layer for the administration of the IdentityServer4 diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/Idsrv4.Admin.EntityFramework.Configuration.csproj b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/Idsrv4.Admin.EntityFramework.Configuration.csproj index f4c8155b5aa2af1444648cd338cf7e5db9f6c58b..874a97779779a3689e676eba56ccc6f2261238ea 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/Idsrv4.Admin.EntityFramework.Configuration.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/Idsrv4.Admin.EntityFramework.Configuration.csproj @@ -1,14 +1,11 @@ - net8.0 + net9.0 Entity Framework configuration for the administration of the IdentityServer4 and Asp.Net Core Identity - - - diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/MySql/DatabaseExtensions.cs b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/MySql/DatabaseExtensions.cs deleted file mode 100644 index 4ba7e49819ed3c38beb720be3cc1cff89bffca76..0000000000000000000000000000000000000000 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/MySql/DatabaseExtensions.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System.Reflection; -using IdentityServer4.EntityFramework.Storage; -using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Idsrv4.Admin.EntityFramework.Configuration.Configuration; -using Idsrv4.Admin.EntityFramework.Interfaces; -using Idsrv4.Admin.AuditLogging.EntityFramework.DbContexts; -using Idsrv4.Admin.AuditLogging.EntityFramework.Entities; - -namespace Idsrv4.Admin.EntityFramework.Configuration.MySql; - -public static class DatabaseExtensions -{ - /// - /// Register DbContexts for IdentityServer ConfigurationStore and PersistedGrants, Identity and Logging - /// Configure the connection strings in AppSettings.json - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void RegisterMySqlDbContexts( - this IServiceCollection services, - ConnectionStringsConfiguration connectionStrings, - DatabaseMigrationsConfiguration databaseMigrations) - where TIdentityDbContext : DbContext - where TPersistedGrantDbContext : DbContext, IAdminPersistedGrantDbContext - where TConfigurationDbContext : DbContext, IAdminConfigurationDbContext - where TLogDbContext : DbContext, IAdminLogDbContext - where TAuditLoggingDbContext : DbContext, IAuditLoggingDbContext - where TDataProtectionDbContext : DbContext, IDataProtectionKeyContext - where TAuditLog : AuditLog - { - var migrationsAssembly = typeof(DatabaseExtensions).GetTypeInfo().Assembly.GetName().Name; - - // Config DB for identity - services.AddDbContext(options => - options.UseMySql(connectionStrings.IdentityDbConnection, - ServerVersion.AutoDetect(connectionStrings.IdentityDbConnection), - sql => sql.MigrationsAssembly(databaseMigrations.IdentityDbMigrationsAssembly ?? migrationsAssembly))); - - // Config DB from existing connection - services.AddConfigurationDbContext(options => - options.ConfigureDbContext = b => - b.UseMySql(connectionStrings.ConfigurationDbConnection, - ServerVersion.AutoDetect(connectionStrings.ConfigurationDbConnection), - sql => sql.MigrationsAssembly(databaseMigrations.ConfigurationDbMigrationsAssembly ?? - migrationsAssembly))); - - // Operational DB from existing connection - services.AddOperationalDbContext(options => options.ConfigureDbContext = b => - b.UseMySql(connectionStrings.PersistedGrantDbConnection, - ServerVersion.AutoDetect(connectionStrings.PersistedGrantDbConnection), - sql => sql.MigrationsAssembly(databaseMigrations.PersistedGrantDbMigrationsAssembly ?? - migrationsAssembly))); - - // Log DB from existing connection - services.AddDbContext(options => options.UseMySql(connectionStrings.AdminLogDbConnection, - ServerVersion.AutoDetect(connectionStrings.AdminLogDbConnection), - optionsSql => optionsSql.MigrationsAssembly(databaseMigrations.AdminLogDbMigrationsAssembly ?? - migrationsAssembly))); - - // Audit logging connection - services.AddDbContext(options => options.UseMySql( - connectionStrings.AdminAuditLogDbConnection, - ServerVersion.AutoDetect(connectionStrings.AdminAuditLogDbConnection), - optionsSql => optionsSql.MigrationsAssembly(databaseMigrations.AdminAuditLogDbMigrationsAssembly ?? - migrationsAssembly))); - - // DataProtectionKey DB from existing connection - if (!string.IsNullOrEmpty(connectionStrings.DataProtectionDbConnection)) - services.AddDbContext(options => options.UseMySql( - connectionStrings.DataProtectionDbConnection, - ServerVersion.AutoDetect(connectionStrings.DataProtectionDbConnection), - optionsSql => optionsSql.MigrationsAssembly(databaseMigrations.DataProtectionDbMigrationsAssembly ?? - migrationsAssembly))); - } - - /// - /// Register DbContexts for IdentityServer ConfigurationStore and PersistedGrants and Identity - /// Configure the connection strings in AppSettings.json - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void RegisterMySqlDbContexts(this IServiceCollection services, - string identityConnectionString, string configurationConnectionString, - string persistedGrantConnectionString, string dataProtectionConnectionString) - where TIdentityDbContext : DbContext - where TPersistedGrantDbContext : DbContext, IAdminPersistedGrantDbContext - where TConfigurationDbContext : DbContext, IAdminConfigurationDbContext - where TDataProtectionDbContext : DbContext, IDataProtectionKeyContext - { - var migrationsAssembly = typeof(DatabaseExtensions).GetTypeInfo().Assembly.GetName().Name; - - // Config DB for identity - services.AddDbContext(options => options.UseMySql(identityConnectionString, - ServerVersion.AutoDetect(identityConnectionString), sql => sql.MigrationsAssembly(migrationsAssembly))); - - // Config DB from existing connection - services.AddConfigurationDbContext(options => options.ConfigureDbContext = b - => b.UseMySql(configurationConnectionString, ServerVersion.AutoDetect(configurationConnectionString), - sql => sql.MigrationsAssembly(migrationsAssembly))); - - // Operational DB from existing connection - services.AddOperationalDbContext(options => options.ConfigureDbContext = b - => b.UseMySql(persistedGrantConnectionString, ServerVersion.AutoDetect(persistedGrantConnectionString), - sql => sql.MigrationsAssembly(migrationsAssembly))); - - // DataProtectionKey DB from existing connection - services.AddDbContext(options => options.UseMySql(dataProtectionConnectionString, - ServerVersion.AutoDetect(dataProtectionConnectionString), - optionsSql => optionsSql.MigrationsAssembly(migrationsAssembly))); - } -} \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/SqlServer/DatabaseExtensions.cs b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/SqlServer/DatabaseExtensions.cs deleted file mode 100644 index 55b05e7e68cfb14ad4902c5923add594d9ce0190..0000000000000000000000000000000000000000 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Configuration/SqlServer/DatabaseExtensions.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System.Reflection; -using IdentityServer4.EntityFramework.Storage; -using Microsoft.AspNetCore.DataProtection.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using Idsrv4.Admin.EntityFramework.Configuration.Configuration; -using Idsrv4.Admin.EntityFramework.Interfaces; -using Idsrv4.Admin.AuditLogging.EntityFramework.DbContexts; -using Idsrv4.Admin.AuditLogging.EntityFramework.Entities; - -namespace Idsrv4.Admin.EntityFramework.Configuration.SqlServer; - -public static class DatabaseExtensions -{ - /// - /// Register DbContexts for IdentityServer ConfigurationStore and PersistedGrants, Identity and Logging - /// Configure the connection strings in AppSettings.json - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void RegisterSqlServerDbContexts( - this IServiceCollection services, - ConnectionStringsConfiguration connectionStrings, - DatabaseMigrationsConfiguration databaseMigrations) - where TIdentityDbContext : DbContext - where TPersistedGrantDbContext : DbContext, IAdminPersistedGrantDbContext - where TConfigurationDbContext : DbContext, IAdminConfigurationDbContext - where TLogDbContext : DbContext, IAdminLogDbContext - where TAuditLoggingDbContext : DbContext, IAuditLoggingDbContext - where TDataProtectionDbContext : DbContext, IDataProtectionKeyContext - where TAuditLog : AuditLog - { - var migrationsAssembly = typeof(DatabaseExtensions).GetTypeInfo().Assembly.GetName().Name; - - // Config DB for identity - services.AddDbContext(options - => options.UseSqlServer(connectionStrings.IdentityDbConnection, - sql => sql.MigrationsAssembly(databaseMigrations.IdentityDbMigrationsAssembly ?? migrationsAssembly))); - - // Config DB from existing connection - services.AddConfigurationDbContext(options => options.ConfigureDbContext = b - => b.UseSqlServer(connectionStrings.ConfigurationDbConnection, - sql => sql.MigrationsAssembly( - databaseMigrations.ConfigurationDbMigrationsAssembly ?? migrationsAssembly))); - - // Operational DB from existing connection - services.AddOperationalDbContext(options => options.ConfigureDbContext = b - => b.UseSqlServer(connectionStrings.PersistedGrantDbConnection, - sql => sql.MigrationsAssembly(databaseMigrations.PersistedGrantDbMigrationsAssembly ?? - migrationsAssembly))); - - // Log DB from existing connection - services.AddDbContext(options => options.UseSqlServer(connectionStrings.AdminLogDbConnection, - optionsSql => optionsSql.MigrationsAssembly(databaseMigrations.AdminLogDbMigrationsAssembly ?? - migrationsAssembly))); - - // Audit logging connection - services.AddDbContext(options => options.UseSqlServer( - connectionStrings.AdminAuditLogDbConnection, - optionsSql => optionsSql.MigrationsAssembly(databaseMigrations.AdminAuditLogDbMigrationsAssembly ?? - migrationsAssembly))); - - // DataProtectionKey DB from existing connection - if (!string.IsNullOrEmpty(connectionStrings.DataProtectionDbConnection)) - services.AddDbContext(options => options.UseSqlServer( - connectionStrings.DataProtectionDbConnection, - optionsSql => optionsSql.MigrationsAssembly(databaseMigrations.DataProtectionDbMigrationsAssembly ?? - migrationsAssembly))); - } - - /// - /// Register DbContexts for IdentityServer ConfigurationStore and PersistedGrants and Identity - /// Configure the connection strings in AppSettings.json - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static void RegisterSqlServerDbContexts(this IServiceCollection services, - string identityConnectionString, string configurationConnectionString, - string persistedGrantConnectionString, string dataProtectionConnectionString) - where TIdentityDbContext : DbContext - where TPersistedGrantDbContext : DbContext, IAdminPersistedGrantDbContext - where TConfigurationDbContext : DbContext, IAdminConfigurationDbContext - where TDataProtectionDbContext : DbContext, IDataProtectionKeyContext - { - var migrationsAssembly = typeof(DatabaseExtensions).GetTypeInfo().Assembly.GetName().Name; - - // Config DB for identity - services.AddDbContext(options - => options.UseSqlServer(identityConnectionString, sql => sql.MigrationsAssembly(migrationsAssembly))); - - // Config DB from existing connection - services.AddConfigurationDbContext(options => options.ConfigureDbContext = b - => b.UseSqlServer(configurationConnectionString, sql => sql.MigrationsAssembly(migrationsAssembly))); - - // Operational DB from existing connection - services.AddOperationalDbContext(options => options.ConfigureDbContext = b - => b.UseSqlServer(persistedGrantConnectionString, sql => sql.MigrationsAssembly(migrationsAssembly))); - - // DataProtectionKey DB from existing connection - services.AddDbContext(options - => options.UseSqlServer(dataProtectionConnectionString, sql => sql.MigrationsAssembly(migrationsAssembly))); - } -} \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Extensions/Idsrv4.Admin.EntityFramework.Extensions.csproj b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Extensions/Idsrv4.Admin.EntityFramework.Extensions.csproj index 312485726fab8598c2a2292270a4904744fd484f..bb8ffe4b54f68e79d468e77523f968abac72cdf8 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Extensions/Idsrv4.Admin.EntityFramework.Extensions.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Extensions/Idsrv4.Admin.EntityFramework.Extensions.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 EntityFramework extensions for the administration of the IdentityServer4 and Asp.Net Core Identity \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Identity/Idsrv4.Admin.EntityFramework.Identity.csproj b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Identity/Idsrv4.Admin.EntityFramework.Identity.csproj index d347866815735a6cfe343e14491f69ff281b8560..b13656fb076845c2b97d558c90453662a83fc8fe 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Identity/Idsrv4.Admin.EntityFramework.Identity.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Identity/Idsrv4.Admin.EntityFramework.Identity.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Entity Framework layer for the administration of the Asp.Net Core Identity and IdentityServer4 diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.PostgreSQL/Idsrv4.Admin.EntityFramework.PostgreSQL.csproj b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.PostgreSQL/Idsrv4.Admin.EntityFramework.PostgreSQL.csproj index fc13bee78f21c3836a8f58040c48dc24bd6179a5..883d84c194c166130136983a9c32a1b5bb9c4601 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.PostgreSQL/Idsrv4.Admin.EntityFramework.PostgreSQL.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.PostgreSQL/Idsrv4.Admin.EntityFramework.PostgreSQL.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Entity Framework layer for the administration of the IdentityServer4 and Asp.Net Core Identity with PostrgreSQL support diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Shared/Idsrv4.Admin.EntityFramework.Shared.csproj b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Shared/Idsrv4.Admin.EntityFramework.Shared.csproj index a3be8af7bc654df1fa3eb653e3d11dda741c7de5..3f3e79a6d3af5c6f7328744efe7f78d6c11c3eb7 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Shared/Idsrv4.Admin.EntityFramework.Shared.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework.Shared/Idsrv4.Admin.EntityFramework.Shared.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 DbContexts and Identity entities for the administration of the IdentityServer4 and Asp.Net Core Identity diff --git a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework/Idsrv4.Admin.EntityFramework.csproj b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework/Idsrv4.Admin.EntityFramework.csproj index 0f7e4ddb892763bd6fabeae3a0c1b317dfb8e1ce..8c4681d9ccaf854a46d760efb2b9ec3b1e8ca296 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework/Idsrv4.Admin.EntityFramework.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.EntityFramework/Idsrv4.Admin.EntityFramework.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Entity Framework layer for the administration of the IdentityServer4 diff --git a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Helpers/StartupHelpers.cs b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Helpers/StartupHelpers.cs index 19f32e25b9df17ea4ceccf3189c2c23906ae2322..81afe10e607dd7d9e2f7c11b389b94420e777412 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Helpers/StartupHelpers.cs +++ b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Helpers/StartupHelpers.cs @@ -15,9 +15,7 @@ using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; using Microsoft.Identity.Web; using Idsrv4.Admin.EntityFramework.Configuration.Configuration; -using Idsrv4.Admin.EntityFramework.Configuration.MySql; using Idsrv4.Admin.EntityFramework.Configuration.PostgreSQL; -using Idsrv4.Admin.EntityFramework.Configuration.SqlServer; using Idsrv4.Admin.EntityFramework.Helpers; using Idsrv4.Admin.EntityFramework.Interfaces; using Idsrv4.Admin.Shared.Configuration.Authentication; diff --git a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Idsrv4.Admin.STS.Identity.csproj b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Idsrv4.Admin.STS.Identity.csproj index f88127ade2f039a0091a192e22b79ceef937c47b..6d7ccbd28ae177dbe0e4a05a0ed3a505bfb8b6fe 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Idsrv4.Admin.STS.Identity.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Idsrv4.Admin.STS.Identity.csproj @@ -1,6 +1,6 @@ - + - net8.0 + net9.0 9c91d295-54c5-4d09-9bd6-fa56fb74011b false auth-sts @@ -10,9 +10,7 @@ - - diff --git a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Program.cs b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Program.cs index 4761ea8fa687672914aa41a3adf95d1c94490f87..7f1e0ba262fc4ac257fb2ec6c97be303069fa0cb 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Program.cs +++ b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/Program.cs @@ -1,4 +1,4 @@ -using Idsrv4.Admin.Shared.ModuleInitializer; +using IdentityServer4.Extensions; using Microsoft.AspNetCore.Http; using Microsoft.IdentityModel.Logging; @@ -25,9 +25,12 @@ try #region Configuration IRootConfiguration rootConfiguration = new RootConfiguration(); - builder.Configuration.GetSection(ConfigurationConsts.AdminConfigurationKey).Bind(rootConfiguration.AdminConfiguration); - builder.Configuration.GetSection(ConfigurationConsts.RegisterConfigurationKey).Bind(rootConfiguration.RegisterConfiguration); + builder.Configuration.GetSection(ConfigurationConsts.AdminConfigurationKey) + .Bind(rootConfiguration.AdminConfiguration); + builder.Configuration.GetSection(ConfigurationConsts.RegisterConfigurationKey) + .Bind(rootConfiguration.RegisterConfiguration); builder.Services.AddSingleton(rootConfiguration); + #endregion #region Services @@ -85,15 +88,15 @@ try IdentityModelEventSource.ShowPII = true; // Add custom security headers app.UseSecurityHeaders(builder.Configuration); - - #region BasePath - string basePath = builder.Configuration.GetValue("BasePath"); + #region BasePath + + var basePath = builder.Configuration.GetValue("BasePath"); if (!string.IsNullOrWhiteSpace(basePath)) - app.UsePathBase(new PathString(basePath)); + app.UsePathBase(new PathString(basePath)); + + #endregion - #endregion - app.UseCookiePolicy(); if (app.Environment.IsDevelopment()) @@ -102,6 +105,13 @@ try app.UseHsts(); + //if (!string.IsNullOrWhiteSpace(rootConfiguration.AdminConfiguration.ProxyServerUrl)) + // app.Use(async (ctx, next) => + // { + // ctx.SetIdentityServerOrigin(string.Concat(rootConfiguration.AdminConfiguration.ProxyServerUrl, basePath)); + // await next(); + // }); + app.UseStaticFiles(); app.UseIdentityServer(); @@ -113,7 +123,7 @@ try app.MapDefaultEndpoints(); app.MapDefaultControllerRoute(); - + await app.RunAsync(); } @@ -124,5 +134,4 @@ catch (Exception ex) finally { await Log.CloseAndFlushAsync(); -} - +} \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/appsettings.json b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/appsettings.json index f66eb0988c168ceec68be1d449f222be38cfcfd2..fc7ca6e25d107f561c6c5eab1d13b25e6a836e8f 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/appsettings.json +++ b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/appsettings.json @@ -1,9 +1,9 @@ { "ConnectionStrings": { - "ConfigurationDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "PersistedGrantDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "IdentityDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "DataProtectionDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "ConfigurationDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "PersistedGrantDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "IdentityDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "DataProtectionDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" }, "DatabaseProviderConfiguration": { "ProviderType": "PostgreSQL" diff --git a/src/IdentityServer4/src/Idsrv4.Admin.Shared.Configuration/Idsrv4.Admin.Shared.Configuration.csproj b/src/IdentityServer4/src/Idsrv4.Admin.Shared.Configuration/Idsrv4.Admin.Shared.Configuration.csproj index 02f19e3e0ac94bedd48b4f897dbe9f413e4c91e4..47709c5ce0415e8722c256318fa1ef588e9093f9 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.Shared.Configuration/Idsrv4.Admin.Shared.Configuration.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.Shared.Configuration/Idsrv4.Admin.Shared.Configuration.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Shared common layer for the administration of the IdentityServer4 and Asp.Net Core Identity diff --git a/src/IdentityServer4/src/Idsrv4.Admin.Shared/Idsrv4.Admin.Shared.csproj b/src/IdentityServer4/src/Idsrv4.Admin.Shared/Idsrv4.Admin.Shared.csproj index 555389b8a322d1a333b2d35e364b7e18968dffb2..c6f986d761123dc3c5eff34e9eda8f8957c347ac 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.Shared/Idsrv4.Admin.Shared.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.Shared/Idsrv4.Admin.Shared.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 Shared common layer for the administration of the IdentityServer4 and Asp.Net Core Identity diff --git a/src/IdentityServer4/src/Idsrv4.Admin.UI/Helpers/StartupHelpers.cs b/src/IdentityServer4/src/Idsrv4.Admin.UI/Helpers/StartupHelpers.cs index 6b743ff196f6610a8435d0f7476b52ba88b96e29..32fa0abf0a6db6de468ee7aed28d76bf5a782097 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.UI/Helpers/StartupHelpers.cs +++ b/src/IdentityServer4/src/Idsrv4.Admin.UI/Helpers/StartupHelpers.cs @@ -27,9 +27,7 @@ using Idsrv4.Admin.BusinessLogic.Identity.Dtos.Identity; using Idsrv4.Admin.BusinessLogic.Services; using Idsrv4.Admin.BusinessLogic.Services.Interfaces; using Idsrv4.Admin.EntityFramework.Configuration.Configuration; -using Idsrv4.Admin.EntityFramework.Configuration.MySql; using Idsrv4.Admin.EntityFramework.Configuration.PostgreSQL; -using Idsrv4.Admin.EntityFramework.Configuration.SqlServer; using Idsrv4.Admin.EntityFramework.Helpers; using Idsrv4.Admin.EntityFramework.Interfaces; using Idsrv4.Admin.EntityFramework.Repositories; diff --git a/src/IdentityServer4/src/Idsrv4.Admin.UI/Idsrv4.Admin.UI.csproj b/src/IdentityServer4/src/Idsrv4.Admin.UI/Idsrv4.Admin.UI.csproj index ed1e7e8d964d39f151845c2a1c73864bbb0ef633..2844ad5112f3c0afeb48b1e04a4892ea0cd191cc 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin.UI/Idsrv4.Admin.UI.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin.UI/Idsrv4.Admin.UI.csproj @@ -1,6 +1,6 @@ - net8.0 + net9.0 The package with UI for the administration of the IdentityServer4 true / @@ -92,10 +92,8 @@ - - diff --git a/src/IdentityServer4/src/Idsrv4.Admin/Idsrv4.Admin.csproj b/src/IdentityServer4/src/Idsrv4.Admin/Idsrv4.Admin.csproj index a4f06eb9a4e65aaa3f84447b124f08edb7779054..b70ed9f065561bfb06d0ff9d65e5d5fa0f2cec4e 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin/Idsrv4.Admin.csproj +++ b/src/IdentityServer4/src/Idsrv4.Admin/Idsrv4.Admin.csproj @@ -1,6 +1,6 @@  - net8.0 + net9.0 8fe260ca-ef4c-4fa3-9364-029146f8d339 NU1803;NU1507;1701;1702;1591;8002;CS1573;NU1604; false diff --git a/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json b/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json index f1a6df3b21db0ede3e2df3835a94e51a3761b50d..0fca234e0701fa25e3c3d49384111f8d4b3a869f 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json +++ b/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json @@ -1,11 +1,11 @@ { "ConnectionStrings": { - "ConfigurationDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "PersistedGrantDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "IdentityDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminLogDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminAuditLogDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "DataProtectionDbConnection": "Server=192.168.8.112;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "ConfigurationDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "PersistedGrantDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "IdentityDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "AdminLogDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "AdminAuditLogDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "DataProtectionDbConnection": "Server=192.168.10.111;Port=5432;Database=dapr_idsrv4;User Id=dapr_idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" }, "SeedConfiguration": { "ApplySeed": false diff --git a/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json b/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json index 1048c2679aa5baf55b0e931085afc30850404ffe..aaaf74f059b3af216593cfc301580cb67f9ed8b1 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json +++ b/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json @@ -84,7 +84,7 @@ { "ClientId": "web_admin", "ClientName": "web_admin", - "ClientUri": "https://localhost:44444/admin", + "ClientUri": "http://localhost:24400/admin", "AllowOfflineAccess": true, "AllowedGrantTypes": [ "authorization_code" @@ -96,14 +96,14 @@ } ], "RedirectUris": [ - "https://localhost:44444/admin/signin-oidc" + "http://localhost:24400/admin/signin-oidc" ], - "FrontChannelLogoutUri": "https://localhost:44444/admin/signout-oidc", + "FrontChannelLogoutUri": "http://localhost:24400/admin/signout-oidc", "PostLogoutRedirectUris": [ - "https://localhost:44444/admin/signout-callback-oidc" + "http://localhost:24400/admin/signout-callback-oidc" ], "AllowedCorsOrigins": [ - "https://localhost:44444" + "http://localhost:24400" ], "AllowedScopes": [ "roles", @@ -117,7 +117,7 @@ { "ClientId": "identity_admin", "ClientName": "identity_admin", - "ClientUri": "https://localhost:44444/auth/admin", + "ClientUri": "http://localhost:24400/auth/admin", "AllowedGrantTypes": [ "authorization_code" ], @@ -128,14 +128,14 @@ } ], "RedirectUris": [ - "https://localhost:44444/auth/admin/signin-oidc" + "http://localhost:24400/auth/admin/signin-oidc" ], - "FrontChannelLogoutUri": "https://localhost:44444/auth/admin/signout-oidc", + "FrontChannelLogoutUri": "http://localhost:24400/auth/admin/signout-oidc", "PostLogoutRedirectUris": [ - "https://localhost:44444/auth/admin/signout-callback-oidc" + "http://localhost:24400/auth/admin/signout-callback-oidc" ], "AllowedCorsOrigins": [ - "https://localhost:44444" + "http://localhost:24400" ], "AllowedScopes": [ "openid", @@ -153,13 +153,13 @@ "RequireClientSecret": false, "RequirePkce": true, "RedirectUris": [ - "https://localhost:44302/swagger/oauth2-redirect.html" + "http://localhost:24400/api/auth/swagger/oauth2-redirect.html" ], "AllowedScopes": [ "identity_admin_api" ], "AllowedCorsOrigins": [ - "https://localhost:44302" + "http://localhost:24400" ] } ] diff --git a/src/PluggableComponents/PluggableComponents.csproj b/src/PluggableComponents/PluggableComponents.csproj index 74c72ff4321c4db301a53b2aed45d4d069c9f2cc..3c40af9218896f8c4097fba2405d6a5a8ce1927b 100644 --- a/src/PluggableComponents/PluggableComponents.csproj +++ b/src/PluggableComponents/PluggableComponents.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable false diff --git a/src/Services/Ordering/Presentation/Ordering.Api/Controllers/PurchaseOrder/Mobile/PurchaseController.cs b/src/Services/Ordering/Presentation/Ordering.Api/Controllers/PurchaseOrder/Mobile/PurchaseController.cs index a20d25d7ceb9bed2422f553e0b8088169f3f71c5..0d209d2ad3b1df7c2192048377a842f2523ae343 100644 --- a/src/Services/Ordering/Presentation/Ordering.Api/Controllers/PurchaseOrder/Mobile/PurchaseController.cs +++ b/src/Services/Ordering/Presentation/Ordering.Api/Controllers/PurchaseOrder/Mobile/PurchaseController.cs @@ -22,9 +22,9 @@ public class PurchaseController(IPurchaseOrderApiService apiApiService) : Mobile /// 订单Id /// [HttpGet("Get")] - [ProducesResponseType(typeof(PurchaseOrderOutputDto), 200)] + [ProducesResponseType(typeof(ResponseResult), 200)] [ProducesResponseType(StatusCodes.Status400BadRequest)] - public async Task GetAsync(string id) + public async Task GetAsync([FromQuery]string id) { var result = await apiApiService.GetAsync(id); return result.ToOkResult(data => data); @@ -36,7 +36,7 @@ public class PurchaseController(IPurchaseOrderApiService apiApiService) : Mobile /// 订单号 /// [HttpGet("Detail")] - [ProducesResponseType(typeof(PurchaseOrderOutputDto), 200)] + [ProducesResponseType(typeof(ResponseResult), 200)] [ProducesResponseType(StatusCodes.Status400BadRequest)] public async Task GetDetailAsync(string orderNumber) { diff --git a/src/Services/Ordering/Presentation/Ordering.Api/Program.cs b/src/Services/Ordering/Presentation/Ordering.Api/Program.cs index 2016cdbb0d4606a11c0b77c5e9edb59fd5b02bbb..9f2a2bf7f8410c656eb78b63e1ef2bd23a143e6e 100644 --- a/src/Services/Ordering/Presentation/Ordering.Api/Program.cs +++ b/src/Services/Ordering/Presentation/Ordering.Api/Program.cs @@ -18,11 +18,9 @@ builder.RegisterAppDapr(options => var app = builder.Build(); - -app.MapDefaultEndpoints(); - app.UseAppServer(builder.Configuration); +app.MapDefaultEndpoints(); app.MapGet("/", () => Results.LocalRedirect("~/docs")); app.MapControllers(); app.MapSubscribeHandler(); diff --git a/src/Services/Ordering/Presentation/Ordering.Api/appsettings.json b/src/Services/Ordering/Presentation/Ordering.Api/appsettings.json index 27c7d852965a81e4b374665bc4606966c80d330e..135485948bd2586eb3ebac3cb9d3f43eb71de3e2 100644 --- a/src/Services/Ordering/Presentation/Ordering.Api/appsettings.json +++ b/src/Services/Ordering/Presentation/Ordering.Api/appsettings.json @@ -10,9 +10,9 @@ } }, "ConnectionStrings": { - "catalog": "Server=192.168.8.112;Port=5432;Database=dapr_catalog;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "identity": "Server=192.168.8.112;Port=5432;Database=dapr_identity;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "order": "Server=192.168.8.112;Port=5432;Database=dapr_ordering;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "catalog": "Server=192.168.10.111;Port=5432;Database=dapr_catalog;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "identity": "Server=192.168.10.111;Port=5432;Database=dapr_identity;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "order": "Server=192.168.10.111;Port=5432;Database=dapr_ordering;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;" }, "AllowedHosts": "*", "GracePeriodTime": "1", diff --git a/src/Web/WebAdmin.Shared/Layout/MainLayout.razor b/src/Web/WebAdmin.Shared/Layout/MainLayout.razor index 4df9b3bc5021ad93f1ba128f182b60a7585521b4..e9658a7cd282cba1a1a85de2edf733371e59e78c 100644 --- a/src/Web/WebAdmin.Shared/Layout/MainLayout.razor +++ b/src/Web/WebAdmin.Shared/Layout/MainLayout.razor @@ -36,7 +36,7 @@ - + diff --git a/src/Web/WebAdmin/appsettings.Development.json b/src/Web/WebAdmin/appsettings.Development.json index 5198043f20b09cccefec9235460cbb9e2a13eab6..6babbe3c5741b9a31a115867f71657d2d776d2ed 100644 --- a/src/Web/WebAdmin/appsettings.Development.json +++ b/src/Web/WebAdmin/appsettings.Development.json @@ -11,9 +11,9 @@ "AllowedHosts": "*", "ConnectionStrings": { - "Catalog": "Server=192.168.8.112;Port=5432;Database=dapr_catalog;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "Identity": "Server=192.168.8.112;Port=5432;Database=dapr_identity;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "Ordering": "Server=192.168.8.112;Port=5432;Database=dapr_ordering;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "Catalog": "Server=192.168.10.111;Port=5432;Database=dapr_catalog;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "Identity": "Server=192.168.10.111;Port=5432;Database=dapr_identity;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;", + "Ordering": "Server=192.168.10.111;Port=5432;Database=dapr_ordering;User Id=dapr;Password=Local@Db;Pooling=true;MaxPoolSize=100;" }, "AdminConfiguration": { diff --git a/test/DaprTool.AbstractionsTest/DaprTool.AbstractionsTest.csproj b/test/DaprTool.AbstractionsTest/DaprTool.AbstractionsTest.csproj index 38efdebf0ac86a5e02ebb2afb6be87c3c0942019..c7d518c14f1cb9b1c9693603db3bc23b761ed1f4 100644 --- a/test/DaprTool.AbstractionsTest/DaprTool.AbstractionsTest.csproj +++ b/test/DaprTool.AbstractionsTest/DaprTool.AbstractionsTest.csproj @@ -8,9 +8,15 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/test/DaprTool.AbstractionsTest/DataBases/JsonQueryTest.cs b/test/DaprTool.AbstractionsTest/DataBases/JsonQueryTest.cs index d9b1f4456550d5c46fb5a016cdbb79d5a4c6836c..6ffc610d706dbfcbd1641d1ca83c8ceea7a1bd4b 100644 --- a/test/DaprTool.AbstractionsTest/DataBases/JsonQueryTest.cs +++ b/test/DaprTool.AbstractionsTest/DataBases/JsonQueryTest.cs @@ -42,7 +42,7 @@ public class JsonQueryTest(DbDependencySetupFixture fixture, ITestOutputHelper t var query = db.GetTable() .Where(x => x.CapitalAccount != null) - .JsonWhere(x => x.CapitalAccount.CapitalId == 723453551573140002); + .JsonWhere(x => x.CapitalAccount!.CapitalId == 723453551573140002); testOutputHelper.WriteLine($"查询 sql:{query}"); var row = await query.FirstOrDefaultAsync(); @@ -82,7 +82,7 @@ public class JsonQueryTest(DbDependencySetupFixture fixture, ITestOutputHelper t var query = db.GetTable() .Where(x => x.CapitalAccount != null) - .Where(x => x.CertificationInfo.JsonExtractPathText(json => json.RealName) == "张三"); + .Where(x => x.CertificationInfo.JsonExtractPathText(json => json!.RealName) == "张三"); testOutputHelper.WriteLine($"查询 sql:{query}"); var row = await query.FirstOrDefaultAsync();