omniauth-nitro-id 0.1.1

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: d4d3e8c274665be7c83f34c25dbf04aa079f54192cbd30a59ef4b6243020d33d
4
+ data.tar.gz: 964db9c5a01dd33f16cc8491b9aeaac22dd980fd09d25ee737953824b2fbcc21
5
+ SHA512:
6
+ metadata.gz: b16e8610dd2aeea20d1cdbe80088d7fd95898863987ccab37d2ffaa4efbdc59c21d9443e4e341b3c58a58d55bf19e33160b1c072e54f766250d114d5fda60794
7
+ data.tar.gz: 25a285b3e002a2dcbc096cc7c9c9ecfc45fdc6ef59c06acf923705676c06320f390dc8c82f0780b4b3b700bf23d3878fc866e9b610644901501f287f12783e2f
@@ -0,0 +1 @@
1
+ * @powerhome/s-h-i-e-l-d
@@ -0,0 +1,34 @@
1
+ name: CI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ test:
7
+ name: Tests
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ fail-fast: false
11
+ matrix:
12
+ ruby:
13
+ - "2.7.4"
14
+ - "3.1.2"
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ bundler-cache: true
21
+ - name: Run tests
22
+ run: bundle exec rake spec
23
+ lint:
24
+ name: Lint Ruby
25
+ runs-on: ubuntu-latest
26
+ steps:
27
+ - uses: actions/checkout@v3
28
+ - uses: ruby/setup-ruby@v1
29
+ with:
30
+ ruby-version: 3.1.2
31
+ - name: Bundle
32
+ run: bundle
33
+ - name: Run Rubocop
34
+ run: bundle exec rubocop
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.DS_store
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/examples.txt
10
+ /spec/reports/
11
+ /tmp/
12
+ .bundle
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,11 @@
1
+ require:
2
+ - rubocop-powerhome
3
+
4
+ Rails:
5
+ Enabled: false
6
+
7
+ Gemspec/RequireMFA:
8
+ Enabled: false
9
+
10
+ Naming/FileName:
11
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ guard "rspec" do
4
+ watch(%r{^spec/.+_spec\.rb$})
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
6
+ watch("spec/spec_helper.rb") { "spec" }
7
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+
2
+ The MIT License (MIT)
3
+
4
+ Copyright Power Home Remodeling Group, LLC
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+ require "rspec/core/rake_task"
6
+
7
+ RSpec::Core::RakeTask.new(:spec)
8
+ RuboCop::RakeTask.new(:rubocop)
9
+
10
+ task default: %i[spec rubocop]
data/bin/console ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "omniauth-nitro-id"
6
+
7
+ require "irb"
8
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
data/docs/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # omniauth-nitro-id
2
+
3
+ OmniAuth strategy for NitroID. To use it, you will need an OAuth2 Client ID and Secret. For more information, see the [NitroID user guide.](https://github.com/powerhome/nitro-id/blob/main/docs/user-guide.md)
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'omniauth-nitro-id'
9
+
10
+ And then execute:
11
+
12
+ $ bundle
13
+
14
+ Or install it yourself as:
15
+
16
+ $ gem install omniauth-nitro-id
17
+
18
+ ## Supported Ruby Versions
19
+
20
+ `omniauth-nitro-id` supports 2.7.4 and 3.1.2
21
+
22
+ ## Usage
23
+
24
+ Example configuration
25
+ ```ruby
26
+ config.omniauth :nitro_id, {
27
+ client_options: {
28
+ identifier: "CLIENT_ID",
29
+ secret: "SECRET",
30
+ }
31
+ }
32
+ ```
33
+
34
+ Check out Power's [example Rails app](https://github.com/powerhome/example-rails-app) for details on how to use this gem with Devise.
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module NitroId
5
+ VERSION = "0.1.1"
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/nitro_id/version"
4
+ require "omniauth/strategies/nitro_id"
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth_openid_connect"
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ class NitroId < OmniAuth::Strategies::OpenIDConnect
8
+ DEFAULT_STRATEGY_NAME = "nitro_id"
9
+ DEFAULT_ISSUER = "https://id.powerhrg.com/"
10
+ DEFAULT_HOST = "id.powerhrg.com"
11
+
12
+ option :name, DEFAULT_STRATEGY_NAME
13
+ option :discovery, true
14
+ option :issuer, DEFAULT_ISSUER
15
+ option :client_options, host: DEFAULT_HOST
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth/nitro_id"
data/mkdocs.yml ADDED
@@ -0,0 +1,6 @@
1
+ site_name: OmniAuth NitroID
2
+ site_description: OmniAuth NitroID Documentation
3
+ nav:
4
+ - "Home": "README.md"
5
+ plugins:
6
+ - techdocs-core
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("lib/omniauth/nitro_id/version", __dir__)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "omniauth-nitro-id"
7
+ spec.version = OmniAuth::NitroId::VERSION
8
+ spec.authors = ["Stephen Greer"]
9
+ spec.email = ["stephen.greer@powerhrg.com"]
10
+ spec.summary = "NitroID Strategy for OmniAuth."
11
+ spec.description = "NitroID Strategy for OmniAuth."
12
+ spec.homepage = "https://github.com/powerhome/omniauth-nitro-id"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.7.0"
15
+
16
+ spec.files = `git ls-files`.split("\n")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "omniauth_openid_connect", "~> 0.4.0"
21
+
22
+ spec.add_development_dependency "bundler"
23
+ spec.add_development_dependency "guard-rspec"
24
+ spec.add_development_dependency "net-smtp"
25
+ spec.add_development_dependency "pry"
26
+ spec.add_development_dependency "rake", "13.0.6"
27
+ spec.add_development_dependency "rspec", "3.11.0"
28
+ spec.add_development_dependency "rubocop", "1.31.1"
29
+ spec.add_development_dependency "rubocop-powerhome", ">= 0.4.1"
30
+ end
data/portal.yml ADDED
@@ -0,0 +1,12 @@
1
+ apiVersion: backstage.io/v1alpha1
2
+ kind: Component
3
+ metadata:
4
+ name: omniauth-nitro-id
5
+ title: OmniAuth NitroID
6
+ description: NitroID OmniAuth Strategy
7
+ annotations:
8
+ backstage.io/techdocs-ref: dir:.
9
+ spec:
10
+ type: library
11
+ owner: shield
12
+ lifecycle: production
data/renovate.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": ["config:base", "group:allNonMajor"],
3
+ "lockFileMaintenance": {
4
+ "enabled": true
5
+ },
6
+ "labels": ["dependencies"],
7
+ "timezone": "America/New_York"
8
+ }
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+
5
+ describe OmniAuth::Strategies::NitroId do
6
+ let(:access_token) { instance_double("AccessToken", :options => {}, :[] => "user") }
7
+ let(:custom_client) do
8
+ OmniAuth::Strategies::NitroId.new(:test_app,
9
+ issuer: "https://example-host.com/",
10
+ discovery: false,
11
+ client_options: {
12
+ host: "example-host.com",
13
+ })
14
+ end
15
+
16
+ subject do
17
+ OmniAuth::Strategies::NitroId.new({})
18
+ end
19
+
20
+ before(:each) do
21
+ allow(subject).to receive(:access_token).and_return(access_token)
22
+ end
23
+
24
+ context "options" do
25
+ it "should have correct name" do
26
+ expect(subject.options.name).to eq "nitro_id"
27
+ end
28
+
29
+ it "should have correct host" do
30
+ expect(subject.options.client_options.host).to eq "id.powerhrg.com"
31
+ end
32
+
33
+ it "should have correct issuer" do
34
+ expect(subject.options.issuer).to eq "https://id.powerhrg.com/"
35
+ end
36
+
37
+ it "should have the correct discovery setting" do
38
+ expect(subject.options.discovery).to eq true
39
+ end
40
+
41
+ describe "should be overrideable" do
42
+ it "for host" do
43
+ expect(custom_client.options.client_options.host).to eq "example-host.com"
44
+ end
45
+
46
+ it "for issuer" do
47
+ expect(custom_client.options.issuer).to eq "https://example-host.com/"
48
+ end
49
+
50
+ it "for discovery" do
51
+ expect(custom_client.options.discovery).to eq false
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rspec"
4
+ require "omniauth"
5
+ require "omniauth-nitro-id"
6
+
7
+ RSpec.configure do |config|
8
+ config.extend OmniAuth::Test::StrategyMacros, type: :strategy
9
+ end
metadata ADDED
@@ -0,0 +1,193 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-nitro-id
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Stephen Greer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-07-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth_openid_connect
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: net-smtp
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 13.0.6
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 13.0.6
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 3.11.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 3.11.0
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.31.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.31.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-powerhome
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: 0.4.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 0.4.1
139
+ description: NitroID Strategy for OmniAuth.
140
+ email:
141
+ - stephen.greer@powerhrg.com
142
+ executables:
143
+ - console
144
+ - setup
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - ".github/CODEOWNERS"
149
+ - ".github/workflows/ci.yml"
150
+ - ".gitignore"
151
+ - ".rspec"
152
+ - ".rubocop.yml"
153
+ - Gemfile
154
+ - Guardfile
155
+ - LICENSE.txt
156
+ - Rakefile
157
+ - bin/console
158
+ - bin/setup
159
+ - docs/README.md
160
+ - lib/omniauth-nitro-id.rb
161
+ - lib/omniauth/nitro_id.rb
162
+ - lib/omniauth/nitro_id/version.rb
163
+ - lib/omniauth/strategies/nitro_id.rb
164
+ - mkdocs.yml
165
+ - omniauth-nitro-id.gemspec
166
+ - portal.yml
167
+ - renovate.json
168
+ - spec/omniauth/strategies/nitro_id_spec.rb
169
+ - spec/spec_helper.rb
170
+ homepage: https://github.com/powerhome/omniauth-nitro-id
171
+ licenses:
172
+ - MIT
173
+ metadata: {}
174
+ post_install_message:
175
+ rdoc_options: []
176
+ require_paths:
177
+ - lib
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: 2.7.0
183
+ required_rubygems_version: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ requirements: []
189
+ rubygems_version: 3.3.7
190
+ signing_key:
191
+ specification_version: 4
192
+ summary: NitroID Strategy for OmniAuth.
193
+ test_files: []