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
[NEW] Drupal oAuth Integration for Rocketchat #6632
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
32bd5ae
Initial Drupal integration for rocket chat, still WIP
Lawri-van-Buel 13c3eee
Pre-Update of fork
Lawri-van-Buel 2102fd9
Merge remote-tracking branch 'upstream/develop' into develop
Lawri-van-Buel 2125f10
Moved Drupal Additions to the Drupal package until Integration accept…
Lawri-van-Buel 2ac4f8e
Added a simpleREADME on how to use this, and added the i18n text for …
Lawri-van-Buel 7667867
aperantly also a i18n update. unsure if this is what we want. But Rea…
Lawri-van-Buel 20d00ad
- Changed double quotes to single quotes.
Lawri-van-Buel 0293b03
Removed Doplhin example comments
Lawri-van-Buel eef2d5f
Pre merge upstream meteor update
Lawri-van-Buel a1589a9
Revert accidental upgrades in the .meteor dir that should be done thr…
Lawri-van-Buel fad1769
Moved translatable strings to i18n module, removed erouneos added roc…
Lawri-van-Buel 7c9d93d
Merge remote-tracking branch 'origin/develop' into develop
Lawri-van-Buel 5f98201
Merge branch 'develop' into develop
engelgabriel File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#Drupal oAuth Integration module. | ||
This module works in conjunction with the [Rocket.Chat+ Module for Drupal](https://www.drupal.org/project/rocket_chat) | ||
Version 7.x-1.1 or later. | ||
|
||
A full set of instructions for how to connect the 2 are present in the drupal module's documentation. | ||
|
||
Basically to connect the 2 you first setup the oAuth server connection in your drupal, with the proper permissions | ||
("Use OAuth2 Server" => "Anonymous User" = Checked). | ||
|
||
In the Rocket chat you have to do the following: | ||
- fill in the 'Client ID'. | ||
Bear in mind that the Client ID should not be guessable,but is seen in the URL when doing the login. | ||
- fill in the 'Client Secret'. | ||
This should be treated as a Secret Key (like the Secret Key of a TLS certificate). it __must not__ be guesable or | ||
derivable, and is best a Alphanumerical sequence between 16 and 48 cahracters long (longer would be better but longer | ||
than 48 characters can be problem with long URI's) | ||
- fill in the Drupal's BaseURL. | ||
- on the Drupal use the "Restrict redirect URIs" Setting to limit possible exploits. and set the Redirect URI's to | ||
whatever is in the Callback URL (like `https://Rocketchat.example.com/_oauth/drupal` and possibly also the | ||
`https://Rocketchat.example.com/_oauth/drupal?close` URI.). | ||
- Lastly do not forget to Enable the Drupal OAuth and `SAVE CHANGES`. | ||
|
||
When all is a Blue Button with a drupal like logo will apear on the login page of Rocket.Chat+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* global CustomOAuth */ | ||
|
||
// Drupal Server CallBack URL needs to be http(s)://{rocketchat.server}[:port]/_oauth/drupal | ||
// In RocketChat -> Administration the URL needs to be http(s)://{drupal.server}/ | ||
|
||
const config = { | ||
serverURL: '', | ||
identityPath: '/oauth2/UserInfo', | ||
authorizePath: '/oauth2/authorize', | ||
tokenPath: '/oauth2/token', | ||
scope: 'openid email profile offline_access', | ||
tokenSentVia: 'payload', | ||
usernameField: 'preferred_username', | ||
mergeUsers: true, | ||
addAutopublishFields: { | ||
forLoggedInUser: ['services.drupal'], | ||
forOtherUsers: ['services.drupal.name'] | ||
} | ||
}; | ||
|
||
const Drupal = new CustomOAuth('drupal', config); | ||
|
||
if (Meteor.isServer) { | ||
Meteor.startup(function() { | ||
RocketChat.settings.get('API_Drupal_URL', function(key, value) { | ||
config.serverURL = value; | ||
Drupal.configure(config); | ||
}); | ||
}); | ||
} else { | ||
Meteor.startup(function() { | ||
Tracker.autorun(function() { | ||
if (RocketChat.settings.get('API_Drupal_URL')) { | ||
config.serverURL = RocketChat.settings.get('API_Drupal_URL'); | ||
Drupal.configure(config); | ||
} | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.icon-drupal.service-icon { | ||
display: inline-block; | ||
width: 21px; | ||
height: 28px; | ||
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAcCAYAAACOGPReAAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAcNJREFUSMetlbFrFFEQh7/dJnhpDHcx6SyiRLhLkUKDsRZB8S9IWi2Syj8iVooQ0FLBNlqJRpNO8Br7FLkoRDBooQHhNCr6WTjB48zd7d7uNI+d+c333pt9bx5kNPVGVm1WYF39rTbKhD7zr62XBVwI4MsYF4sCZ9S2uq6mMbbVmWGBx9WW+kGdCN+J+G6pY3mBo2pT/ape6IrNx2qb6mhW4Ii6qf5Ur/TQXI74pjoyCJioa3F8FgdoF0K3pib9hLfiDy9l3NVS6G/3EiyH4GbO+q9E3nJ3oKF+Vx/33Urvkj2K/EZn4JW6l/uY/MsfU9+rzUPHXCz/+jDADvC14Myhrqpf1EpB6LHgrCbqa+BzkiSXikAD/ByopcAUsFUUGLYFTKVABWiXBG0DlRTYB8ZLgo4D+ynQAuolQevAdgq8AM6rk0Vo0R7ngQ3UU+qvvNfzCOhKcE4fOu6r39TpIYHT0XsfdDon45puq7WcwFrk7f1XQvVsdPS3Wd+geMPeRN65XqJZdVf9od5Tz/TZ7t3Q7aqzg2avqnfUg2gQO+pT9WGMO+E/CF21m5H0gU8AV4GLwEmgCnwC3gEbwJMkST4elfsHJbIReGbv9uUAAAAASUVORK5CYII=); | ||
background-repeat: no-repeat; | ||
} | ||
|
||
.button.external-login.drupal { | ||
background-color: #0f85b6; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Package.describe({ | ||
name: 'rocketchat:drupal', | ||
version: '0.0.1', | ||
summary: 'RocketChat settings for Drupal oAuth2' | ||
}); | ||
|
||
Package.onUse(function(api) { | ||
api.versionsFrom('1.0'); | ||
api.use('ecmascript'); | ||
api.use('service-configuration'); | ||
api.use('rocketchat:lib@0.0.1'); | ||
api.use('rocketchat:custom-oauth'); | ||
|
||
// api.use('templating', 'client'); | ||
|
||
api.addFiles('common.js'); | ||
api.addFiles('login-button.css', 'client'); | ||
api.addFiles('startup.js', 'server'); | ||
|
||
api.use('templating', 'client'); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
RocketChat.settings.addGroup('OAuth', function() { | ||
this.section('Drupal', function() { | ||
const enableQuery = { | ||
_id: 'Accounts_OAuth_Drupal', | ||
value: true | ||
}; | ||
|
||
this.add('Accounts_OAuth_Drupal', false, { type: 'boolean' }); | ||
this.add('API_Drupal_URL', '', { type: 'string', public: true, enableQuery, i18nDescription: 'API_Drupal_URL_Description' }); | ||
this.add('Accounts_OAuth_Drupal_id', '', { type: 'string', enableQuery }); | ||
this.add('Accounts_OAuth_Drupal_secret', '', { type: 'string', enableQuery }); | ||
this.add('Accounts_OAuth_Drupal_callback_url', '_oauth/drupal', { type: 'relativeUrl', readonly: true, force: true, enableQuery }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you undo all other changes to this file but this line here? Ideally this PR shouldn't be updating other packages, it should only be adding the code needed for drupal. We'd handle the updating of packages seperately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree I though I had done just that, Will do with the new update as its base.