omniauth-rocketchat 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/CODE_OF_CONDUCT.md +7 -129
- data/LICENSE.md +1 -1
- data/README.md +132 -51
- data/Rakefile +4 -13
- data/UPGRADE.md +34 -0
- data/lib/omniauth/strategies/rocketchat.rb +27 -22
- data/lib/omniauth-rocketchat/version.rb +1 -1
- metadata +36 -86
- data/.gitignore +0 -56
- data/Gemfile +0 -22
- data/omniauth-rocketchat.gemspec +0 -43
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 577664c3ad65b560985c9c1453a5c9960ee791099bea6e6467800f3782b01f11
|
|
4
|
+
data.tar.gz: e67724922fe367825ecd219e9e35762e8d87dd6dce30ef1353a4c998586262f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ba50d26c8218a998b8fcb89d2fb4d0c992f98abbfa7bfb7e054fc4118963f26f081b6081c514c76aa96ee0748764f159e1b9b439b6f40b175efd468baaa0825c
|
|
7
|
+
data.tar.gz: 00b20862f69167b033592c384e7bcdc68aeaee7cb1787a6783c5d5dfd195c1bbbc1f3aa905e4eab419d1c35c24317de79973f9a527d37ce93b011081d0ac14f6
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
### Unreleased
|
|
4
|
+
|
|
5
|
+
### 0.2.0 (2026-03-08)
|
|
6
|
+
|
|
7
|
+
This release contains breaking changes. See [Upgrade Instructions](UPGRADE.md#version-02) for detailed upgrade instructions.
|
|
8
|
+
|
|
9
|
+
#### Breaking
|
|
10
|
+
|
|
11
|
+
- Bumps required Ruby version `>= 3.2`.
|
|
12
|
+
- The `info` hash now returns the expected [Auth Hash Schema 1.0+](https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema).
|
|
13
|
+
- Always returns `info.email`, even if the email was not verified. Check `info.email_verified` for verification status.
|
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -1,132 +1,10 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Code of Conduct
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
"omniauth-rocketchat" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
-
identity and orientation.
|
|
5
|
+
* Participants will be tolerant of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always assume good intentions.
|
|
8
|
+
* Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
diverse, inclusive, and healthy community.
|
|
14
|
-
|
|
15
|
-
## Our Standards
|
|
16
|
-
|
|
17
|
-
Examples of behavior that contributes to a positive environment for our
|
|
18
|
-
community include:
|
|
19
|
-
|
|
20
|
-
* Demonstrating empathy and kindness toward other people
|
|
21
|
-
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
-
* Giving and gracefully accepting constructive feedback
|
|
23
|
-
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
-
and learning from the experience
|
|
25
|
-
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
-
community
|
|
27
|
-
|
|
28
|
-
Examples of unacceptable behavior include:
|
|
29
|
-
|
|
30
|
-
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
-
any kind
|
|
32
|
-
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
-
* Public or private harassment
|
|
34
|
-
* Publishing others' private information, such as a physical or email address,
|
|
35
|
-
without their explicit permission
|
|
36
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
-
professional setting
|
|
38
|
-
|
|
39
|
-
## Enforcement Responsibilities
|
|
40
|
-
|
|
41
|
-
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
-
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
-
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
-
or harmful.
|
|
45
|
-
|
|
46
|
-
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
-
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
-
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
-
decisions when appropriate.
|
|
50
|
-
|
|
51
|
-
## Scope
|
|
52
|
-
|
|
53
|
-
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
-
an individual is officially representing the community in public spaces.
|
|
55
|
-
Examples of representing our community include using an official email address,
|
|
56
|
-
posting via an official social media account, or acting as an appointed
|
|
57
|
-
representative at an online or offline event.
|
|
58
|
-
|
|
59
|
-
## Enforcement
|
|
60
|
-
|
|
61
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
-
reported to the community leaders responsible for enforcement at
|
|
63
|
-
david.uhlig[ at ]gmail.com.
|
|
64
|
-
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
-
|
|
66
|
-
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
-
reporter of any incident.
|
|
68
|
-
|
|
69
|
-
## Enforcement Guidelines
|
|
70
|
-
|
|
71
|
-
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
-
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
-
|
|
74
|
-
### 1. Correction
|
|
75
|
-
|
|
76
|
-
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
-
unprofessional or unwelcome in the community.
|
|
78
|
-
|
|
79
|
-
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
-
clarity around the nature of the violation and an explanation of why the
|
|
81
|
-
behavior was inappropriate. A public apology may be requested.
|
|
82
|
-
|
|
83
|
-
### 2. Warning
|
|
84
|
-
|
|
85
|
-
**Community Impact**: A violation through a single incident or series of
|
|
86
|
-
actions.
|
|
87
|
-
|
|
88
|
-
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
-
interaction with the people involved, including unsolicited interaction with
|
|
90
|
-
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
-
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
-
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
-
ban.
|
|
94
|
-
|
|
95
|
-
### 3. Temporary Ban
|
|
96
|
-
|
|
97
|
-
**Community Impact**: A serious violation of community standards, including
|
|
98
|
-
sustained inappropriate behavior.
|
|
99
|
-
|
|
100
|
-
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
-
communication with the community for a specified period of time. No public or
|
|
102
|
-
private interaction with the people involved, including unsolicited interaction
|
|
103
|
-
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
-
Violating these terms may lead to a permanent ban.
|
|
105
|
-
|
|
106
|
-
### 4. Permanent Ban
|
|
107
|
-
|
|
108
|
-
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
-
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
-
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
-
|
|
112
|
-
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
-
community.
|
|
114
|
-
|
|
115
|
-
## Attribution
|
|
116
|
-
|
|
117
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
-
version 2.1, available at
|
|
119
|
-
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
-
|
|
121
|
-
Community Impact Guidelines were inspired by
|
|
122
|
-
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
-
|
|
124
|
-
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
-
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
-
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
-
|
|
128
|
-
[homepage]: https://www.contributor-covenant.org
|
|
129
|
-
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
-
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
-
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
-
[translations]: https://www.contributor-covenant.org/translations
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact us at ["david.uhlig@gmail.com"](mailto:"david.uhlig@gmail.com").
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
[Rocket Chat]: https://rocket.chat/
|
|
2
|
+
[OmniAuth]: https://github.com/omniauth/omniauth
|
|
3
|
+
[gem]: https://rubygems.org/gems/omniauth-rocketchat
|
|
4
|
+
[license]: LICENSE.md
|
|
5
|
+
[contributing]: CODE_OF_CONDUCT.md
|
|
6
|
+
|
|
7
|
+
# 🔓 OmniAuth Rocket Chat
|
|
2
8
|
|
|
3
9
|
[][gem]
|
|
4
10
|
[][license]
|
|
5
11
|
[][contributing]
|
|
6
12
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[
|
|
13
|
+
## 🚀 Authenticate with Rocket Chat in your Ruby applications
|
|
14
|
+
|
|
15
|
+
This unofficial [OmniAuth] strategy allows your application's users to authenticate with [Rocket Chat] as the identity provider (aka social login).
|
|
16
|
+
|
|
17
|
+
## Requirements
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
* Ruby `>= 3.2.0`.
|
|
20
|
+
* Rocket Chat `<= 7.4.0` (EOL) or `>= 8.0.0`. See [Compatibility](#compatibility) below.
|
|
21
|
+
|
|
22
|
+
### Compatibility
|
|
23
|
+
|
|
24
|
+
Rocket.Chat version 7.4.0 [introduced a bug](https://github.com/RocketChat/Rocket.Chat/issues/35419) that breaks third-party logins. A [partial fix](https://github.com/RocketChat/Rocket.Chat/pull/37707) is available starting in version 8.0.0, but PKCE flows remain affected. Until this is fully resolved, set `pkce: false` in the configurations below.
|
|
25
|
+
|
|
26
|
+
#### Compatibility Matrix
|
|
27
|
+
|
|
28
|
+
Excluding EOL versions:
|
|
29
|
+
|
|
30
|
+
| Rocket Chat Version | `pkce: false` | `pkce: true` |
|
|
31
|
+
|---------------------|--------------------|--------------|
|
|
32
|
+
| `>= 7.10.x` | :x: | :x: |
|
|
33
|
+
| `>= 8.0.x` | :white_check_mark: | :x: |
|
|
12
34
|
|
|
13
35
|
## Installation
|
|
14
36
|
|
|
@@ -20,80 +42,139 @@ gem 'omniauth-rocketchat'
|
|
|
20
42
|
|
|
21
43
|
Then execute `bundle install`.
|
|
22
44
|
|
|
23
|
-
##
|
|
45
|
+
## Configuration
|
|
46
|
+
|
|
47
|
+
> [!NOTE]
|
|
48
|
+
> Rocket Chat doesn't support `scopes`. Users grant you full permissions to their account. Handle responsibly!
|
|
24
49
|
|
|
25
|
-
|
|
50
|
+
### Rocket Chat
|
|
26
51
|
|
|
27
|
-
|
|
28
|
-
* Go to `Administration` -> `Third-party login`.
|
|
29
|
-
* Click on `New Application`.
|
|
30
|
-
* Check the `Active` checkbox.
|
|
31
|
-
* Fill in the `Application Name` and `Redirect URL`. The redirect URL for devise looks like `https://example.com/users/auth/rocketchat/callback`. You can add multiple hosts by separating them with a comma.
|
|
32
|
-
* Click on `Save`.
|
|
33
|
-
* Select the third-party login you just created.
|
|
34
|
-
* Copy the `Client ID` and `Client Secret`.
|
|
52
|
+
To enable third-party login, register your application in Rocket Chat to obtain the `Client ID` and `Client Secret`. Add your application's host(s) to whitelist callback redirects by following these steps:
|
|
35
53
|
|
|
36
|
-
|
|
54
|
+
1. Log in to your Rocket Chat instance as an administrator.
|
|
55
|
+
2. Navigate to Administration > Third-party login (e.g., https://example.com/admin/third-party-login).
|
|
56
|
+
3. Click New Application:
|
|
57
|
+
* Enable the Active checkbox.
|
|
58
|
+
* Enter an Application Name and Redirect URL (e.g., https://example.com/users/auth/rocketchat/callback for Devise).
|
|
59
|
+
* Click Save.
|
|
60
|
+
4. Select your new application and copy the `Client ID` and `Client Secret`.
|
|
37
61
|
|
|
38
|
-
|
|
62
|
+
### Ruby Integration
|
|
39
63
|
|
|
40
|
-
|
|
64
|
+
Choose one of the following methods to integrate the strategy with your Ruby application.
|
|
65
|
+
|
|
66
|
+
#### Required Options
|
|
41
67
|
|
|
42
68
|
```ruby
|
|
43
69
|
use OmniAuth::Builder do
|
|
44
|
-
provider
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
70
|
+
provider(
|
|
71
|
+
:rocketchat,
|
|
72
|
+
ENV["CLIENT_ID"],
|
|
73
|
+
ENV["CLIENT_SECRET"],
|
|
74
|
+
pkce: false,
|
|
75
|
+
client_options: {
|
|
76
|
+
site: "https://example.com"
|
|
77
|
+
}
|
|
78
|
+
)
|
|
50
79
|
end
|
|
51
80
|
```
|
|
52
81
|
|
|
53
|
-
|
|
82
|
+
#### Custom Endpoints
|
|
83
|
+
|
|
84
|
+
If you modified the endpoint URL's in Rocket Chat, set `authorize_url` and `token_url`.
|
|
85
|
+
|
|
54
86
|
```ruby
|
|
55
87
|
use OmniAuth::Builder do
|
|
56
|
-
provider
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
88
|
+
provider(
|
|
89
|
+
:rocketchat,
|
|
90
|
+
ENV["CLIENT_ID"],
|
|
91
|
+
ENV["CLIENT_SECRET"],
|
|
92
|
+
pkce: false,
|
|
93
|
+
client_options: {
|
|
94
|
+
site: "https://example.com",
|
|
95
|
+
authorize_url: "/custom/oauth/authorize",
|
|
96
|
+
token_url: "/custom/oauth/token"
|
|
97
|
+
}
|
|
98
|
+
)
|
|
64
99
|
end
|
|
65
100
|
```
|
|
66
101
|
|
|
67
|
-
|
|
102
|
+
#### Custom Identifier
|
|
103
|
+
|
|
104
|
+
Set the `name` option to distinguish between multiple Rocket Chat instances. It appears in the OmniAuth auth hash `request.env["omniauth.auth"]` under the `provider` key.
|
|
105
|
+
|
|
106
|
+
```ruby
|
|
107
|
+
use OmniAuth::Build do
|
|
108
|
+
provider(
|
|
109
|
+
:rocketchat,
|
|
110
|
+
ENV["CLIENT_ID"],
|
|
111
|
+
ENV["CLIENT_SECRET"],
|
|
112
|
+
name: :some_other_name,
|
|
113
|
+
pkce: false,
|
|
114
|
+
client_options: {
|
|
115
|
+
site: "https://example.com"
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
end
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Rails Integration
|
|
122
|
+
|
|
123
|
+
Choose one of the following methods to integrate the strategy with your Ruby on Rails application. The [Custom Endpoints](#custom-endpoints) and [Identifier](#custom-identifier) options apply here as well.
|
|
124
|
+
|
|
125
|
+
#### General
|
|
126
|
+
|
|
68
127
|
```ruby
|
|
69
128
|
# config/initializers/rocketchat.rb
|
|
70
129
|
Rails.application.config.middleware.use OmniAuth::Builder do
|
|
71
|
-
provider
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
130
|
+
provider(
|
|
131
|
+
:rocketchat,
|
|
132
|
+
ENV["CLIENT_ID"],
|
|
133
|
+
ENV["CLIENT_SECRET"],
|
|
134
|
+
pkce: false,
|
|
135
|
+
client_options: {
|
|
136
|
+
site: "https://example.com"
|
|
137
|
+
}
|
|
138
|
+
)
|
|
77
139
|
end
|
|
78
140
|
```
|
|
79
141
|
|
|
80
|
-
|
|
142
|
+
#### When using Devise
|
|
143
|
+
|
|
144
|
+
Use this integration if you use Devise with the `:omniauthable` module.
|
|
145
|
+
|
|
81
146
|
```ruby
|
|
82
147
|
# config/initializers/rocketchat.rb
|
|
83
148
|
Devise.setup do |config|
|
|
84
|
-
config.omniauth
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
149
|
+
config.omniauth(
|
|
150
|
+
:rocketchat,
|
|
151
|
+
ENV["CLIENT_ID"],
|
|
152
|
+
ENV["CLIENT_SECRET"],
|
|
153
|
+
pkce: false,
|
|
154
|
+
client_options: {
|
|
155
|
+
site: "https://example.com"
|
|
156
|
+
}
|
|
157
|
+
)
|
|
90
158
|
end
|
|
91
159
|
```
|
|
92
160
|
|
|
93
|
-
##
|
|
161
|
+
## Auth Hash Schema
|
|
162
|
+
|
|
163
|
+
### User Info
|
|
164
|
+
|
|
165
|
+
This strategy returns information about the authenticated user in the [Auth Hash Schema 1.0+](https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema). The following information is available in the `info` hash:
|
|
166
|
+
|
|
167
|
+
* `name`: The user's full name.
|
|
168
|
+
* `nickname`: The user's Rocket Chat username.
|
|
169
|
+
* `email`: The user's email address. The strategy prioritizes verified email addresses but will fall back to the first available one if no verified address is found.
|
|
170
|
+
* `email_verified`: A boolean indicating whether the email address has been verified on the Rocket Chat instance.
|
|
171
|
+
* `image`: The URL to the user's avatar.
|
|
172
|
+
|
|
173
|
+
You can find the complete profile information returned by Rocket Chat in `extra.raw_info`.
|
|
174
|
+
|
|
175
|
+
### Credentials
|
|
94
176
|
|
|
95
|
-
|
|
96
|
-
* `scope` has no effect on Rocket Chat. Users grant you full permissions to their account. Handle responsibly!
|
|
177
|
+
Rocket Chat also returns access and refresh tokens along with other information in the `credentials` hash.
|
|
97
178
|
|
|
98
179
|
## Versioning
|
|
99
180
|
|
|
@@ -107,5 +188,5 @@ Bug reports and pull requests are welcome on the [GitHub project page](https://g
|
|
|
107
188
|
|
|
108
189
|
## License
|
|
109
190
|
|
|
110
|
-
Copyright © 2024-
|
|
191
|
+
Copyright © 2024-2026 David Uhlig. See [LICENSE][] for details.
|
|
111
192
|
|
data/Rakefile
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "bundler/gem_tasks"
|
|
4
4
|
require "rspec/core/rake_task"
|
|
5
5
|
|
|
6
|
-
RSpec::Core::RakeTask.new
|
|
6
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
require "standard/rake"
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
require "rubocop/rake_task"
|
|
12
|
-
RuboCop::RakeTask.new
|
|
13
|
-
rescue LoadError
|
|
14
|
-
task :rubocop do
|
|
15
|
-
$stderr.puts "RuboCop is disabled"
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
task default: %i[spec rubocop]
|
|
10
|
+
task default: %i[spec standard]
|
data/UPGRADE.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# OmniAuth Rocket Chat Upgrade Guide
|
|
2
|
+
|
|
3
|
+
Follow this guide to upgrade your OmniAuth Rocket Chat Strategy to the next version
|
|
4
|
+
|
|
5
|
+
## Version 0.2.x
|
|
6
|
+
|
|
7
|
+
This version introduces breaking changes that may require your attention.
|
|
8
|
+
|
|
9
|
+
### Ruby version requirement
|
|
10
|
+
|
|
11
|
+
The minimum required Ruby version is now **3.2.0**. Support for older versions has been dropped.
|
|
12
|
+
|
|
13
|
+
### OmniAuth Auth Hash Schema 1.0+ compliance
|
|
14
|
+
|
|
15
|
+
The `info` hash has been refactored to follow the [Auth Hash Schema 1.0+](https://github.com/omniauth/omniauth/wiki/Auth-Hash-Schema).
|
|
16
|
+
|
|
17
|
+
* `nickname` replaces `username`.
|
|
18
|
+
* `image` (the avatar URL) replaces the nested `avatar` hash.
|
|
19
|
+
* `active` and `roles` have been removed.
|
|
20
|
+
|
|
21
|
+
If you still need access to `active` or `roles`, you can find them in `extra.raw_info`.
|
|
22
|
+
|
|
23
|
+
### Email handling
|
|
24
|
+
|
|
25
|
+
The strategy now always returns an `info.email` address, even if it hasn't been verified on the Rocket Chat instance.
|
|
26
|
+
|
|
27
|
+
* A new boolean field `info.email_verified` indicates the verification status.
|
|
28
|
+
* The strategy prioritizes verified email addresses but will fall back to the first available one.
|
|
29
|
+
|
|
30
|
+
### PKCE requirement
|
|
31
|
+
|
|
32
|
+
Rocket.Chat version 7.4.0 [introduced a bug](https://github.com/RocketChat/Rocket.Chat/issues/35419) that breaks third-party logins. A [partial fix](https://github.com/RocketChat/Rocket.Chat/pull/37707) is available starting in version 8.0.0, but PKCE flows remain affected.
|
|
33
|
+
|
|
34
|
+
Until this is fully resolved, you must set `pkce: false` in your configuration.
|
|
@@ -56,6 +56,9 @@ module OmniAuth
|
|
|
56
56
|
# }
|
|
57
57
|
# end
|
|
58
58
|
class RocketChat < OmniAuth::Strategies::OAuth2
|
|
59
|
+
# Returns profile information about the authenticated user.
|
|
60
|
+
# @see https://developer.rocket.chat/apidocs/get-profile-information
|
|
61
|
+
PROFILE_INFO_ENDPOINT = "/api/v1/me"
|
|
59
62
|
DEFAULT_AUTHORIZE_URL = "/oauth/authorize"
|
|
60
63
|
DEFAULT_TOKEN_URL = "/oauth/token"
|
|
61
64
|
|
|
@@ -71,46 +74,48 @@ module OmniAuth
|
|
|
71
74
|
option :pkce, true
|
|
72
75
|
|
|
73
76
|
uid do
|
|
74
|
-
|
|
77
|
+
profile["_id"]
|
|
75
78
|
end
|
|
76
79
|
|
|
77
|
-
#
|
|
80
|
+
# User info from the +/api/v1/me+ endpoint according to the OmniAuth Auth Hash.
|
|
78
81
|
#
|
|
79
|
-
#
|
|
80
|
-
#
|
|
81
|
-
# will never be confirmed.
|
|
82
|
+
# Note: If email confirmation is disabled on the Rocket Chat instance,
|
|
83
|
+
# the email will never be confirmed, i.e. `email_verified` will always be `false`.
|
|
82
84
|
#
|
|
83
85
|
# You may want to handle the +extra.raw_info.emails+ array in this case.
|
|
84
|
-
# It contains all email addresses associated with the user.
|
|
85
|
-
# unconfirmed.
|
|
86
|
+
# It contains all email addresses associated with the user. Verified and unverified.
|
|
86
87
|
info do
|
|
87
88
|
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
avatar: {
|
|
94
|
-
url: raw_info["avatar_url"],
|
|
95
|
-
e_tag: raw_info["avatar_e_tag"],
|
|
96
|
-
origin: raw_info["avatar_origin"]
|
|
97
|
-
}
|
|
89
|
+
name: profile["name"],
|
|
90
|
+
email: email["address"],
|
|
91
|
+
email_verified: email["verified"],
|
|
92
|
+
nickname: profile["username"],
|
|
93
|
+
image: profile["avatar_url"]
|
|
98
94
|
}
|
|
99
95
|
end
|
|
100
96
|
|
|
101
97
|
extra do
|
|
102
98
|
{
|
|
103
|
-
raw_info:
|
|
99
|
+
raw_info: profile
|
|
104
100
|
}
|
|
105
101
|
end
|
|
106
102
|
|
|
107
|
-
def raw_info
|
|
108
|
-
@raw_info ||= access_token.get("/api/v1/me").parsed
|
|
109
|
-
end
|
|
110
|
-
|
|
111
103
|
def callback_url
|
|
112
104
|
full_host + callback_path
|
|
113
105
|
end
|
|
106
|
+
|
|
107
|
+
private
|
|
108
|
+
|
|
109
|
+
def profile
|
|
110
|
+
@profile ||= access_token.get(PROFILE_INFO_ENDPOINT).parsed
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def email
|
|
114
|
+
@email ||=
|
|
115
|
+
profile["emails"].find { |email| email["verified"] } ||
|
|
116
|
+
profile["emails"].first ||
|
|
117
|
+
{"address" => nil, "verified" => false}
|
|
118
|
+
end
|
|
114
119
|
end
|
|
115
120
|
end
|
|
116
121
|
end
|
metadata
CHANGED
|
@@ -1,42 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omniauth-rocketchat
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Uhlig
|
|
8
|
-
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-03-08 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
|
-
- !ruby/object:Gem::Dependency
|
|
13
|
-
name: oauth2
|
|
14
|
-
requirement: !ruby/object:Gem::Requirement
|
|
15
|
-
requirements:
|
|
16
|
-
- - "~>"
|
|
17
|
-
- !ruby/object:Gem::Version
|
|
18
|
-
version: '2.0'
|
|
19
|
-
type: :runtime
|
|
20
|
-
prerelease: false
|
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
-
requirements:
|
|
23
|
-
- - "~>"
|
|
24
|
-
- !ruby/object:Gem::Version
|
|
25
|
-
version: '2.0'
|
|
26
|
-
- !ruby/object:Gem::Dependency
|
|
27
|
-
name: omniauth
|
|
28
|
-
requirement: !ruby/object:Gem::Requirement
|
|
29
|
-
requirements:
|
|
30
|
-
- - "~>"
|
|
31
|
-
- !ruby/object:Gem::Version
|
|
32
|
-
version: '2.0'
|
|
33
|
-
type: :runtime
|
|
34
|
-
prerelease: false
|
|
35
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
-
requirements:
|
|
37
|
-
- - "~>"
|
|
38
|
-
- !ruby/object:Gem::Version
|
|
39
|
-
version: '2.0'
|
|
40
13
|
- !ruby/object:Gem::Dependency
|
|
41
14
|
name: omniauth-oauth2
|
|
42
15
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,127 +25,103 @@ dependencies:
|
|
|
52
25
|
- !ruby/object:Gem::Version
|
|
53
26
|
version: '1.8'
|
|
54
27
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name:
|
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - "~>"
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '13.0'
|
|
61
|
-
type: :development
|
|
62
|
-
prerelease: false
|
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - "~>"
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '13.0'
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: rubocop
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - "~>"
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '1.70'
|
|
75
|
-
type: :development
|
|
76
|
-
prerelease: false
|
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - "~>"
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '1.70'
|
|
82
|
-
- !ruby/object:Gem::Dependency
|
|
83
|
-
name: rubocop-performance
|
|
28
|
+
name: irb
|
|
84
29
|
requirement: !ruby/object:Gem::Requirement
|
|
85
30
|
requirements:
|
|
86
|
-
- - "
|
|
31
|
+
- - ">="
|
|
87
32
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '
|
|
33
|
+
version: '0'
|
|
89
34
|
type: :development
|
|
90
35
|
prerelease: false
|
|
91
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
37
|
requirements:
|
|
93
|
-
- - "
|
|
38
|
+
- - ">="
|
|
94
39
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: '
|
|
40
|
+
version: '0'
|
|
96
41
|
- !ruby/object:Gem::Dependency
|
|
97
|
-
name:
|
|
42
|
+
name: rake
|
|
98
43
|
requirement: !ruby/object:Gem::Requirement
|
|
99
44
|
requirements:
|
|
100
45
|
- - "~>"
|
|
101
46
|
- !ruby/object:Gem::Version
|
|
102
|
-
version: '
|
|
47
|
+
version: '13.0'
|
|
103
48
|
type: :development
|
|
104
49
|
prerelease: false
|
|
105
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
51
|
requirements:
|
|
107
52
|
- - "~>"
|
|
108
53
|
- !ruby/object:Gem::Version
|
|
109
|
-
version: '
|
|
54
|
+
version: '13.0'
|
|
110
55
|
- !ruby/object:Gem::Dependency
|
|
111
|
-
name:
|
|
56
|
+
name: rspec
|
|
112
57
|
requirement: !ruby/object:Gem::Requirement
|
|
113
58
|
requirements:
|
|
114
59
|
- - "~>"
|
|
115
60
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: '
|
|
61
|
+
version: '3.2'
|
|
117
62
|
type: :development
|
|
118
63
|
prerelease: false
|
|
119
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
65
|
requirements:
|
|
121
66
|
- - "~>"
|
|
122
67
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: '
|
|
68
|
+
version: '3.2'
|
|
124
69
|
- !ruby/object:Gem::Dependency
|
|
125
|
-
name:
|
|
70
|
+
name: standard
|
|
126
71
|
requirement: !ruby/object:Gem::Requirement
|
|
127
72
|
requirements:
|
|
128
73
|
- - "~>"
|
|
129
74
|
- !ruby/object:Gem::Version
|
|
130
|
-
version: '3
|
|
75
|
+
version: '1.3'
|
|
131
76
|
type: :development
|
|
132
77
|
prerelease: false
|
|
133
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
134
79
|
requirements:
|
|
135
80
|
- - "~>"
|
|
136
81
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: '3
|
|
82
|
+
version: '1.3'
|
|
138
83
|
- !ruby/object:Gem::Dependency
|
|
139
84
|
name: simplecov
|
|
140
85
|
requirement: !ruby/object:Gem::Requirement
|
|
141
86
|
requirements:
|
|
142
|
-
- - "
|
|
87
|
+
- - ">="
|
|
143
88
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: '0
|
|
89
|
+
version: '0'
|
|
145
90
|
type: :development
|
|
146
91
|
prerelease: false
|
|
147
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
148
93
|
requirements:
|
|
149
|
-
- - "
|
|
94
|
+
- - ">="
|
|
150
95
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: '0
|
|
152
|
-
description: Allows your application to integrate with Rocket Chat through their
|
|
153
|
-
login" feature.
|
|
154
|
-
|
|
96
|
+
version: '0'
|
|
97
|
+
description: 'Allows your application to integrate with Rocket Chat through their
|
|
98
|
+
"Third-party login" feature.
|
|
99
|
+
|
|
100
|
+
'
|
|
101
|
+
email:
|
|
102
|
+
- david.uhlig@gmail.com
|
|
155
103
|
executables: []
|
|
156
104
|
extensions: []
|
|
157
105
|
extra_rdoc_files: []
|
|
158
106
|
files:
|
|
159
|
-
- ".gitignore"
|
|
160
107
|
- ".rubocop.yml"
|
|
108
|
+
- CHANGELOG.md
|
|
161
109
|
- CODE_OF_CONDUCT.md
|
|
162
|
-
- Gemfile
|
|
163
110
|
- LICENSE.md
|
|
164
111
|
- README.md
|
|
165
112
|
- Rakefile
|
|
113
|
+
- UPGRADE.md
|
|
166
114
|
- lib/omniauth-rocketchat.rb
|
|
167
115
|
- lib/omniauth-rocketchat/version.rb
|
|
168
116
|
- lib/omniauth/strategies/rocketchat.rb
|
|
169
|
-
- omniauth-rocketchat.gemspec
|
|
170
117
|
homepage: https://github.com/david-uhlig/omniauth-rocketchat
|
|
171
118
|
licenses:
|
|
172
119
|
- MIT
|
|
173
120
|
metadata:
|
|
174
121
|
homepage_uri: https://github.com/david-uhlig/omniauth-rocketchat
|
|
175
122
|
source_code_uri: https://github.com/david-uhlig/omniauth-rocketchat
|
|
123
|
+
changelog_uri: https://github.com/david-uhlig/omniauth-rocketchat/blob/main/CHANGELOG.md
|
|
124
|
+
post_install_message:
|
|
176
125
|
rdoc_options: []
|
|
177
126
|
require_paths:
|
|
178
127
|
- lib
|
|
@@ -180,14 +129,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
180
129
|
requirements:
|
|
181
130
|
- - ">="
|
|
182
131
|
- !ruby/object:Gem::Version
|
|
183
|
-
version:
|
|
132
|
+
version: 3.2.0
|
|
184
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
134
|
requirements:
|
|
186
135
|
- - ">="
|
|
187
136
|
- !ruby/object:Gem::Version
|
|
188
|
-
version:
|
|
137
|
+
version: '0'
|
|
189
138
|
requirements: []
|
|
190
|
-
rubygems_version: 3.
|
|
139
|
+
rubygems_version: 3.4.19
|
|
140
|
+
signing_key:
|
|
191
141
|
specification_version: 4
|
|
192
142
|
summary: An unofficial Rocket Chat OAuth2 strategy.
|
|
193
143
|
test_files: []
|
data/.gitignore
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
/.config
|
|
4
|
-
/coverage/
|
|
5
|
-
/InstalledFiles
|
|
6
|
-
/pkg/
|
|
7
|
-
/spec/reports/
|
|
8
|
-
/spec/examples.txt
|
|
9
|
-
/test/tmp/
|
|
10
|
-
/test/version_tmp/
|
|
11
|
-
/tmp/
|
|
12
|
-
|
|
13
|
-
# Used by dotenv library to load environment variables.
|
|
14
|
-
# .env
|
|
15
|
-
|
|
16
|
-
# Ignore Byebug command history file.
|
|
17
|
-
.byebug_history
|
|
18
|
-
|
|
19
|
-
## Specific to RubyMotion:
|
|
20
|
-
.dat*
|
|
21
|
-
.repl_history
|
|
22
|
-
build/
|
|
23
|
-
*.bridgesupport
|
|
24
|
-
build-iPhoneOS/
|
|
25
|
-
build-iPhoneSimulator/
|
|
26
|
-
|
|
27
|
-
## Specific to RubyMotion (use of CocoaPods):
|
|
28
|
-
#
|
|
29
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
|
30
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
|
31
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
32
|
-
#
|
|
33
|
-
# vendor/Pods/
|
|
34
|
-
|
|
35
|
-
## Documentation cache and generated files:
|
|
36
|
-
/.yardoc/
|
|
37
|
-
/_yardoc/
|
|
38
|
-
/doc/
|
|
39
|
-
/rdoc/
|
|
40
|
-
|
|
41
|
-
## Environment normalization:
|
|
42
|
-
/.bundle/
|
|
43
|
-
/vendor/bundle
|
|
44
|
-
/lib/bundler/man/
|
|
45
|
-
|
|
46
|
-
# for a library or gem, you might want to ignore these files since the code is
|
|
47
|
-
# intended to run in multiple environments; otherwise, check them in:
|
|
48
|
-
Gemfile.lock
|
|
49
|
-
.ruby-version
|
|
50
|
-
.ruby-gemset
|
|
51
|
-
|
|
52
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
53
|
-
.rvmrc
|
|
54
|
-
|
|
55
|
-
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
|
56
|
-
.rubocop-https?--*
|
data/Gemfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
source "https://rubygems.org"
|
|
2
|
-
|
|
3
|
-
ruby "3.3.6", platforms: [ :ruby, :x86_64_linux ]
|
|
4
|
-
|
|
5
|
-
gem "rake", "~> 13.0"
|
|
6
|
-
|
|
7
|
-
group :test do
|
|
8
|
-
gem "addressable", "~> 2.3.8", platforms: %i[jruby ruby_18]
|
|
9
|
-
gem "coveralls_reborn", "~> 0.28.0", require: false
|
|
10
|
-
gem "json", platforms: %i[jruby ruby_18 ruby_19]
|
|
11
|
-
gem "mime-types", "~> 3.6", platforms: %i[jruby ruby_18]
|
|
12
|
-
gem "rack-test"
|
|
13
|
-
gem "rest-client", "~> 2.1.0", platforms: %i[jruby ruby_18]
|
|
14
|
-
gem "rspec", "~> 3.8"
|
|
15
|
-
gem "rubocop", "~> 1.70", platforms: %i[ruby_19 ruby_20 ruby_21 ruby_22 ruby_23 ruby_24]
|
|
16
|
-
gem "simplecov-lcov"
|
|
17
|
-
gem "tins", "~> 1.13", platforms: %i[jruby_18 jruby_19 ruby_19]
|
|
18
|
-
gem "webmock", "~> 3.0"
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Specify your gem's dependencies in omniauth-oauth2.gemspec
|
|
22
|
-
gemspec
|
data/omniauth-rocketchat.gemspec
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require File.expand_path(
|
|
4
|
-
File.join("..", "lib", "omniauth-rocketchat", "version"),
|
|
5
|
-
__FILE__
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
Gem::Specification.new do |gem|
|
|
9
|
-
gem.name = "omniauth-rocketchat"
|
|
10
|
-
gem.version = OmniAuth::RocketChat::VERSION
|
|
11
|
-
gem.license = "MIT"
|
|
12
|
-
gem.summary = "An unofficial Rocket Chat OAuth2 strategy."
|
|
13
|
-
gem.description = 'Allows your application to integrate with Rocket Chat through their "Third-party login" feature.'
|
|
14
|
-
|
|
15
|
-
gem.authors = [ "David Uhlig" ]
|
|
16
|
-
gem.email = "david.uhlig@gmail.com"
|
|
17
|
-
gem.homepage = "https://github.com/david-uhlig/omniauth-rocketchat"
|
|
18
|
-
|
|
19
|
-
gem.metadata = {
|
|
20
|
-
"homepage_uri" => gem.homepage,
|
|
21
|
-
"source_code_uri" => gem.homepage
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
gem.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?('spec/') }
|
|
25
|
-
gem.require_paths = %w[lib]
|
|
26
|
-
|
|
27
|
-
gem.required_rubygems_version = '>= 1.3.5'
|
|
28
|
-
gem.required_ruby_version = '>= 2.2'
|
|
29
|
-
|
|
30
|
-
gem.add_runtime_dependency 'oauth2', '~> 2.0'
|
|
31
|
-
gem.add_runtime_dependency 'omniauth', '~> 2.0'
|
|
32
|
-
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.8'
|
|
33
|
-
|
|
34
|
-
gem.add_development_dependency "rake", "~> 13.0"
|
|
35
|
-
gem.add_development_dependency "rubocop", "~> 1.70"
|
|
36
|
-
gem.add_development_dependency "rubocop-performance", "~> 1.23"
|
|
37
|
-
gem.add_development_dependency "rubocop-rspec", "~> 2.0"
|
|
38
|
-
gem.add_development_dependency "rubocop-rails-omakase", "~> 1.0"
|
|
39
|
-
gem.add_development_dependency "rspec", "~> 3.8"
|
|
40
|
-
gem.add_development_dependency "simplecov", "~> 0.16"
|
|
41
|
-
|
|
42
|
-
gem.platform = Gem::Platform::RUBY
|
|
43
|
-
end
|