diff --git a/src/api/docker-compose.yml b/src/api/docker-compose.yml index f77c01549..f992ba655 100644 --- a/src/api/docker-compose.yml +++ b/src/api/docker-compose.yml @@ -82,7 +82,7 @@ services: keycloak: # Local Keycloak server # https://github.com/adorsys/keycloak-config-cli/pull/928 - image: quay.io/keycloak/keycloak:22.0.3 + image: quay.io/keycloak/keycloak:22.0.1 container_name: keycloak environment: WEBHOOK_EVENTS_TAKEN: "LOGIN,REGISTER,LOGOUT,UPDATE_PROFILE" diff --git a/src/api/src/application/Yoma.Core.Api/Controllers/KeycloakController.cs b/src/api/src/application/Yoma.Core.Api/Controllers/KeycloakController.cs index 8ec705793..d61864323 100644 --- a/src/api/src/application/Yoma.Core.Api/Controllers/KeycloakController.cs +++ b/src/api/src/application/Yoma.Core.Api/Controllers/KeycloakController.cs @@ -133,7 +133,7 @@ private async Task UpdateUserProfile(WebhookRequestEventType type, KeycloakWebho userRequest = new UserRequest(); } - userRequest.Email = kcUser.Email.Trim(); + userRequest.Email = kcUser.Username.Trim(); userRequest.FirstName = kcUser.FirstName.Trim(); userRequest.Surname = kcUser.LastName.Trim(); userRequest.EmailConfirmed = kcUser.EmailVerified; diff --git a/src/api/src/domain/Yoma.Core.Domain/Entity/Services/UserService.cs b/src/api/src/domain/Yoma.Core.Domain/Entity/Services/UserService.cs index eaa69a3a6..13c82a1f6 100644 --- a/src/api/src/domain/Yoma.Core.Domain/Entity/Services/UserService.cs +++ b/src/api/src/domain/Yoma.Core.Domain/Entity/Services/UserService.cs @@ -172,8 +172,8 @@ public async Task Upsert(UserRequest request) // profile fields updatable via UserProfileService.Update; identity provider is source of truth if (isNew) { - var kcUser = await _identityProviderClient.GetUser(result.Email) - ?? throw new InvalidOperationException($"{nameof(User)} with email '{result.Email}' does not exist"); + var kcUser = await _identityProviderClient.GetUser(request.Email) + ?? throw new InvalidOperationException($"{nameof(User)} with email '{request.Email}' does not exist"); result.Email = request.Email; result.FirstName = request.FirstName; result.Surname = request.Surname; diff --git a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Keycloak/Models/KeycloakWebhookRequest.cs b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Keycloak/Models/KeycloakWebhookRequest.cs index 2237c21df..2a590c682 100644 --- a/src/api/src/infrastructure/Yoma.Core.Infrastructure.Keycloak/Models/KeycloakWebhookRequest.cs +++ b/src/api/src/infrastructure/Yoma.Core.Infrastructure.Keycloak/Models/KeycloakWebhookRequest.cs @@ -17,7 +17,6 @@ public class Details public string auth_method { get; set; } public string auth_type { get; set; } public string redirect_uri { get; set; } - public string consent { get; set; } public string code_id { get; set; } public string username { get; set; } }