Skip to content

Error adding clientRoles to a user #246

@Tijs-2

Description

@Tijs-2

Describe the bug
When I rollout a user with clientRoles the operator gives an error and cannot add the roles to the user.
When I then manually add the roles to the user it says that the sync is ok. So it detects the added client roles.

To Reproduce
Add the following user

apiVersion: v1.edp.epam.com/v1
kind: KeycloakRealmUser
metadata:
  name: user
spec:
  realmRef:
    name: realm
    kind: KeycloakRealm
  username: user
  firstName: "User"
  lastName: "Name"
  email: "user@example.com"
  enabled: true
  emailVerified: true
  keepResource: true
  clientRoles:
    - clientId: "realm-management"
      roles:
        - view-users
        - query-users
  roles:
    - offline_access

What did you expect to see?

I would expect to see the clientRoles attached automatically.

What did you see instead? Under which circumstances?

I get the following error in the KeycloakRealmUser:
Value: unable to sync realm user: unable to sync user client roles: error during syncOneEntityClientRole: unable to add realm role to entity, realm: life-and-beyond-dev, clientID: 1289ca2f-9507-4cea-a0dd-c0d32df02c12, entityID: 8a8eaf28-9b01-4eb6-9269-f48874c89848: 403 Forbidden: HTTP 403 Forbidden

Operator version:
Operator: 1.29
Keycloak: 26.4.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No fields configured for Bug.

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions