Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(seeding): add userProfile and localizationTexts to seeding #1154

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

Phil91
Copy link
Member

@Phil91 Phil91 commented Nov 17, 2024

Description

add userProfile and localizationTexts to keycloak seeding

Why

To enable the seeding of userProfiles and localization Texts

Issue

Refs: #1150

Checklist

  • I have followed the contributing guidelines
  • I have performed IP checks for added or updated 3rd party libraries
  • I have created and linked IP issues or requested their creation by a committer
  • I have performed a self-review of my own code
  • I have successfully tested my changes locally
  • I have added tests that prove my changes work
  • I have checked that new and existing tests pass locally with my changes
  • I have commented my code, particularly in hard-to-understand areas

@Phil91 Phil91 requested review from ntruchsess and evegufy and removed request for ntruchsess November 17, 2024 11:30
@Phil91 Phil91 force-pushed the feature/1150-seeding branch from a0b42a1 to 5c4366b Compare November 18, 2024 06:59
@Phil91 Phil91 added this to the Release 2.3.0 (24.12) milestone Nov 18, 2024
@evegufy
Copy link
Contributor

evegufy commented Nov 18, 2024

Hi @Phil91 format check failed

@Phil91 Phil91 force-pushed the feature/1150-seeding branch from 5c4366b to 340c50d Compare November 18, 2024 09:19
@Phil91 Phil91 force-pushed the feature/1150-seeding branch from 340c50d to b87d1a1 Compare November 18, 2024 09:50
Copy link
Contributor

@evegufy evegufy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the CX-Central realm for the import of the user profile related values and that works now 👍
But I also tested if the import of the realms in sharedidp still works with this change and I'm getting the following error in the seeding job:
{"Timestamp":"2024-11-18T11:59:38.8573917+00:00","Level":"Fatal","MessageTemplate":"Unhandled exception","RenderedMessage":"Unhandled exception","Exception":"Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling.KeycloakNoSuccessException: Bad Request: http://sharedidp-keycloak/auth/realms/master/protocol/openid-connect/token\n ---> Flurl.Http.FlurlHttpException: Call failed with status code 400 (Bad Request): POST http://sharedidp-keycloak:80/auth/realms/master/protocol/openid-connect/token\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n --- End of inner exception stack trace ---\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling.FlurlErrorHandler.<>c__DisplayClass0_0.<ConfigureErrorHandler>b__1(FlurlCall call) in /src/keycloak/Keycloak.ErrorHandling/FlurlErrorHandler.cs:line 58\n at Flurl.Http.FlurlEventHandler.FromAsyncAction.HandleAsync(FlurlEventType eventType, FlurlCall call)\n at Flurl.Http.FlurlClient.RaiseEventAsync(FlurlEventType eventType, FlurlCall call)\n at Flurl.Http.FlurlClient.HandleExceptionAsync(FlurlCall call, Exception ex, CancellationToken token)\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n at Flurl.Http.ResponseExtensions.ReceiveJson[T](Task1 response)\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions.FlurlRequestExtensions.GetAccessTokenAsync(String url, String realm, String userName, String password, Boolean useAuthTrail, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs:line 37\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions.FlurlRequestExtensions.WithAuthenticationAsync(IFlurlRequest request, Func2 getTokenAsync, String url, String realm, String userName, String password, String clientSecret, String clientId, Boolean useAuthTrail, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs:line 84\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.KeycloakClient.DeleteComponentAsync(String realm, String componentId, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Components/KeycloakClient.cs:line 69\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.ComponentsUpdater.DeleteComponents(KeycloakClient keycloak, String realm, IEnumerable1 components, IEnumerable1 updateComponents, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/ComponentsUpdater.cs:line 81\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.ComponentsUpdater.UpdateComponents(String keycloakInstanceName, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/ComponentsUpdater.cs:line 45\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.KeycloakSeeder.Seed(CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/KeecloakSeeder.cs:line 49\n at Program.<Main>$(String[] args) in /src/keycloak/Keycloak.Seeding/Program.cs:line 86"}

@ntruchsess ntruchsess linked an issue Nov 19, 2024 that may be closed by this pull request
@Phil91 Phil91 force-pushed the feature/1150-seeding branch from b87d1a1 to 851f336 Compare November 20, 2024 07:50
@Phil91 Phil91 requested a review from ntruchsess November 20, 2024 08:03
@Phil91
Copy link
Member Author

Phil91 commented Nov 20, 2024

I tested the CX-Central realm for the import of the user profile related values and that works now 👍 But I also tested if the import of the realms in sharedidp still works with this change and I'm getting the following error in the seeding job: {"Timestamp":"2024-11-18T11:59:38.8573917+00:00","Level":"Fatal","MessageTemplate":"Unhandled exception","RenderedMessage":"Unhandled exception","Exception":"Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling.KeycloakNoSuccessException: Bad Request: http://sharedidp-keycloak/auth/realms/master/protocol/openid-connect/token\n ---> Flurl.Http.FlurlHttpException: Call failed with status code 400 (Bad Request): POST http://sharedidp-keycloak:80/auth/realms/master/protocol/openid-connect/token\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n --- End of inner exception stack trace ---\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling.FlurlErrorHandler.<>c__DisplayClass0_0.<ConfigureErrorHandler>b__1(FlurlCall call) in /src/keycloak/Keycloak.ErrorHandling/FlurlErrorHandler.cs:line 58\n at Flurl.Http.FlurlEventHandler.FromAsyncAction.HandleAsync(FlurlEventType eventType, FlurlCall call)\n at Flurl.Http.FlurlClient.RaiseEventAsync(FlurlEventType eventType, FlurlCall call)\n at Flurl.Http.FlurlClient.HandleExceptionAsync(FlurlCall call, Exception ex, CancellationToken token)\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n at Flurl.Http.ResponseExtensions.ReceiveJson[T](Task1 response)\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions.FlurlRequestExtensions.GetAccessTokenAsync(String url, String realm, String userName, String password, Boolean useAuthTrail, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs:line 37\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions.FlurlRequestExtensions.WithAuthenticationAsync(IFlurlRequest request, Func2 getTokenAsync, String url, String realm, String userName, String password, String clientSecret, String clientId, Boolean useAuthTrail, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs:line 84\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.KeycloakClient.DeleteComponentAsync(String realm, String componentId, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Components/KeycloakClient.cs:line 69\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.ComponentsUpdater.DeleteComponents(KeycloakClient keycloak, String realm, IEnumerable1 components, IEnumerable1 updateComponents, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/ComponentsUpdater.cs:line 81\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.ComponentsUpdater.UpdateComponents(String keycloakInstanceName, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/ComponentsUpdater.cs:line 45\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.KeycloakSeeder.Seed(CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/KeecloakSeeder.cs:line 49\n at Program.<Main>$(String[] args) in /src/keycloak/Keycloak.Seeding/Program.cs:line 86"}

could you please recheck, I've adjusted the logic

@Phil91 Phil91 requested a review from evegufy November 20, 2024 08:03
Copy link

@evegufy
Copy link
Contributor

evegufy commented Nov 20, 2024

I tested the CX-Central realm for the import of the user profile related values and that works now 👍 But I also tested if the import of the realms in sharedidp still works with this change and I'm getting the following error in the seeding job: {"Timestamp":"2024-11-18T11:59:38.8573917+00:00","Level":"Fatal","MessageTemplate":"Unhandled exception","RenderedMessage":"Unhandled exception","Exception":"Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling.KeycloakNoSuccessException: Bad Request: http://sharedidp-keycloak/auth/realms/master/protocol/openid-connect/token\n ---> Flurl.Http.FlurlHttpException: Call failed with status code 400 (Bad Request): POST http://sharedidp-keycloak:80/auth/realms/master/protocol/openid-connect/token\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n --- End of inner exception stack trace ---\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.ErrorHandling.FlurlErrorHandler.<>c__DisplayClass0_0.<ConfigureErrorHandler>b__1(FlurlCall call) in /src/keycloak/Keycloak.ErrorHandling/FlurlErrorHandler.cs:line 58\n at Flurl.Http.FlurlEventHandler.FromAsyncAction.HandleAsync(FlurlEventType eventType, FlurlCall call)\n at Flurl.Http.FlurlClient.RaiseEventAsync(FlurlEventType eventType, FlurlCall call)\n at Flurl.Http.FlurlClient.HandleExceptionAsync(FlurlCall call, Exception ex, CancellationToken token)\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n at Flurl.Http.FlurlClient.SendAsync(IFlurlRequest request, HttpCompletionOption completionOption, CancellationToken cancellationToken)\n at Flurl.Http.ResponseExtensions.ReceiveJson[T](Task1 response)\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions.FlurlRequestExtensions.GetAccessTokenAsync(String url, String realm, String userName, String password, Boolean useAuthTrail, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs:line 37\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.Common.Extensions.FlurlRequestExtensions.WithAuthenticationAsync(IFlurlRequest request, Func2 getTokenAsync, String url, String realm, String userName, String password, String clientSecret, String clientId, Boolean useAuthTrail, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Common/Extensions/FlurlRequestExtensions.cs:line 84\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Library.KeycloakClient.DeleteComponentAsync(String realm, String componentId, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Library/Components/KeycloakClient.cs:line 69\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.ComponentsUpdater.DeleteComponents(KeycloakClient keycloak, String realm, IEnumerable1 components, IEnumerable1 updateComponents, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/ComponentsUpdater.cs:line 81\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.ComponentsUpdater.UpdateComponents(String keycloakInstanceName, CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/ComponentsUpdater.cs:line 45\n at Org.Eclipse.TractusX.Portal.Backend.Keycloak.Seeding.BusinessLogic.KeycloakSeeder.Seed(CancellationToken cancellationToken) in /src/keycloak/Keycloak.Seeding/BusinessLogic/KeecloakSeeder.cs:line 49\n at Program.<Main>$(String[] args) in /src/keycloak/Keycloak.Seeding/Program.cs:line 86"}

could you please recheck, I've adjusted the logic

successfully retested 👍

evegufy added a commit to eclipse-tractusx/portal-iam that referenced this pull request Nov 20, 2024
evegufy added a commit to eclipse-tractusx/portal-iam that referenced this pull request Nov 20, 2024
* fix: enable user profiles in cx-central realm
to address user attributes change coming keycloak v24
#226
* fix(master sharedidp): update realm to not require user profiles
as that's the default in master realms, discovered as part of eclipse-tractusx/portal-backend#1154
* fix(svc): add technical_roles_management role to client scope
#227
* fix(svc): add create_ssi_notifications role to sa-cl24-01
from Cl2-CX-Portal client
#229
* fix(docs): add store_didDocument from technical user accounts
@ntruchsess ntruchsess merged commit 69f4e6b into release/v2.3.0-RC3 Nov 20, 2024
10 checks passed
@ntruchsess ntruchsess deleted the feature/1150-seeding branch November 20, 2024 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: USER READY
Development

Successfully merging this pull request may close these issues.

Enhance Keycloak seeding job for user profiles
3 participants