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

[BUG] Role obtained from oauth login are not updated at each connection #15225

Closed
lmopi opened this issue Aug 21, 2019 · 19 comments · Fixed by #23588
Closed

[BUG] Role obtained from oauth login are not updated at each connection #15225

lmopi opened this issue Aug 21, 2019 · 19 comments · Fixed by #23588
Assignees
Milestone

Comments

@lmopi
Copy link
Contributor

lmopi commented Aug 21, 2019

Description:

The roles of a logged in user from SSO are not updated if the user has a new idp role

Steps to reproduce:

  1. Configure a custom Oauth with merge roles from SSO: true
  2. Sign in for the first time with user1
  3. Add on the idp, a role to the user1
  4. Reconnect with user1

Expected behavior:

The roles of the user must be updated at each connection

Actual behavior:

Only the roles of the first connection are taken into account
The groups are correctly seen in the debug logs but the user is not updated
The role already exists on rocketchet

Server Setup Information:

  • Version of Rocket.Chat Server: 1.3.2
  • Operating System: Linux
  • Deployment Method: tar
  • Number of Running Instances: 1
  • NodeJS Version: v8.11.4
  • MongoDB Version: 4.0.12
@lmopi lmopi changed the title Role obtained from oauth login are not updated at each connection [BUG] Role obtained from oauth login are not updated at each connection Aug 23, 2019
@lmopi
Copy link
Contributor Author

lmopi commented Aug 27, 2019

@Hudell ?

@Hudell Hudell self-assigned this Aug 27, 2019
@col-panic
Copy link
Contributor

Does this feature even work at all? I try this using a custom oauth for keycloak, and have added the client-specific role "Admin" and "livechat-agent" - I also have enabled "Merge roles from SSO" but on register they never get attributed to the user. I also tried removing the user and doing a full logoff on keycloak site, re-registering the user - nothing is merged.

grafik

@lmopi
Copy link
Contributor Author

lmopi commented Sep 11, 2019

Yes the feature works for the first connection. Have you correctly filled the mapper tab in your rockechat client from Keycloak side ?

@col-panic
Copy link
Contributor

@lmopi I'm sorry I don't understand what tab you mean?! In Rocket.Chat I have Roles/Groups field name set to roles. In keycloak, I have no mappers. Do I need to set one here?

grafik

@lmopi
Copy link
Contributor Author

lmopi commented Sep 11, 2019

Yes, you need to push your keycloak roles to rocketchat with a mapper like bellow but with roles
1


2

@col-panic
Copy link
Contributor

Thanks for the help!!

The solution you show is specific to LDAP stored users (I assume!).

The mapping from the role info within rocketchat itself does not seem to work. I created a non-ldap user in keycloak, and manually assigned it the client-specific roles, and even this is not being taken into account.

Could you maybe verify, that your role mapping solution is working for a non-ldap-keycloak-provided user?

@col-panic
Copy link
Contributor

I've managed to get it working for my basic scenario. I have added the required roles to the client, and the client-specific roles to the user. Mapping it to roles as shown in the images finally makes it working (for non-ldap).

grafik

grafik

@DRLDoom
Copy link

DRLDoom commented Jun 1, 2020

Is there any chance of role syncing, post initial user creation, is ever going to be implemented?

@col-panic
Copy link
Contributor

I managed to realize this via SAML, where i provided a patch for role syncing.

@ShellyXueHan
Copy link

Also wondering if there are plans to implement role syncing in OAuth post initial user creation? Thx!

@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stat: stale Stale issues will be automatically closed if no activity label Oct 9, 2020
@pierre-lehnen-rc pierre-lehnen-rc removed the stat: stale Stale issues will be automatically closed if no activity label Oct 9, 2020
@pierre-lehnen-rc pierre-lehnen-rc added this to the 3.8.0 milestone Oct 9, 2020
@pierre-lehnen-rc
Copy link
Contributor

This seems to be working properly for custom OAuths, in what OAuth server are the roles not being synced?

@pierreozoux
Copy link
Contributor

I just tried with RC 3.9.3, keycloack and group sync, it works on first login, but then I logout, I remove the group, login again, and it is not synced.

@reda-alaoui
Copy link
Contributor

Tested on RC master with Keycloak, it works.
Roles are correctly synced on each authentication.

@dimitrihof
Copy link

dimitrihof commented Feb 9, 2021

Tested on RC master with Keycloak, it works.
Roles are correctly synced on each authentication.

What version are you using? Just tested in on 3.8.8 and it doesn't seem to work.

@reda-alaoui
Copy link
Contributor

The master at that time was 3.11 I guess.

@JustDevNull
Copy link

Any update abouth this? I'm currently using 3.13.0-rc.2 with Docker and the roles still are not updated.

@brendan-mccoy
Copy link

Any updates? Alternatively, can the SAML docs here be updated to be a little less ambiguously written? Following that I just get constant "Invalid request" messages from Keycloak.

@arunodhayam1998
Copy link

Hi Guys... I want to integrate keycloak with rocket chat, Pls help me. Both applications are in docker and hosted with domain name...
Pls help with this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.