omniauth-rocketchat 0.1.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 +7 -0
- data/.gitignore +56 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Gemfile +22 -0
- data/LICENSE.md +21 -0
- data/README.md +113 -0
- data/Rakefile +19 -0
- data/lib/omniauth/strategies/rocketchat.rb +118 -0
- data/lib/omniauth-rocketchat/version.rb +7 -0
- data/lib/omniauth-rocketchat.rb +2 -0
- data/omniauth-rocketchat.gemspec +35 -0
- metadata +148 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1827878bd6e88a63fadfaa1b36fcd62550f9ee9c221653d0469ea237386f3248
|
4
|
+
data.tar.gz: 6cf23328f4a63a3c3e2b29f760bd082b760c73941e6ca61d8740f4a4c44c4b14
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89676650f152c36303fac489b7a703d8e809dd1b7a9af7ad35fb26f9ccd01e2009fe56e2accc6cfbcc3b5eafcbc3050abe04548a9adb52725854faec71480f54
|
7
|
+
data.tar.gz: 77139d47dc7ee8635ccad71f9a151d14ffe968f9aab4da2f3e1e20ff661843a513a17bb7a978cfd188f7dbf482bd6f4071f89b4ddafd74b35f20843916c30979
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
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/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
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
|
data/Gemfile
ADDED
@@ -0,0 +1,22 @@
|
|
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.19.0', require: false
|
10
|
+
gem "json", :platforms => %i[jruby ruby_18 ruby_19]
|
11
|
+
gem "mime-types", "~> 1.25", :platforms => %i[jruby ruby_18]
|
12
|
+
gem "rack-test"
|
13
|
+
gem "rest-client", "~> 1.8.0", :platforms => %i[jruby ruby_18]
|
14
|
+
gem "rspec", "~> 3.8"
|
15
|
+
gem "rubocop", ">= 0.51", :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/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 David Uhlig
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# OmniAuth Rocket Chat OAuth2 Strategy
|
2
|
+
|
3
|
+
[][gem]
|
4
|
+
[][license]
|
5
|
+
[][contributing]
|
6
|
+
|
7
|
+
[gem]: https://rubygems.org/gems/omniauth-rocketchat
|
8
|
+
[license]: LICENSE
|
9
|
+
[contributing]: CODE_OF_CONDUCT.md
|
10
|
+
|
11
|
+
Unofficial OmniAuth strategy to authenticate with [Rocket Chat](https://rocket.chat/) through OAuth2 in [OmniAuth](https://github.com/omniauth/omniauth).
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application's Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'omniauth-rocket-chat'
|
19
|
+
```
|
20
|
+
|
21
|
+
Then execute `bundle install`.
|
22
|
+
|
23
|
+
## Rocket Chat Setup
|
24
|
+
|
25
|
+
You need to register your application with your Rocket Chat instance to obtain the `Client ID` and `Client Secret`. You will also need to add this applications host(s). This whitelists your application for the callback redirect. You can do this by following the steps below:
|
26
|
+
|
27
|
+
* Go to your Rocket Chat instance and login as an administrator.
|
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/rocket_chat/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`.
|
35
|
+
|
36
|
+
## Integration
|
37
|
+
|
38
|
+
Pick one of the following methods to integrate the strategy with your application.
|
39
|
+
|
40
|
+
### Basic Usage
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
use OmniAuth::Builder do
|
44
|
+
provider :rocketchat,
|
45
|
+
ENV["ROCKETCHAT_CLIENT_ID"],
|
46
|
+
ENV["ROCKETCHAT_CLIENT_SECRET"],
|
47
|
+
client_options: {
|
48
|
+
site: "https://example.com"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
53
|
+
### With Custom Endpoints
|
54
|
+
```ruby
|
55
|
+
use OmniAuth::Builder do
|
56
|
+
provider :rocketchat,
|
57
|
+
ENV["ROCKETCHAT_CLIENT_ID"],
|
58
|
+
ENV["ROCKETCHAT_CLIENT_SECRET"],
|
59
|
+
client_options: {
|
60
|
+
site: "https://example.com",
|
61
|
+
authorize_url: "/custom/oauth/authorize",
|
62
|
+
token_url: "/custom/oauth/token"
|
63
|
+
}
|
64
|
+
end
|
65
|
+
```
|
66
|
+
|
67
|
+
### In Rails
|
68
|
+
```ruby
|
69
|
+
# config/initializers/rocketchat.rb
|
70
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
71
|
+
provider :rocketchat,
|
72
|
+
ENV["ROCKETCHAT_CLIENT_ID"],
|
73
|
+
ENV["ROCKETCHAT_CLIENT_SECRET"],
|
74
|
+
client_options: {
|
75
|
+
site: "https://example.com"
|
76
|
+
}
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
### With Devise
|
81
|
+
```ruby
|
82
|
+
# config/initializers/rocketchat.rb
|
83
|
+
Devise.setup do |config|
|
84
|
+
config.omniauth :rocketchat,
|
85
|
+
ENV["ROCKETCHAT_CLIENT_ID"],
|
86
|
+
ENV["ROCKETCHAT_CLIENT_SECRET"],
|
87
|
+
client_options: {
|
88
|
+
site: "https://example.com"
|
89
|
+
}
|
90
|
+
end
|
91
|
+
```
|
92
|
+
|
93
|
+
## Configuration
|
94
|
+
|
95
|
+
* The `client_options` options: `authorize_url` and `token_url` are optional and default to `/oauth/authorize` and `/oauth/token` respectively.
|
96
|
+
* `scope` has no effect on Rocket Chat. Users grant you full permissions to their account. Handle responsibly!
|
97
|
+
|
98
|
+
## Versioning
|
99
|
+
|
100
|
+
This library aims to adhere to [Semantic Versioning 2.0.0](http://semver.org/). Violations of this scheme should be reported as bugs.
|
101
|
+
|
102
|
+
## Contributing
|
103
|
+
|
104
|
+
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
105
|
+
|
106
|
+
Bug reports and pull requests are welcome on the [GitHub project page](https://github.com/david-uhlig/omniauth-rocketchat).
|
107
|
+
|
108
|
+
## License
|
109
|
+
|
110
|
+
Copyright © 2024 David Uhlig. See [LICENSE][] for details.
|
111
|
+
|
112
|
+
[license]: LICENSE
|
113
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
|
6
|
+
RSpec::Core::RakeTask.new
|
7
|
+
|
8
|
+
task :test => :spec
|
9
|
+
|
10
|
+
begin
|
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]
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require "omniauth-oauth2"
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
# Authorization strategy for Rocket Chat using OAuth2.
|
6
|
+
#
|
7
|
+
# Allows your custom application to integrate with Rocket Chat through their
|
8
|
+
# "Third-party login" feature. See: https://docs.rocket.chat/docs/third-party-login
|
9
|
+
# for more information.
|
10
|
+
#
|
11
|
+
# To use it, you'll need to register your application with your Rocket Chat
|
12
|
+
# instance and get a client ID and secret on the admin page, e.g.
|
13
|
+
# https://example.com/admin/third-party-login
|
14
|
+
#
|
15
|
+
# @example Basic Usage
|
16
|
+
# use OmniAuth::Builder do
|
17
|
+
# provider :rocketchat,
|
18
|
+
# ENV["ROCKETCHAT_CLIENT_ID"],
|
19
|
+
# ENV["ROCKETCHAT_CLIENT_SECRET"],
|
20
|
+
# client_options: {
|
21
|
+
# site: "https://example.com"
|
22
|
+
# }
|
23
|
+
# end
|
24
|
+
#
|
25
|
+
# @example Basic Usage with Custom Endpoints
|
26
|
+
# use OmniAuth::Builder do
|
27
|
+
# provider :rocketchat,
|
28
|
+
# ENV["ROCKETCHAT_CLIENT_ID"],
|
29
|
+
# ENV["ROCKETCHAT_CLIENT_SECRET"],
|
30
|
+
# client_options: {
|
31
|
+
# site: "https://example.com",
|
32
|
+
# authorize_url: "/custom/oauth/authorize",
|
33
|
+
# token_url: "/custom/oauth/token"
|
34
|
+
# }
|
35
|
+
# end
|
36
|
+
#
|
37
|
+
# @example Basic Usage with Rails
|
38
|
+
# # /config/initializers/rocketchat.rb
|
39
|
+
# Rails.application.config.middleware.use OmniAuth::Builder do
|
40
|
+
# provider :rocketchat,
|
41
|
+
# ENV["ROCKETCHAT_CLIENT_ID"],
|
42
|
+
# ENV["ROCKETCHAT_CLIENT_SECRET"],
|
43
|
+
# client_options: {
|
44
|
+
# site: "https://example.com"
|
45
|
+
# }
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# @example Basic Usage with Devise
|
49
|
+
# # /config/initializers/devise.rb
|
50
|
+
# Devise.setup do |config|
|
51
|
+
# config.omniauth :rocketchat,
|
52
|
+
# ENV["ROCKETCHAT_CLIENT_ID"],
|
53
|
+
# ENV["ROCKETCHAT_CLIENT_SECRET"],
|
54
|
+
# client_options: {
|
55
|
+
# site: "https://example.com"
|
56
|
+
# }
|
57
|
+
# end
|
58
|
+
class RocketChat < OmniAuth::Strategies::OAuth2
|
59
|
+
DEFAULT_AUTHORIZE_URL = "/oauth/authorize"
|
60
|
+
DEFAULT_TOKEN_URL = "/oauth/token"
|
61
|
+
|
62
|
+
option :name, "rocketchat"
|
63
|
+
|
64
|
+
option :client_options, {
|
65
|
+
authorize_url: DEFAULT_AUTHORIZE_URL,
|
66
|
+
token_url: DEFAULT_TOKEN_URL
|
67
|
+
}
|
68
|
+
|
69
|
+
# You may specify that your strategy should use PKCE by setting
|
70
|
+
# the pkce option to true: https://tools.ietf.org/html/rfc7636
|
71
|
+
option :pkce, true
|
72
|
+
|
73
|
+
uid do
|
74
|
+
raw_info["_id"]
|
75
|
+
end
|
76
|
+
|
77
|
+
# Most commonly used info from the +/api/v1/me+ endpoint.
|
78
|
+
#
|
79
|
+
# +info.email+ returns +nil+ if the user has no confirmed email address.
|
80
|
+
# If email confirmation is disabled on the Rocket Chat instance, the email
|
81
|
+
# will never be confirmed.
|
82
|
+
#
|
83
|
+
# You may want to handle the +extra.raw_info.emails+ array in this case.
|
84
|
+
# It contains all email addresses associated with the user. Confirmed and
|
85
|
+
# unconfirmed.
|
86
|
+
info do
|
87
|
+
{
|
88
|
+
email: raw_info["email"],
|
89
|
+
active: raw_info["active"],
|
90
|
+
roles: raw_info["roles"],
|
91
|
+
name: raw_info["name"],
|
92
|
+
username: raw_info["username"],
|
93
|
+
avatar: {
|
94
|
+
url: raw_info["avatar_url"],
|
95
|
+
e_tag: raw_info["avatar_e_tag"],
|
96
|
+
origin: raw_info["avatar_origin"]
|
97
|
+
}
|
98
|
+
}
|
99
|
+
end
|
100
|
+
|
101
|
+
extra do
|
102
|
+
{
|
103
|
+
raw_info: raw_info
|
104
|
+
}
|
105
|
+
end
|
106
|
+
|
107
|
+
def raw_info
|
108
|
+
@raw_info ||= access_token.get("/api/v1/me").parsed
|
109
|
+
end
|
110
|
+
|
111
|
+
def callback_url
|
112
|
+
full_host + callback_path
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
OmniAuth.config.add_camelization "rocketchat", "RocketChat"
|
@@ -0,0 +1,35 @@
|
|
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.files = `git ls-files -z`.split("\x0").reject { |f| f.start_with?('spec/') }
|
20
|
+
gem.require_paths = %w[lib]
|
21
|
+
|
22
|
+
gem.required_rubygems_version = '>= 1.3.5'
|
23
|
+
gem.required_ruby_version = '>= 2.2'
|
24
|
+
|
25
|
+
gem.add_runtime_dependency 'oauth2', '~> 2.0'
|
26
|
+
gem.add_runtime_dependency 'omniauth', '~> 2.0'
|
27
|
+
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.8'
|
28
|
+
|
29
|
+
gem.add_development_dependency "rake", "~> 13.0"
|
30
|
+
gem.add_development_dependency "rubocop", "~> 1.0"
|
31
|
+
gem.add_development_dependency "rspec", "~> 3.8"
|
32
|
+
gem.add_development_dependency "simplecov", "~> 0.16"
|
33
|
+
|
34
|
+
gem.platform = Gem::Platform::RUBY
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-rocketchat
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Uhlig
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 2024-12-21 00:00:00.000000000 Z
|
11
|
+
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
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: omniauth-oauth2
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '1.8'
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.8'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rake
|
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.0'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '1.0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rspec
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '3.8'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '3.8'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: simplecov
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.16'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.16'
|
110
|
+
description: Allows your application to integrate with Rocket Chat through their "Third-party
|
111
|
+
login" feature.
|
112
|
+
email: david.uhlig@gmail.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- ".gitignore"
|
118
|
+
- CODE_OF_CONDUCT.md
|
119
|
+
- Gemfile
|
120
|
+
- LICENSE.md
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- lib/omniauth-rocketchat.rb
|
124
|
+
- lib/omniauth-rocketchat/version.rb
|
125
|
+
- lib/omniauth/strategies/rocketchat.rb
|
126
|
+
- omniauth-rocketchat.gemspec
|
127
|
+
homepage: https://github.com/david-uhlig/omniauth-rocketchat
|
128
|
+
licenses:
|
129
|
+
- MIT
|
130
|
+
metadata: {}
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.2'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 1.3.5
|
144
|
+
requirements: []
|
145
|
+
rubygems_version: 3.6.1
|
146
|
+
specification_version: 4
|
147
|
+
summary: An unofficial Rocket Chat OAuth2 strategy.
|
148
|
+
test_files: []
|