Rocket.Chat icon indicating copy to clipboard operation
Rocket.Chat copied to clipboard

Support for OpenID connect

Open svrooij opened this issue 10 years ago • 21 comments

It would be nice for Rocket.Chat to support OpenID Connect

This seams to become the new standard for SSO to remote servers.

svrooij avatar Aug 02 '16 20:08 svrooij

We would love to have a PR for that :)

marceloschmidt avatar Aug 03 '16 00:08 marceloschmidt

I think then I should create something in packages But there're two things I could not figure out:

  • where do I put the settings (and support multiple entries)
  • how do the packages in the above folder get loaded

I never developed something with meteor, so it kinda has a steep learning curve.

The settings I probably need are:

  • Client ID
  • Authorize URL
  • Scopes to request
  • UserInfo URL

svrooij avatar Aug 03 '16 05:08 svrooij

@svrooij that's right, you should put your code inside packages folder. What do you mean by it needs to support multiple entries? After you add your code to the packages folder, you must edit the .meteor/packages file and add yours there. You can get inspired by these packages: rocketchat-piwik and rocketchat-cas. Both packages show how to add stuff to settings and how to use files on server / client side. Thank you for your help.

marceloschmidt avatar Aug 03 '16 11:08 marceloschmidt

@marceloschmidt With multiple entries I mean that OpenID Connect is an extension on top op OAuth2. And if we (me or someone else) would implement OpenID Connect you could have multiple providers. So at this moment you provide multiple custom oauth providers, that could also be the case with multiple OpenId Connect providers.

In fact I think it could be a choice when adding a Custom OAuth provider. It is either OAuth2 or OpenID Connect. because most properties are identical.

OpenID Connect works with a discovery document sample that is always at the same url /.well-known/openid-configuration their any client can get the correct urls. So it is like OAuth2 authentication with auto configuration.

svrooij avatar Aug 10 '16 09:08 svrooij

@svrooij Just curious where things are. Any chance any progress have been made on this?

Thanks.

bikashp avatar Oct 31 '16 15:10 bikashp

Any update on this? If not I would be interested in picking it up.

AlecTroemel avatar Dec 19 '16 17:12 AlecTroemel

Hi, I'm not sure to understand this query, today we can use an openID Connect provider for rocket.chat. For example we use keycloak connected to several directory (LDAP) and rocket.chat is connected to keycloak to delegate identification through oauth (we didn't succeed in using SAML though...). Is there a point I am missing ?

fcoppolani avatar Dec 30 '16 16:12 fcoppolani

Hi, I'm not sure to understand this query, today we can use an openID Connect provider for rocket.chat. For example we use keycloak connected to several directory (LDAP) and rocket.chat is connected to keycloak to delegate identification through oauth (we didn't succeed in using SAML though...). Is there a point I am missing ?

I'm currently trying to get rocket.chat working with Keycloak. I've managed to get keycloak login page, as well as successful login (I can see active session in Keycloak admin console for rocket.chat client). But I keep resieving "internal server error" pop on rocket.chat login page :/ Do you have any tips/tricks which I should check out?

bakhtizin avatar Jun 13 '17 13:06 bakhtizin

@bakhtizin hi, one most obvious error could be the redirect url, you should check that keycloak has the right one (rocket.Chat provide it to you). Linked to that I had to put a local reverse proxy (so the url wouldn't be with the port), and I had to mess up with the SELinux (permissive). Hope it helps.

fcoppolani avatar Jun 13 '17 15:06 fcoppolani

@fcoppolani thank you for the idea. I'll try out the trick with reverse proxy.

bakhtizin avatar Jun 22 '17 09:06 bakhtizin

So, how can this be accomplished?

GabrielSieben avatar Oct 13 '17 16:10 GabrielSieben

We are successfully running Rocket.Chat with keycloak and OpenID Connect in a production environment.

Our client settings in keycloak:

Consent-required: off
Accss-type: confidential
Standard-flow enabled: on
Impicit-flow enabled: on
Valid Redirect URIs: http://localhost/_oauth/myidentityprovidername , http://mychatserver.org/_oauth/myidentityprovidername

Oauth settings in Rocket.Chat:

URL: https://myidentityprovider.org/auth
Token path: /realms/myrealm/protocol/openid-connect/token
Identity path: /realms/myrealm/protocol/openid-connect/userinfo
Auth path: /realms/myrealm/protocol/openid-connect/auth
Area: openid
Token sent via: head line
ID: as provided by ield username: keycloak
Secret: as provided by keycloak
Field Username: preferred_username

rasos avatar Oct 13 '17 18:10 rasos

@gjsman take a look at https://github.com/RocketChat/Rocket.Chat/issues/7418

bakhtizin avatar Oct 16 '17 09:10 bakhtizin

@bakhtizin Interesting. The thing is I would like to avoid using Keycloak if possible (saves server memory), but no other OpenID providers seem to work. I've tried Auth0.com, the WordPress plugin, all fail with the same, weird error for me:

�[34mI20171014-22:03:42.724(0) Exception while invoking method 'login' SyntaxError: Unexpected token < at Object.parse (native) at CustomOAuth.getAccessToken (/snap/rocketchat-server/1142/programs/server/packages/rocketchat_custom-oauth.js:166:17) at Object.handleOauthRequest (/snap/rocketchat-server/1142/programs/server/packages/rocketchat_custom-oauth.js:224:28) at OAuth._requestHandlers.(anonymous function) (packages/oauth2.js:27:31) at middleware (packages/oauth.js:203:5) at packages/oauth.js:176:5

GabrielSieben avatar Oct 16 '17 14:10 GabrielSieben

@gjsman it hints that there is somehting going out of hand with token parsing, maybe checking out how the providers named by you deliver the access tokens can help you out

bakhtizin avatar Oct 16 '17 14:10 bakhtizin

Why would it affect three different providers though? It looks more like a Rocket.Chat issue than a provider issue...

I will try.

GabrielSieben avatar Oct 16 '17 15:10 GabrielSieben

I've tested with drupal and gitlab a while back and that worked as a charm. (Provided you know how to setup opened connect) there are even some helper functions present in Rocket Chat to help set it up.

Lawri-van-Buel avatar Oct 16 '17 16:10 Lawri-van-Buel

@svrooij do we have any implicit flow implementation for the openid connect. Currently the whole oauth setup in Rocket.Chat expect a code in the query string while with implicit flow it returns token in the url hash. You can further read about implicit flow on the link http://openid.net/specs/openid-connect-implicit-1_0.html#ImplicitFlow

assadvirgo avatar Apr 17 '18 12:04 assadvirgo

Hello guys. Did anyone manage to make Rocket.Chat work with Keycloak. I have put in the configurations used by @rasos but it's not working. The login screen that I see is for Rocket.Chat it never reaches the Keycloak login screen. And when I try to login, there is no call that goes to Keycloak from Rocket.Chat.

blessbon avatar Apr 25 '18 09:04 blessbon

@bakhtizin could you assist

blessbon avatar Apr 25 '18 10:04 blessbon