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

Keycloak backend plugin is not wotking as expected #2112

Open
paralika opened this issue Aug 30, 2024 · 7 comments
Open

Keycloak backend plugin is not wotking as expected #2112

paralika opened this issue Aug 30, 2024 · 7 comments
Labels
jira kind/bug Something isn't working status/triage

Comments

@paralika
Copy link

Describe the bug

I have setup the Keycloak backend plugin by following the steps given on below this link - https://janus-idp.io/plugins/keycloak/ . Plugin configure successfully and it started syncing users and groups, but then abruptly, it stopped syncing with below error.

Processor BuiltinKindsEntityProcessor threw an error while validating the entity group:default/mainstream-engineering-admin; caused by TypeError: /spec/members/2 must be string - type: string entity=group:default/mainstream-engineering-admin �[36mlocation�[39m=url:https://authusqa.devops.sws.company.com/auth/admin/realms/chim/groups/480049ad-7a33-41ab-87a6-382a797831e0

I am using the new backend and followed the plugin configuration steps accordingly.

Expected Behavior

All users and groups from keyclock realm should be synced

What are the steps to reproduce this bug?

  1. Setup backstage
  2. Configure the Keycloak plugin for new backup configuration (using steps from https://janus-idp.io/plugins/keycloak/)

Versions of software used and environment

@janus-idp/backstage-plugin-keycloak-backend": "^1.13.1",

Backstage - 1.30.4 ([email protected])

@paralika paralika added kind/bug Something isn't working status/triage labels Aug 30, 2024
@github-actions github-actions bot added the jira label Aug 30, 2024
@paralika
Copy link
Author

paralika commented Sep 3, 2024

Any comments here please?

@kadel
Copy link
Member

kadel commented Sep 4, 2024

@paralika This looks like an invalid group definition. Is the mainstream-engineering-admin group something that you created, or is it imported by the plugin?

Can you share what this group looks like? Find this group in Catalog, lick on 3 dots in top right corner, and select inspect entity, there you can find Raw Yaml.

@paralika
Copy link
Author

paralika commented Sep 4, 2024

@kadel "mainstream-engineering-admin" is available in Keycloak. The plugin is trying to import it, but it is not successful yet. I have ~1k groups in Keycloak. Out of that, only 341 groups were imported successfully and for others it is failing with this error.

@kadel
Copy link
Member

kadel commented Sep 4, 2024

The error message complains about a third member of that group. Can you check the members of that group? Maybe you notice something suspicious. For example, isn't there a user with numeric username?

@paralika
Copy link
Author

paralika commented Sep 4, 2024

@kadel I do not see any suspicious chars. Please see the screenshot below. The username is an alphanumeric value pointing to the users.

image

@04kash
Copy link
Member

04kash commented Sep 4, 2024

The Keycloak admin API returns usernames as strings (https://github.com/keycloak/keycloak/blob/main/js/libs/keycloak-admin-client/src/defs/userRepresentation.ts#L10), so I don't think that should be an issue.

I tested by assigning both numeric and alphanumeric usernames to a group, and the sync process worked as expected for users and groups. Here is what I received under spec.members:

spec:
  members:
    - "078687777"
    - z007abc7666666

Screenshot from 2024-09-04 16-38-24

Are you using any custom transformers in your setup? If so, it's possible that they might be mutating the entity in a way that’s causing type issues during validation.

@paralika
Copy link
Author

paralika commented Sep 5, 2024

No, I do not have any custom transformer set. I am following the instructions given at - https://janus-idp.io/plugins/keycloak/

Did you follow the same instructions? Wondering if I missed anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira kind/bug Something isn't working status/triage
Projects
None yet
Development

No branches or pull requests

3 participants