-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option on custom oauth to send access token in headers or in payl…
…oad (#2818)
- Loading branch information
1 parent
9d61b4a
commit 6b79286
Showing
6 changed files
with
69 additions
and
16 deletions.
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
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,39 @@ | ||
RocketChat.Migrations.add({ | ||
version: 40, | ||
up: function() { | ||
RocketChat.models.Settings.find({ _id: /Accounts_OAuth_Custom_/, i18nLabel: 'Accounts_OAuth_Custom_Enable' }).forEach(function(customOauth) { | ||
var parts = customOauth._id.split('_'); | ||
var name = parts[3]; | ||
var id = 'Accounts_OAuth_Custom_' + name + '_token_sent_via'; | ||
if (!RocketChat.models.Settings.findOne( { _id: id } )) { | ||
RocketChat.models.Settings.insert({ | ||
'_id': id, | ||
'type': 'select', | ||
'group': 'OAuth', | ||
'section': 'Custom OAuth: ' + name, | ||
'i18nLabel': 'Accounts_OAuth_Custom_Token_Sent_Via', | ||
'persistent': true, | ||
'values': [ | ||
{ | ||
'key': 'header', | ||
'i18nLabel': 'Header' | ||
}, | ||
{ | ||
'key': 'payload', | ||
'i18nLabel': 'Payload' | ||
} | ||
], | ||
'packageValue': 'payload', | ||
'valueSource': 'packageValue', | ||
'ts': new Date(), | ||
'hidden': false, | ||
'blocked': false, | ||
'sorter': 255, | ||
'i18nDescription': 'Accounts_OAuth_Custom_' + name + '_token_sent_via_Description', | ||
'createdAt': new Date(), | ||
'value': 'payload' | ||
}); | ||
} | ||
}); | ||
} | ||
}); |