From 1cb516b795778e0ccafb8c2b784f99759adc1b97 Mon Sep 17 00:00:00 2001 From: iamshen Date: Fri, 17 May 2024 09:56:58 +0800 Subject: [PATCH 1/3] Update IdentityServer seedData config json --- DaprTool.Solution.sln | 3 ++ README.md | 13 ++++++ .../src/Idsrv4.Admin/identityserverdata.json | 42 ++++++++++++++++--- 3 files changed, 53 insertions(+), 5 deletions(-) diff --git a/DaprTool.Solution.sln b/DaprTool.Solution.sln index ab7b347..4eeb432 100644 --- a/DaprTool.Solution.sln +++ b/DaprTool.Solution.sln @@ -97,6 +97,9 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaprTool.AbstractionsTest", "test\DaprTool.AbstractionsTest\DaprTool.AbstractionsTest.csproj", "{9D99BAB3-C5FA-4EB8-8CCF-4476957484D2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "IdentityServer4", "IdentityServer4", "{D2F20A9C-E732-43EA-9615-70F9FD46253A}" + ProjectSection(SolutionItems) = preProject + src\IdentityServer4\README.md = src\IdentityServer4\README.md + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DaprActorExtensions", "src\BuildingBlocks\DaprActorExtensions\DaprActorExtensions.csproj", "{E8E71C63-315D-4CD5-9847-4FFE30D2EA45}" EndProject diff --git a/README.md b/README.md index 1e98ef7..5cbfa18 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,16 @@ # 可插拔组件 > 本地测试 可插拔组件的时候 请使用 wsl 运行 dotnet run + + + +### IdentityServer4 + +#### 数据库准备 + +* 1. 创建数据库 + - `1.1 创建 postgres 用户 idsrv4 密码 Local@Db` + - `1.2 创建 postgres 数据库 CREATE DATABASE idsrv4 OWNER idsrv4;` +* 2. 初始化数据库 + - `2.1 cd dapr-tool-solution\src\IdentityServer4\src\Idsrv4.Admin` + - `2.2 dotnet run /seed` \ No newline at end of file diff --git a/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json b/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json index 60319d6..78aa629 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json +++ b/src/IdentityServer4/src/Idsrv4.Admin/identityserverdata.json @@ -81,10 +81,42 @@ } ], "Clients": [ + { + "ClientId": "web_admin", + "ClientName": "web_admin", + "ClientUri": "https://localhost:44444/admin", + "AllowedGrantTypes": [ + "authorization_code" + ], + "RequirePkce": true, + "ClientSecrets": [ + { + "Value": "c7c7d023-4bed-f262-64da-6d7a42c24f6c" + } + ], + "RedirectUris": [ + "https://localhost:44444/admin/signin-oidc" + ], + "FrontChannelLogoutUri": "https://localhost:44444/admin/signout-oidc", + "PostLogoutRedirectUris": [ + "https://localhost:44444/admin/signout-callback-oidc" + ], + "AllowedCorsOrigins": [ + "https://localhost:44444" + ], + "AllowedScopes": [ + "roles", + "profile", + "openid", + "email", + "identity_admin_api", + "offline_access" + ] + }, { "ClientId": "identity_admin", "ClientName": "identity_admin", - "ClientUri": "https://localhost:44303/authAdmin", + "ClientUri": "https://localhost:44444/auth/admin", "AllowedGrantTypes": [ "authorization_code" ], @@ -95,14 +127,14 @@ } ], "RedirectUris": [ - "https://localhost:44303/authAdmin/signin-oidc" + "https://localhost:44444/auth/admin/signin-oidc" ], - "FrontChannelLogoutUri": "https://localhost:44303/authAdmin/signout-oidc", + "FrontChannelLogoutUri": "https://localhost:44444/auth/admin/signout-oidc", "PostLogoutRedirectUris": [ - "https://localhost:44303/authAdmin/signout-callback-oidc" + "https://localhost:44444/auth/admin/signout-callback-oidc" ], "AllowedCorsOrigins": [ - "https://localhost:44303/authAdmin" + "https://localhost:44444" ], "AllowedScopes": [ "openid", -- Gitee From 68c9de2362164a1adfad96a02d4747a5b174ad07 Mon Sep 17 00:00:00 2001 From: iamshen Date: Fri, 17 May 2024 10:13:42 +0800 Subject: [PATCH 2/3] Update README.md --- README.md | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 5cbfa18..db1c07d 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,30 @@ # 使用 Dapr 构建分布式应用测试项目 +# QuickStart + + +```bash + +git clone git@gitee.com:gold-cloud/dapr-tool-solution.git + +visual studio 2022 p +``` # 先决条件 ### 基础设施 +- **[`Visual Studio 2022 预览版`](https://visualstudio.microsoft.com/zh-hans/vs/preview/)** +- **[`.NET 8.0 +`](https://dotnet.microsoft.com/download)** -安装了 vs 后会自带 无需单独安装 - **[`Dapr`](https://dapr.io/)** -- **[`Dotnet`](https://dotnet.microsoft.com/download)** - **[`WSL2 - Ubuntu OS`](https://docs.microsoft.com/en-us/windows/wsl/install-win10)** -- **[`.NET 8.0`](https://dotnet.microsoft.com/download)** - -### 构建编排 - -- **[`.NET Aspire`](https://github.com/dotnet/aspire)** - **[`Aspir8`](https://prom3theu5.github.io/aspirational-manifests/getting-started.html)** -- **[`Docker for desktop`](https://www.docker.com/products/docker-desktop)** +- **[`Docker for desktop`](https://www.docker.com/products/docker-desktop)** +- **[`RabbitMQ`](https://gitee.com/iamshen/my-docker-compose/blob/master/rabbitmq/README.MD)** -### 后端服务 +### 后端 +- **[`.NET Aspire`](https://github.com/dotnet/aspire)** - **[`Yarp`](https://github.com/microsoft/reverse-proxy)** - **[`MediatR`](https://github.com/jbogard/MediatR)** - **[`Linq2Db`](https://github.com/linq2db/linq2db)** @@ -26,7 +33,7 @@ - **[`FluentValidation`](https://github.com/FluentValidation/FluentValidation)** - **[`Swashbuckle.AspNetCore`](https://github.com/domaindrivendev/Swashbuckle.AspNetCore)** -### 前端 UI +### 前端 - **[`ASP.NET Core Web UI(Blazor)`](https://learn.microsoft.com/zh-cn/aspnet/core/tutorials/choose-web-ui?view=aspnetcore-8.0)** - **[`Fluent UI Blazor`](https://www.fluentui-blazor.net/)** @@ -53,5 +60,6 @@ - `1.1 创建 postgres 用户 idsrv4 密码 Local@Db` - `1.2 创建 postgres 数据库 CREATE DATABASE idsrv4 OWNER idsrv4;` * 2. 初始化数据库 - - `2.1 cd dapr-tool-solution\src\IdentityServer4\src\Idsrv4.Admin` - - `2.2 dotnet run /seed` \ No newline at end of file + - `2.1 把 Idsrv4.Admin | Idsrv4.Admin.Api | Idsrv4.Admin.STS.Identity 这三个项目中 appsettings.json 的所有 ConnectionStrings 的连接字符串修改为自己本地 localhost` + - `2.2 cd dapr-tool-solution\src\IdentityServer4\src\Idsrv4.Admin` + - `2.3 dotnet run /seed` \ No newline at end of file -- Gitee From 11debea4ae460d4571a53c77dc7b3511812faab5 Mon Sep 17 00:00:00 2001 From: iamshen Date: Fri, 17 May 2024 10:13:49 +0800 Subject: [PATCH 3/3] Update ConnectionStrings --- .../src/Idsrv4.Admin.Api/appsettings.json | 12 ++++++------ .../src/Idsrv4.Admin.STS.Identity/appsettings.json | 8 ++++---- .../src/Idsrv4.Admin/appsettings.json | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/IdentityServer4/src/Idsrv4.Admin.Api/appsettings.json b/src/IdentityServer4/src/Idsrv4.Admin.Api/appsettings.json index a6d26fb..3be2da1 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=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "PersistedGrantDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "IdentityDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminLogDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminAuditLogDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "DataProtectionDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "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;" }, "AdminApiConfiguration": { "ApiName": "IdentityServer4 Admin Api", diff --git a/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/appsettings.json b/src/IdentityServer4/src/Idsrv4.Admin.STS.Identity/appsettings.json index 9e4dfd9..d80a55d 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=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "PersistedGrantDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "IdentityDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "DataProtectionDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "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;" }, "DatabaseProviderConfiguration": { "ProviderType": "PostgreSQL" diff --git a/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json b/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json index 00b384a..5ec2ec2 100644 --- a/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json +++ b/src/IdentityServer4/src/Idsrv4.Admin/appsettings.json @@ -1,11 +1,11 @@ { "ConnectionStrings": { - "ConfigurationDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "PersistedGrantDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "IdentityDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminLogDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "AdminAuditLogDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;", - "DataProtectionDbConnection": "Server=localhost;Port=5432;Database=idsrv4;User Id=idsrv4;Password=Local@Db;Pooling=true;MaxPoolSize=100;" + "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;" }, "SeedConfiguration": { "ApplySeed": false -- Gitee