omniauth-rivo-oauth2 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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 657fadfbe88a388c8030a63970c33468453e5aca3717fab0ccaca3f00e8e2dbc
4
+ data.tar.gz: b7d1868b20624ab6b57fbcf42f59f7c3d3b7ea18b2d017d3c00a5d1728942be9
5
+ SHA512:
6
+ metadata.gz: 8b12bd0ba42c4d559e28117950032699f3c58f89a0c53c15f194e7ea69afcdec9eefa3ee003c3aee862226e48f7ef0bb0f6b4a8a60e6f7c7ed4dc983081461be
7
+ data.tar.gz: d73a81290eab888ea2f2b4c5f990fc376f64d6dbfc111f1b59e8f8cc4be2fc7f546b8f57a40808d350a3f872a5ea460e434713cc705187c232011899c6490d75
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.standard.yml ADDED
@@ -0,0 +1,3 @@
1
+ # For available configuration options, see:
2
+ # https://github.com/testdouble/standard
3
+ ruby_version: 2.7
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ - Initial release
@@ -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 e-mail 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
+ [INSERT CONTACT METHOD].
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,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in omniauth-rivo-oauth2.gemspec
4
+ gemspec
5
+
6
+ gem "rake"
7
+ gem "rspec"
8
+ gem "standard"
9
+
10
+ gem "rack-test"
11
+ gem "rack-proxy"
12
+ gem "webmock"
13
+
14
+ gem "addressable"
data/Gemfile.lock ADDED
@@ -0,0 +1,112 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-rivo-oauth2 (0.1.0)
5
+ oauth2 (>= 2)
6
+ omniauth-oauth2 (~> 1.7)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.8.1)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ ast (2.4.2)
14
+ crack (0.4.5)
15
+ rexml
16
+ diff-lcs (1.5.0)
17
+ faraday (2.6.0)
18
+ faraday-net_http (>= 2.0, < 3.1)
19
+ ruby2_keywords (>= 0.0.4)
20
+ faraday-net_http (3.0.0)
21
+ hashdiff (1.0.1)
22
+ hashie (5.0.0)
23
+ json (2.6.2)
24
+ jwt (2.5.0)
25
+ multi_xml (0.6.0)
26
+ oauth2 (2.0.9)
27
+ faraday (>= 0.17.3, < 3.0)
28
+ jwt (>= 1.0, < 3.0)
29
+ multi_xml (~> 0.5)
30
+ rack (>= 1.2, < 4)
31
+ snaky_hash (~> 2.0)
32
+ version_gem (~> 1.1)
33
+ omniauth (2.1.0)
34
+ hashie (>= 3.4.6)
35
+ rack (>= 2.2.3)
36
+ rack-protection
37
+ omniauth-oauth2 (1.8.0)
38
+ oauth2 (>= 1.4, < 3)
39
+ omniauth (~> 2.0)
40
+ parallel (1.22.1)
41
+ parser (3.1.2.1)
42
+ ast (~> 2.4.1)
43
+ public_suffix (5.0.0)
44
+ rack (3.0.0)
45
+ rack-protection (3.0.2)
46
+ rack
47
+ rack-proxy (0.7.4)
48
+ rack
49
+ rack-test (2.0.2)
50
+ rack (>= 1.3)
51
+ rainbow (3.1.1)
52
+ rake (13.0.6)
53
+ regexp_parser (2.6.0)
54
+ rexml (3.2.5)
55
+ rspec (3.11.0)
56
+ rspec-core (~> 3.11.0)
57
+ rspec-expectations (~> 3.11.0)
58
+ rspec-mocks (~> 3.11.0)
59
+ rspec-core (3.11.0)
60
+ rspec-support (~> 3.11.0)
61
+ rspec-expectations (3.11.1)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.11.0)
64
+ rspec-mocks (3.11.1)
65
+ diff-lcs (>= 1.2.0, < 2.0)
66
+ rspec-support (~> 3.11.0)
67
+ rspec-support (3.11.1)
68
+ rubocop (1.35.1)
69
+ json (~> 2.3)
70
+ parallel (~> 1.10)
71
+ parser (>= 3.1.2.1)
72
+ rainbow (>= 2.2.2, < 4.0)
73
+ regexp_parser (>= 1.8, < 3.0)
74
+ rexml (>= 3.2.5, < 4.0)
75
+ rubocop-ast (>= 1.20.1, < 2.0)
76
+ ruby-progressbar (~> 1.7)
77
+ unicode-display_width (>= 1.4.0, < 3.0)
78
+ rubocop-ast (1.21.0)
79
+ parser (>= 3.1.1.0)
80
+ rubocop-performance (1.14.3)
81
+ rubocop (>= 1.7.0, < 2.0)
82
+ rubocop-ast (>= 0.4.0)
83
+ ruby-progressbar (1.11.0)
84
+ ruby2_keywords (0.0.5)
85
+ snaky_hash (2.0.1)
86
+ hashie
87
+ version_gem (~> 1.1, >= 1.1.1)
88
+ standard (1.16.1)
89
+ rubocop (= 1.35.1)
90
+ rubocop-performance (= 1.14.3)
91
+ unicode-display_width (2.3.0)
92
+ version_gem (1.1.1)
93
+ webmock (3.18.1)
94
+ addressable (>= 2.8.0)
95
+ crack (>= 0.3.2)
96
+ hashdiff (>= 0.4.0, < 2.0.0)
97
+
98
+ PLATFORMS
99
+ x86_64-linux
100
+
101
+ DEPENDENCIES
102
+ addressable
103
+ omniauth-rivo-oauth2!
104
+ rack-proxy
105
+ rack-test
106
+ rake
107
+ rspec
108
+ standard
109
+ webmock
110
+
111
+ BUNDLED WITH
112
+ 2.3.22
data/LICENSE.md ADDED
@@ -0,0 +1,18 @@
1
+ Copyright © 2022 Rivo Commerce
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # OmniAuth Rivo OAuth 2 Strategy
2
+
3
+ [OmniAuth](https://github.com/omniauth/omniauth) strategy for
4
+ [Rivo](https://www.rivo.io/) OAuth 2 API.
5
+
6
+ ## Installation
7
+
8
+ Install the gem and add to the application's Gemfile by executing:
9
+
10
+ ```console
11
+ bundle add omniauth-rivo-oauth2
12
+ ```
13
+
14
+ If Bundler is not being used to manage dependencies, install the gem by
15
+ executing:
16
+
17
+ ```console
18
+ gem install omniauth-rivo-oauth2
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ Please read the [OmniAuth documentation](https://github.com/omniauth/omniauth)
24
+ for detailed instructions on adding a provider.
25
+
26
+ ### Rails example
27
+
28
+ ```ruby
29
+ # config/initializers/omniauth.rb
30
+
31
+ Rails.application.config.middleware.use OmniAuth::Builder do
32
+ provider :rivo_oauth2, ENV["RIVO_CLIENT_ID"], ENV["RIVO_CLIENT_SECRET"]
33
+ end
34
+ ```
35
+
36
+ ## Development
37
+
38
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run
39
+ `rake spec` to run the tests. You can also run `bin/console` for an interactive
40
+ prompt that will allow you to experiment.
41
+
42
+ To install this gem onto your local machine, run `bundle exec rake install`. To
43
+ release a new version, update the version number in `version.rb`, and then run
44
+ `bundle exec rake release`, which will create a Git tag for the version, push
45
+ Git commits and the created tag, and push the `.gem` file to
46
+ [rubygems.org](https://rubygems.org).
47
+
48
+ ## Contributing
49
+
50
+ Bug reports and pull requests are welcome on GitHub at
51
+ <https://github.com/Rivo-Commerce/omniauth-rivo-oauth2>. This project is
52
+ intended to be a safe, welcoming space for collaboration, and contributors are
53
+ expected to adhere to the [code of conduct](CODE_OF_CONDUCT.md).
54
+
55
+ ## License
56
+
57
+ The gem is available as open source under the terms of the
58
+ [MIT License](https://opensource.org/licenses/MIT).
59
+
60
+ ## Code of Conduct
61
+
62
+ Everyone interacting in the `omniauth-rivo-oauth2` project's codebases, issue
63
+ trackers, chat rooms and mailing lists is expected to follow the
64
+ [code of conduct](CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "standard/rake"
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task default: %i[spec standard]
@@ -0,0 +1,7 @@
1
+ module OmniAuth
2
+ module Rivo
3
+ module OAuth2
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+ require "omniauth/strategies/oauth2"
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ module Rivo
6
+ class OAuth2 < OmniAuth::Strategies::OAuth2
7
+ option :name, "rivo_oauth2"
8
+ option :client_options, {site: "https://loyalty.rivo.io/api/oauth/v1"}
9
+ option :pkce, true
10
+
11
+ uid { raw_info["resource_owner_id"] }
12
+
13
+ info do
14
+ {
15
+ name: raw_info["resource_owner"]["name"],
16
+ urls: raw_info["resource_owner"]["urls"].transform_keys(&:to_sym)
17
+ }
18
+ end
19
+
20
+ extra do
21
+ {
22
+ raw_info: raw_info
23
+ }
24
+ end
25
+
26
+ def raw_info
27
+ @raw_info ||= access_token.get("oauth/token/info").parsed
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,2 @@
1
+ require_relative "omniauth/rivo/oauth2/version"
2
+ require_relative "omniauth/strategies/rivo/oauth2"
@@ -0,0 +1,39 @@
1
+ require_relative "lib/omniauth/rivo/oauth2/version"
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "omniauth-rivo-oauth2"
5
+ spec.version = OmniAuth::Rivo::OAuth2::VERSION
6
+ spec.authors = ["Rivo Commerce"]
7
+ spec.email = ["developers@rivo.io"]
8
+
9
+ spec.summary = "Rivo OAuth 2 strategy for OmniAuth"
10
+ spec.homepage = "https://github.com/Rivo-Commerce/omniauth-rivo-oauth2"
11
+ spec.license = "MIT"
12
+ spec.required_ruby_version = ">= 2.7"
13
+
14
+ spec.metadata["homepage_uri"] = spec.homepage
15
+ spec.metadata["source_code_uri"] = spec.homepage
16
+ spec.metadata["changelog_uri"] = "#{spec.metadata["source_code_uri"]}/blob/main/CHANGELOG.md"
17
+ spec.metadata["bug_tracker_uri"] = "#{spec.metadata["source_code_uri"]}/issues"
18
+
19
+ spec.metadata["rubygems_mfa_required"] = "true"
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
23
+ spec.files = Dir.chdir(__dir__) do
24
+ `git ls-files -z`.split("\x0").reject do |f|
25
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
26
+ end
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ # Uncomment to register a new dependency of your gem
33
+ # spec.add_dependency "example-gem", "~> 1.0"
34
+ spec.add_runtime_dependency "omniauth-oauth2", "~> 1.7"
35
+ spec.add_runtime_dependency "oauth2", ">= 2"
36
+
37
+ # For more information and examples about making a new gem, check out our
38
+ # guide at: https://bundler.io/guides/creating_gem.html
39
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-rivo-oauth2
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Rivo Commerce
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth-oauth2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ description:
42
+ email:
43
+ - developers@rivo.io
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".rspec"
49
+ - ".standard.yml"
50
+ - CHANGELOG.md
51
+ - CODE_OF_CONDUCT.md
52
+ - Gemfile
53
+ - Gemfile.lock
54
+ - LICENSE.md
55
+ - README.md
56
+ - Rakefile
57
+ - lib/omniauth-rivo-oauth2.rb
58
+ - lib/omniauth/rivo/oauth2/version.rb
59
+ - lib/omniauth/strategies/rivo/oauth2.rb
60
+ - omniauth-rivo-oauth2.gemspec
61
+ homepage: https://github.com/Rivo-Commerce/omniauth-rivo-oauth2
62
+ licenses:
63
+ - MIT
64
+ metadata:
65
+ homepage_uri: https://github.com/Rivo-Commerce/omniauth-rivo-oauth2
66
+ source_code_uri: https://github.com/Rivo-Commerce/omniauth-rivo-oauth2
67
+ changelog_uri: https://github.com/Rivo-Commerce/omniauth-rivo-oauth2/blob/main/CHANGELOG.md
68
+ bug_tracker_uri: https://github.com/Rivo-Commerce/omniauth-rivo-oauth2/issues
69
+ rubygems_mfa_required: 'true'
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '2.7'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubygems_version: 3.3.23
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Rivo OAuth 2 strategy for OmniAuth
89
+ test_files: []