Skip to content

Commit f42f218

Browse files
feat: first implementation of identity server (#15)
* feat: first implementation of identity server * fix: allow refresh token flow * Update user-management/src/Stickerlandia.UserManagement.Agnostic/Migrations/20250527125041_InitialCreate.cs Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com> * Update user-management/src/Stickerlandia.UserManagement.Agnostic/Migrations/20250527125041_InitialCreate.cs Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com> * chore: code quality recommendations * chore: update test code to use OAuth2.0 * fix: resolve integration test issues * chore: various changes from PR feedback * chore: restructure codebase and fix integration tests * chore: add paths to GH triggers * chore: install dotnet dev certs * chore: add retries to async test run * chore: remove build step from workflow * fix: function app updates for test run * fix: update startup mode for az functions * fix: updates for azure functions in GH actions * fix: resolve GH actions issues * fix: resolve integration test issues * feat: add configurable SSL for auth server * chore: add .NET 9 SDK to action and re-enable azure functions --------- Co-authored-by: datadog-datadog-prod-us1[bot] <88084959+datadog-datadog-prod-us1[bot]@users.noreply.github.com>
1 parent fefef6e commit f42f218

114 files changed

Lines changed: 5600 additions & 2111 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/user-management-test.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ jobs:
3131
strategy:
3232
matrix:
3333
DRIVING:
34-
- ASPNET
35-
#- AZURE_FUNCTIONS
34+
- AGNOSTIC
35+
- AZURE
3636
fail-fast: false
3737

3838
services:
@@ -46,13 +46,12 @@ jobs:
4646
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1
4747
with:
4848
dotnet-version: "8.0.x"
49-
- name: Export Cosmos DB Emulator Certificate
49+
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1
50+
with:
51+
dotnet-version: "9.0.x"
52+
- name: Install SSL Certificates
5053
run: |
51-
sudo apt update && sudo apt install -y openssl
52-
openssl s_client -connect localhost:8081 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > cosmos_emulator.cert
53-
54-
sudo cp cosmos_emulator.cert /usr/local/share/ca-certificates/
55-
sudo update-ca-certificates
54+
dotnet dev-certs https --trust
5655
- name: Install Azure Functions Core Tools
5756
run: |
5857
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
@@ -66,17 +65,11 @@ jobs:
6665
run: |
6766
cd user-management
6867
dotnet restore
69-
- name: .NET Build
70-
shell: bash
71-
run: |
72-
cd user-management
73-
dotnet build
7468
- name: Run Integration Tests
7569
shell: bash
7670
env:
7771
DRIVING: ${{ matrix.DRIVING }}
7872
DRIVEN: AZURE
79-
COSMOSDB_CONNECTION_STRING: ${{ secrets.COSMOSDB_LOCAL_CONNECTION_STRING }}
8073
run: |
8174
func --version
8275
cd user-management/tests/Stickerlandia.UserManagement.IntegrationTest && dotnet test --logger:"console;verbosity=detailed"
@@ -87,14 +80,21 @@ jobs:
8780
strategy:
8881
matrix:
8982
DRIVING:
90-
- ASPNET
83+
- AGNOSTIC
84+
- AZURE
9185
fail-fast: false
9286

9387
steps:
9488
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
9589
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1
9690
with:
9791
dotnet-version: "8.0.x"
92+
- uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9 #4.3.1
93+
with:
94+
dotnet-version: "9.0.x"
95+
- name: Install SSL Certificates
96+
run: |
97+
dotnet dev-certs https --trust
9898
- name: Install Azure Functions Core Tools
9999
run: |
100100
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
@@ -108,11 +108,6 @@ jobs:
108108
run: |
109109
cd user-management
110110
dotnet restore
111-
- name: .NET Build
112-
shell: bash
113-
run: |
114-
cd user-management
115-
dotnet build
116111
- name: Run Integration Tests
117112
shell: bash
118113
env:

docker-compose.yml

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ services:
193193
user-management:
194194
build:
195195
context: ./user-management
196-
dockerfile: src/Stickerlandia.UserManagement.AspNet/Dockerfile
196+
dockerfile: src/Stickerlandia.UserManagement.Api/Dockerfile
197197
container_name: user-management
198198
depends_on:
199199
user-management-db:
@@ -202,8 +202,9 @@ services:
202202
condition: service_healthy
203203
environment:
204204
ASPNETCORE_ENVIRONMENT: Development
205-
DRIVING: ASPNET
205+
DRIVING: AGNOSTIC
206206
DRIVEN: AGNOSTIC
207+
DISABLE_SSL: "true"
207208
ConnectionStrings__messaging: "redpanda:9092"
208209
ConnectionStrings__database: "Host=user-management-db;Port=5432;Database=user_management;Username=user_mgmt_user;Password=user_mgmt_password"
209210
KAFKA__BOOTSTRAPSERVERS: "redpanda:9092"
@@ -214,6 +215,44 @@ services:
214215
- "traefik.http.routers.user-management.rule=PathPrefix(`/api/users`)"
215216
- "traefik.http.services.user-management.loadbalancer.server.port=8080"
216217

218+
user-management-worker:
219+
build:
220+
context: ./user-management
221+
dockerfile: src/Stickerlandia.UserManagement.Worker/Dockerfile
222+
container_name: user-management-worker
223+
depends_on:
224+
user-management-db:
225+
condition: service_healthy
226+
redpanda:
227+
condition: service_healthy
228+
environment:
229+
ASPNETCORE_ENVIRONMENT: Development
230+
DRIVING: AGNOSTIC
231+
DRIVEN: AGNOSTIC
232+
ConnectionStrings__messaging: "redpanda:9092"
233+
ConnectionStrings__database: "Host=user-management-db;Port=5432;Database=user_management;Username=user_mgmt_user;Password=user_mgmt_password"
234+
KAFKA__BOOTSTRAPSERVERS: "redpanda:9092"
235+
KAFKA__SCHEMAREGISTRY: "http://redpanda:8082"
236+
KAFKA__GROUPID: "stickerlandia-user-management"
237+
238+
user-management-db-migrations:
239+
build:
240+
context: ./user-management
241+
dockerfile: src/Stickerlandia.UserManagement.MigrationService/Dockerfile
242+
container_name: user-management-migrations
243+
depends_on:
244+
user-management-db:
245+
condition: service_healthy
246+
environment:
247+
ASPNETCORE_ENVIRONMENT: Development
248+
DRIVING: AGNOSTIC
249+
DRIVEN: AGNOSTIC
250+
ConnectionStrings__messaging: "redpanda:9092"
251+
ConnectionStrings__database: "Host=user-management-db;Port=5432;Database=user_management;Username=user_mgmt_user;Password=user_mgmt_password"
252+
KAFKA__BOOTSTRAPSERVERS: "redpanda:9092"
253+
KAFKA__SCHEMAREGISTRY: "http://redpanda:8082"
254+
KAFKA__GROUPID: "stickerlandia-user-management"
255+
217256
volumes:
218257
sticker-award-data:
219258
user-management-data:

user-management/Stickerlandia.UserManagement.sln

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagemen
1111
EndProject
1212
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.UnitTest", "tests\Stickerlandia.UserManagement.UnitTest\Stickerlandia.UserManagement.UnitTest.csproj", "{7BD95F13-FE66-43A0-A48A-8D5903E37F7D}"
1313
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.AspNet", "src\Stickerlandia.UserManagement.AspNet\Stickerlandia.UserManagement.AspNet.csproj", "{488873C6-4BFA-4D6E-9364-D672C15EA2D9}"
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.Api", "src\Stickerlandia.UserManagement.Api\Stickerlandia.UserManagement.Api.csproj", "{488873C6-4BFA-4D6E-9364-D672C15EA2D9}"
1515
EndProject
1616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.Core", "src\Stickerlandia.UserManagement.Core\Stickerlandia.UserManagement.Core.csproj", "{A93481EC-FDED-4740-902D-B5D911402CBA}"
1717
EndProject
@@ -33,7 +33,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driving", "Driving", "{9247
3333
EndProject
3434
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Driven", "Driven", "{86CA6782-DAF7-4130-9B10-02DE0680DF78}"
3535
EndProject
36-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.SharedSetup", "src\Stickerlandia.UserManagement.SharedSetup\Stickerlandia.UserManagement.SharedSetup.csproj", "{DE058729-25B8-4F03-BA72-0EF1BCF1A275}"
36+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.Auth", "src\Stickerlandia.UserManagement.Auth\Stickerlandia.UserManagement.Auth.csproj", "{408EFE63-AA9C-46BD-ADD5-AB917BB4E9E6}"
37+
EndProject
38+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.Worker", "src\Stickerlandia.UserManagement.Worker\Stickerlandia.UserManagement.Worker.csproj", "{ED36763B-8971-4CC9-A4FE-16924F1961C0}"
39+
EndProject
40+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.ServiceDefaults", "src\Stickerlandia.UserManagement.ServiceDefaults\Stickerlandia.UserManagement.ServiceDefaults.csproj", "{7C28228C-4B3D-4AAE-95E6-4669413BD06C}"
41+
EndProject
42+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stickerlandia.UserManagement.MigrationService", "src\Stickerlandia.UserManagement.MigrationService\Stickerlandia.UserManagement.MigrationService.csproj", "{91536DB3-CBA5-44DE-943C-76F8577793FE}"
3743
EndProject
3844
Global
3945
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -84,10 +90,22 @@ Global
8490
{5C770F92-B6E7-4270-A041-A32F385DA6C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
8591
{5C770F92-B6E7-4270-A041-A32F385DA6C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
8692
{5C770F92-B6E7-4270-A041-A32F385DA6C4}.Release|Any CPU.Build.0 = Release|Any CPU
87-
{DE058729-25B8-4F03-BA72-0EF1BCF1A275}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
88-
{DE058729-25B8-4F03-BA72-0EF1BCF1A275}.Debug|Any CPU.Build.0 = Debug|Any CPU
89-
{DE058729-25B8-4F03-BA72-0EF1BCF1A275}.Release|Any CPU.ActiveCfg = Release|Any CPU
90-
{DE058729-25B8-4F03-BA72-0EF1BCF1A275}.Release|Any CPU.Build.0 = Release|Any CPU
93+
{408EFE63-AA9C-46BD-ADD5-AB917BB4E9E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
94+
{408EFE63-AA9C-46BD-ADD5-AB917BB4E9E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
95+
{408EFE63-AA9C-46BD-ADD5-AB917BB4E9E6}.Release|Any CPU.ActiveCfg = Release|Any CPU
96+
{408EFE63-AA9C-46BD-ADD5-AB917BB4E9E6}.Release|Any CPU.Build.0 = Release|Any CPU
97+
{ED36763B-8971-4CC9-A4FE-16924F1961C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
98+
{ED36763B-8971-4CC9-A4FE-16924F1961C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
99+
{ED36763B-8971-4CC9-A4FE-16924F1961C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
100+
{ED36763B-8971-4CC9-A4FE-16924F1961C0}.Release|Any CPU.Build.0 = Release|Any CPU
101+
{7C28228C-4B3D-4AAE-95E6-4669413BD06C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
102+
{7C28228C-4B3D-4AAE-95E6-4669413BD06C}.Debug|Any CPU.Build.0 = Debug|Any CPU
103+
{7C28228C-4B3D-4AAE-95E6-4669413BD06C}.Release|Any CPU.ActiveCfg = Release|Any CPU
104+
{7C28228C-4B3D-4AAE-95E6-4669413BD06C}.Release|Any CPU.Build.0 = Release|Any CPU
105+
{91536DB3-CBA5-44DE-943C-76F8577793FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
106+
{91536DB3-CBA5-44DE-943C-76F8577793FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
107+
{91536DB3-CBA5-44DE-943C-76F8577793FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
108+
{91536DB3-CBA5-44DE-943C-76F8577793FE}.Release|Any CPU.Build.0 = Release|Any CPU
91109
EndGlobalSection
92110
GlobalSection(NestedProjects) = preSolution
93111
{4DDC795B-2EA4-4123-B631-F0D8CAA99BA6} = {FE220876-2B87-4095-8BD2-039049503C72}
@@ -102,6 +120,9 @@ Global
102120
{295E8315-2CD2-4CD8-B7F4-21EF587B74A9} = {86CA6782-DAF7-4130-9B10-02DE0680DF78}
103121
{9A175F6D-120D-4AF2-B407-B1499B70BE9E} = {86CA6782-DAF7-4130-9B10-02DE0680DF78}
104122
{1F6841EA-97F0-4079-967A-42F816E4FD1F} = {86CA6782-DAF7-4130-9B10-02DE0680DF78}
105-
{DE058729-25B8-4F03-BA72-0EF1BCF1A275} = {924749FC-98D5-40A6-8F4B-BA9BFDEDDEC3}
123+
{408EFE63-AA9C-46BD-ADD5-AB917BB4E9E6} = {FC9DDF76-8DAC-4498-8926-8883F984709C}
124+
{ED36763B-8971-4CC9-A4FE-16924F1961C0} = {924749FC-98D5-40A6-8F4B-BA9BFDEDDEC3}
125+
{7C28228C-4B3D-4AAE-95E6-4669413BD06C} = {924749FC-98D5-40A6-8F4B-BA9BFDEDDEC3}
126+
{91536DB3-CBA5-44DE-943C-76F8577793FE} = {924749FC-98D5-40A6-8F4B-BA9BFDEDDEC3}
106127
EndGlobalSection
107128
EndGlobal

user-management/infra/main.tf

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ locals {
6464
app_settings = {
6565
"ConnectionStrings__messaging" = azurerm_servicebus_namespace.stickerlandia_users_service_bus.default_primary_connection_string
6666
"ConnectionStrings__database" = "AccountEndpoint=${azurerm_cosmosdb_account.user_management.endpoint};AccountKey=${azurerm_cosmosdb_account.user_management.primary_key};"
67-
"Auth__Issuer"= "https://stickerlandia.com"
68-
"Auth__Audience"= "https://stickerlandia.com"
69-
"Auth__Key"= "This is a super secret key that should not be used in production'"
7067
}
7168

7269
tags = {

user-management/src/Stickerlandia.UserManagement.Agnostic/DbContextFactory.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public static IServiceCollection AddPostgresUserRepository(this IServiceCollecti
1818
});
1919

2020
// Register repositories
21-
services.AddScoped<IUsers, PostgresUserRepository>();
22-
services.AddScoped<IOutbox, PostgresUserRepository>();
21+
2322

2423
return services;
2524
}

0 commit comments

Comments
 (0)