Fix: Admin club management 500 error - JWT clubs claim format
CI Pipeline / Backend Build & Test (push) Successful in 53s
CI Pipeline / Frontend Lint, Test & Build (push) Successful in 33s
CI Pipeline / Infrastructure Validation (push) Successful in 4s

- Fix clubs attribute in Keycloak to contain only UUIDs (removed role names)

- Add defensive error handling in ClubService.GetMyClubsAsync()

- Add logging for debugging club retrieval issues

- Return empty list instead of 500 error on failures

Fixes: Admin users can now manage clubs without contact admin error
This commit is contained in:
WorkClub Automation
2026-03-21 20:27:38 +01:00
parent 9304db2391
commit b10c57bdb8
3 changed files with 171 additions and 132 deletions
@@ -150,11 +150,11 @@ data:
"realmRoles": [
"admin"
],
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,Admin,3b4afcfa-1352-8fc7-b497-8ab52a0d5fda,Member"
]
}
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,3b4afcfa-1352-8fc7-b497-8ab52a0d5fda"
]
}
},
{
"username": "manager@test.com",
@@ -172,11 +172,11 @@ data:
"realmRoles": [
"manager"
],
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,Manager"
]
}
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383"
]
}
},
{
"username": "member1@test.com",
@@ -194,11 +194,11 @@ data:
"realmRoles": [
"member"
],
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,Member,3b4afcfa-1352-8fc7-b497-8ab52a0d5fda,Member"
]
}
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,3b4afcfa-1352-8fc7-b497-8ab52a0d5fda"
]
}
},
{
"username": "member2@test.com",
@@ -216,11 +216,11 @@ data:
"realmRoles": [
"member"
],
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,Member"
]
}
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383"
]
}
},
{
"username": "viewer@test.com",
@@ -238,11 +238,11 @@ data:
"realmRoles": [
"viewer"
],
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,Viewer"
]
}
"attributes": {
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383"
]
}
}
]
}
+16 -14
View File
@@ -82,18 +82,18 @@
"standardFlowEnabled": true,
"implicitFlowEnabled": false,
"directAccessGrantsEnabled": true,
"serviceAccountsEnabled": false,
"authorizationServicesEnabled": false,
"protocol": "openid-connect",
"redirectUris": [
"http://localhost:30080/*"
],
"webOrigins": [
"http://localhost:30080"
],
"attributes": {
"pkce.code.challenge.method": "S256",
"post.logout.redirect.uris": "http://localhost:30080/*",
"serviceAccountsEnabled": false,
"authorizationServicesEnabled": false,
"protocol": "openid-connect",
"redirectUris": [
"http://localhost:30080/*"
],
"webOrigins": [
"http://localhost:30080"
],
"attributes": {
"pkce.code.challenge.method": "S256",
"post.logout.redirect.uris": "http://localhost:30080/*",
"access.token.lifespan": "3600"
},
"protocolMappers": [
@@ -162,7 +162,9 @@
"firstName": "Admin",
"lastName": "User",
"attributes": {
"clubs": []
"clubs": [
"64e05b5e-ef45-81d7-f2e8-3d14bd197383,3b4afcfa-1352-8fc7-b497-8ab52a0d5fda"
]
},
"credentials": [
{
@@ -337,4 +339,4 @@
"dockerAuthenticationFlow": "docker auth",
"attributes": {},
"keycloakVersion": "26.0.0"
}
}