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

[NEW][API] Endpoint settings.addCustomOAuth to create Custom OAuth services #14912

Merged
merged 7 commits into from
May 30, 2020
Merged

[NEW][API] Endpoint settings.addCustomOAuth to create Custom OAuth services #14912

merged 7 commits into from
May 30, 2020

Conversation

g-rauhoeft
Copy link
Contributor

This pull request adds a new path to the app/api/server/v1/settings.js file, called "settings.addCustomOAuth", which allows users to create a new custom OAuth Service definition via the REST interface, as discussed under https://forums.rocket.chat/t/add-custom-oauth-via-rest-api/3967.

@reetp
Copy link

reetp commented Jul 2, 2019

Just a thought, but is it worth looking at this as well while you are at it?

RocketChat/feature-requests#142

Copy link
Contributor

@geekgonecrazy geekgonecrazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to make a few more of these fields required.

https://github.com/RocketChat/Rocket.Chat/blob/develop/app/lib/server/methods/addOAuthService.js#L24

Especially the critical things to make it work. Like:

  • url
  • client id
  • client secret

@geekgonecrazy
Copy link
Contributor

geekgonecrazy commented Jul 23, 2019

@reetp I think if addressing that feature request would need to open a new PR as wouldn't fit in the scope of this PR

@codakin
Copy link

codakin commented Jul 24, 2019

@geekgonecrazy I think the current implementation is correct. This mimics the behavior in the application. First you provide a name and the custom Oauth is created. Then you make edits and provide additional values. These values would be set via the REST API using the Settings update call. This would prevent having to update the REST API call proposed, in the future if some settings should change.

Also, in the code you shared for addOauthService, it only accepts one parameter of name so the proposed solution is also consistent for this reason. It then continues on the create all the parameters you'll need so that you can call the settings update REST API for each one you need to change.

Let me know if I'm missing something. Would love to see this feature in the next release.

@geekgonecrazy
Copy link
Contributor

Ah good point! Not sure how I missed that. It is definitely too bad that that doesn’t return the settings created to make it easier for the following call. But I can’t think of a clean way to do that.

@g-rauhoeft
Copy link
Contributor Author

Thanks for the comments, everyone!

@reetp I'm sorry, but that does seem a bit far out of scope for this pull request, especially because it concerns very different parts of the application.

@codakin Thank you, that does fit my reasoning perfectly. Basically my implementation just provides an API route for what the admin UI "Add OAuth Service" button does. I set the options for the created OAuth Service via the options (settings?) API.

@geekgonecrazy Thank you for the change request. codakin explained the reason behind the lack of further parameters to the route. If the explanation is sufficient, could you please close the request? I believe returning a list of options would break consistency with the API of Rocket.Chat in general and the paths to update the properties of an arbitrary OAuth Service are quite easy to generate. I can supply examples for the documentation if you want.

@geekgonecrazy geekgonecrazy dismissed their stale review August 16, 2019 19:23

not relevant

@col-panic
Copy link
Contributor

Related #10420

@col-panic
Copy link
Contributor

Is there any plan on including this in one of the next releases? Would parts of this code probably solve #10420 , if yes, could they be probably provided as separate PR? Thanks

@g-rauhoeft
Copy link
Contributor Author

Is there any plan on including this in one of the next releases? Would parts of this code probably solve #10420 , if yes, could they be probably provided as separate PR? Thanks

I've re-requested a review, as it seems this has gone to sleep. :)

@Ubitso
Copy link

Ubitso commented Jan 17, 2020

@geekgonecrazy @g-rauhoeft Can you merge this PR? Any updates?

@g-rauhoeft
Copy link
Contributor Author

@geekgonecrazy @g-rauhoeft Can you merge this PR? Any updates?

Sorry mate, nothing I can do because I'm not a member of the Rocket.Chat team and haven't got write access.

@CLAassistant
Copy link

CLA assistant check
All committers have signed the CLA.

@rodrigok rodrigok added this to the 3.4.0 milestone May 30, 2020
@rodrigok rodrigok changed the title [NEW] API create OAuth service [NEW][API] Endpoint settings.addCustomOAuth to create Custom OAuth services May 30, 2020
@rodrigok rodrigok merged commit 16d5da2 into RocketChat:develop May 30, 2020
gabriellsh added a commit that referenced this pull request Jun 1, 2020
…rewrite_admin_sidebar

* 'develop' of github.com:RocketChat/Rocket.Chat: (30 commits)
  Readme: Update Raspberry Pi 2 to Pi 4 (#17031)
  [NEW] Accept variable `#{userdn}` on LDAP group filter (#16273)
  [FIX] Spotify embed link opens in same tab (#13637)
  [FIX] Markdown links not accepting URLs with parentheses (#13605)
  [NEW][API] Endpoint `settings.addCustomOAuth` to create Custom OAuth services (#14912)
  [IMPROVE] Make the implementation of custom code easier by having placeholders for a custom folder (#15106)
  [NEW] Skip Export Operations that haven't been updated in over a day (#16135)
  [NEW] Highlight matching words in message search results (#16166)
  [FIX] Set `x-content-type-options: nosniff` header (#16232)
  [FIX] Disabling `Json Web Tokens protection to file uploads` disables the File Upload protection entirely (#16262)
  Fixes some italian word (#14008)
  Bump version to 3.4.0-develop
  Bump version to 3.3.0
  Bump version to 3.3.0-rc.4
  Bump version to 3.3.0-rc.3
  Bump version to 3.3.0-rc.2
  Bump version to 3.3.0-rc.1
  Bump version to 3.3.0-rc.0
  [FIX] Slack importer Link handling (#17595)
  Bump version to 3.2.2
  ...
gabriellsh added a commit that referenced this pull request Jun 1, 2020
…into new/apps_rewrite

* 'new/apps_rewrite' of github.com:RocketChat/Rocket.Chat: (31 commits)
  Readme: Update Raspberry Pi 2 to Pi 4 (#17031)
  [NEW] Accept variable `#{userdn}` on LDAP group filter (#16273)
  [FIX] Spotify embed link opens in same tab (#13637)
  [FIX] Markdown links not accepting URLs with parentheses (#13605)
  [NEW][API] Endpoint `settings.addCustomOAuth` to create Custom OAuth services (#14912)
  [IMPROVE] Make the implementation of custom code easier by having placeholders for a custom folder (#15106)
  [NEW] Skip Export Operations that haven't been updated in over a day (#16135)
  [NEW] Highlight matching words in message search results (#16166)
  [FIX] Set `x-content-type-options: nosniff` header (#16232)
  [FIX] Disabling `Json Web Tokens protection to file uploads` disables the File Upload protection entirely (#16262)
  Fixes some italian word (#14008)
  Submit a payload to the release service when a release happens (#17775)
  Bump version to 3.4.0-develop
  Bump version to 3.3.0
  Bump version to 3.3.0-rc.4
  Bump version to 3.3.0-rc.3
  Bump version to 3.3.0-rc.2
  Bump version to 3.3.0-rc.1
  Bump version to 3.3.0-rc.0
  [FIX] Slack importer Link handling (#17595)
  ...
shedoev added a commit to sibdigital/rgrt that referenced this pull request Jun 2, 2020
…nto develop

* 'develop' of https://github.com/RocketChat/Rocket.Chat: (83 commits)
  Fix invalid develop payload to release service (RocketChat#17799)
  Readme: Update Raspberry Pi 2 to Pi 4 (RocketChat#17031)
  [NEW] Accept variable `#{userdn}` on LDAP group filter (RocketChat#16273)
  [FIX] Spotify embed link opens in same tab (RocketChat#13637)
  [FIX] Markdown links not accepting URLs with parentheses (RocketChat#13605)
  [NEW][API] Endpoint `settings.addCustomOAuth` to create Custom OAuth services (RocketChat#14912)
  [IMPROVE] Make the implementation of custom code easier by having placeholders for a custom folder (RocketChat#15106)
  [NEW] Skip Export Operations that haven't been updated in over a day (RocketChat#16135)
  [NEW] Highlight matching words in message search results (RocketChat#16166)
  [FIX] Set `x-content-type-options: nosniff` header (RocketChat#16232)
  [FIX] Disabling `Json Web Tokens protection to file uploads` disables the File Upload protection entirely (RocketChat#16262)
  Fixes some italian word (RocketChat#14008)
  Submit a payload to the release service when a release happens (RocketChat#17775)
  Bump version to 3.4.0-develop
  Bump version to 3.3.0
  Bump version to 3.3.0-rc.4
  Regression: Fix Unread bar design (RocketChat#17750)
  Regression: Adjusting spaces between OAuth login buttons (RocketChat#17745)
  Improved thread margins for clarity
  Bump version to 3.3.0-rc.3
  ...

� Conflicts:
�	app/theme/client/imports/general/variables.css
�	app/ui-sidenav/client/sideNav.html
ggazzo added a commit that referenced this pull request Jun 3, 2020
…/new-threads

* 'develop' of github.com:RocketChat/Rocket.Chat: (38 commits)
  [IMPROVE][Federation] Add support for _tcp and protocol DNS entries (#17818)
  Fix the update check not working (#17809)
  Add Apps-Engine to Engine Versions on History (#17810)
  [FIX] Link preview containing HTML encoded chars (#16512)
  [FIX] Email link "go to message" being incorrectly escaped (#17803)
  [FIX] Error when re-installing an App (#17789)
  Update Apps-Engine version (#17804)
  Fix invalid develop payload to release service (#17799)
  Readme: Update Raspberry Pi 2 to Pi 4 (#17031)
  [NEW] Accept variable `#{userdn}` on LDAP group filter (#16273)
  [FIX] Spotify embed link opens in same tab (#13637)
  [FIX] Markdown links not accepting URLs with parentheses (#13605)
  [NEW][API] Endpoint `settings.addCustomOAuth` to create Custom OAuth services (#14912)
  [IMPROVE] Make the implementation of custom code easier by having placeholders for a custom folder (#15106)
  [NEW] Skip Export Operations that haven't been updated in over a day (#16135)
  [NEW] Highlight matching words in message search results (#16166)
  [FIX] Set `x-content-type-options: nosniff` header (#16232)
  [FIX] Disabling `Json Web Tokens protection to file uploads` disables the File Upload protection entirely (#16262)
  Fixes some italian word (#14008)
  Bump version to 3.4.0-develop
  ...
@sampaiodiego sampaiodiego mentioned this pull request Jun 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants