omniauth-nitro-id 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3fcfd3453a65729b3e8f7a24c6741c14cacc74d88547e24cb120fdeda0f55c3
4
- data.tar.gz: 2a6b81428854f8eb43b5be273aff890d9caf2cdf48cbb9154fd7d4eecab7d09b
3
+ metadata.gz: 598ab656c80d449f084bd6b56d7daaf87ec9c16d6370c23722e2406c83822a96
4
+ data.tar.gz: 992cea65d60e09ae5d7870299cf10a0efff90570b81b72683efb410523ff8f0e
5
5
  SHA512:
6
- metadata.gz: 386e8ba55776a76e8905e58420dc897261011083adc935005c806944a48ec20ed772adef07d82571fbaa34903934ee4ed9d3d1063324b1047c072a56863f526f
7
- data.tar.gz: 3e9aa553a7de06ccbb143da81061c87489b3412ccc8ac15e6aaa10edbdf046e2ab0c261aebb203e2e5fb4358de546b7e391925f1e3ea91975a7627b7f78c16a3
6
+ metadata.gz: f57196206bc8307d16a067d71af20cf1c9bc378727d0a238b76e6470bde1b3e6494cb7977e7ae1a314575e359175a4ef76452cf649c264a7d22b96d717c95617
7
+ data.tar.gz: 0e7e79bdf2e1242a01e0e58660ef27e18e0085b1a56919a4fec7d7f25a62e4ead9461d7f90d244e113144fe23092984c72e4e9173311cfba81b0859d9744ac08
@@ -0,0 +1,12 @@
1
+ name: omniauth-nitro-id
2
+
3
+ on:
4
+ push:
5
+
6
+ jobs:
7
+ ruby:
8
+ uses: powerhome/power-tools/.github/workflows/_ruby-workflow.yml@main
9
+ with:
10
+ package: '${{ github.workflow }}'
11
+ ruby: '["2.7", "3.0", "3.1"]'
12
+ secrets: inherit
data/.gitignore CHANGED
@@ -1,10 +1,8 @@
1
1
  /.bundle/
2
2
  /.DS_store
3
3
  /.yardoc
4
- /Gemfile.lock
5
4
  /_yardoc/
6
5
  /coverage/
7
- /doc/
8
6
  /pkg/
9
7
  /spec/examples.txt
10
8
  /spec/reports/
data/Gemfile.lock ADDED
@@ -0,0 +1,261 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-nitro-id (1.2.0)
5
+ faraday (= 2.7.10)
6
+ jwt (= 2.7.0)
7
+ omniauth-rails_csrf_protection (= 1.0.1)
8
+ omniauth_openid_connect (~> 0.4.0)
9
+
10
+ GEM
11
+ remote: https://rubygems.org/
12
+ specs:
13
+ actionpack (7.0.6)
14
+ actionview (= 7.0.6)
15
+ activesupport (= 7.0.6)
16
+ rack (~> 2.0, >= 2.2.4)
17
+ rack-test (>= 0.6.3)
18
+ rails-dom-testing (~> 2.0)
19
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
20
+ actionview (7.0.6)
21
+ activesupport (= 7.0.6)
22
+ builder (~> 3.1)
23
+ erubi (~> 1.4)
24
+ rails-dom-testing (~> 2.0)
25
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
26
+ activemodel (7.0.6)
27
+ activesupport (= 7.0.6)
28
+ activesupport (7.0.6)
29
+ concurrent-ruby (~> 1.0, >= 1.0.2)
30
+ i18n (>= 1.6, < 2)
31
+ minitest (>= 5.1)
32
+ tzinfo (~> 2.0)
33
+ addressable (2.8.4)
34
+ public_suffix (>= 2.0.2, < 6.0)
35
+ aes_key_wrap (1.1.0)
36
+ ast (2.4.2)
37
+ attr_required (1.0.1)
38
+ bindata (2.4.15)
39
+ builder (3.2.4)
40
+ coderay (1.1.3)
41
+ concurrent-ruby (1.2.2)
42
+ crass (1.0.6)
43
+ date (3.3.3)
44
+ diff-lcs (1.5.0)
45
+ erubi (1.12.0)
46
+ faraday (2.7.10)
47
+ faraday-net_http (>= 2.0, < 3.1)
48
+ ruby2_keywords (>= 0.0.4)
49
+ faraday-follow_redirects (0.3.0)
50
+ faraday (>= 1, < 3)
51
+ faraday-net_http (3.0.2)
52
+ ffi (1.15.5)
53
+ formatador (1.1.0)
54
+ guard (2.18.0)
55
+ formatador (>= 0.2.4)
56
+ listen (>= 2.7, < 4.0)
57
+ lumberjack (>= 1.0.12, < 2.0)
58
+ nenv (~> 0.1)
59
+ notiffany (~> 0.0)
60
+ pry (>= 0.13.0)
61
+ shellany (~> 0.0)
62
+ thor (>= 0.18.1)
63
+ guard-compat (1.2.1)
64
+ guard-rspec (4.7.3)
65
+ guard (~> 2.1)
66
+ guard-compat (~> 1.1)
67
+ rspec (>= 2.99.0, < 4.0)
68
+ hashie (5.0.0)
69
+ httpclient (2.8.3)
70
+ i18n (1.14.1)
71
+ concurrent-ruby (~> 1.0)
72
+ json (2.6.3)
73
+ json-jwt (1.16.3)
74
+ activesupport (>= 4.2)
75
+ aes_key_wrap
76
+ bindata
77
+ faraday (~> 2.0)
78
+ faraday-follow_redirects
79
+ jwt (2.7.0)
80
+ license_finder (7.1.0)
81
+ bundler
82
+ rubyzip (>= 1, < 3)
83
+ thor (~> 1.2)
84
+ tomlrb (>= 1.3, < 2.1)
85
+ with_env (= 1.1.0)
86
+ xml-simple (~> 1.1.9)
87
+ listen (3.8.0)
88
+ rb-fsevent (~> 0.10, >= 0.10.3)
89
+ rb-inotify (~> 0.9, >= 0.9.10)
90
+ loofah (2.21.3)
91
+ crass (~> 1.0.2)
92
+ nokogiri (>= 1.12.0)
93
+ lumberjack (1.2.8)
94
+ mail (2.8.1)
95
+ mini_mime (>= 0.1.1)
96
+ net-imap
97
+ net-pop
98
+ net-smtp
99
+ method_source (1.0.0)
100
+ mini_mime (1.1.2)
101
+ minitest (5.18.1)
102
+ nenv (0.3.0)
103
+ net-imap (0.3.6)
104
+ date
105
+ net-protocol
106
+ net-pop (0.1.2)
107
+ net-protocol
108
+ net-protocol (0.2.1)
109
+ timeout
110
+ net-smtp (0.3.3)
111
+ net-protocol
112
+ nokogiri (1.15.3-arm64-darwin)
113
+ racc (~> 1.4)
114
+ nokogiri (1.15.3-x86_64-linux)
115
+ racc (~> 1.4)
116
+ notiffany (0.1.3)
117
+ nenv (~> 0.1)
118
+ shellany (~> 0.0)
119
+ omniauth (2.1.1)
120
+ hashie (>= 3.4.6)
121
+ rack (>= 2.2.3)
122
+ rack-protection
123
+ omniauth-rails_csrf_protection (1.0.1)
124
+ actionpack (>= 4.2)
125
+ omniauth (~> 2.0)
126
+ omniauth_openid_connect (0.4.0)
127
+ addressable (~> 2.5)
128
+ omniauth (>= 1.9, < 3)
129
+ openid_connect (~> 1.1)
130
+ openid_connect (1.4.2)
131
+ activemodel
132
+ attr_required (>= 1.0.0)
133
+ json-jwt (>= 1.15.0)
134
+ net-smtp
135
+ rack-oauth2 (~> 1.21)
136
+ swd (~> 1.3)
137
+ tzinfo
138
+ validate_email
139
+ validate_url
140
+ webfinger (~> 1.2)
141
+ parallel (1.23.0)
142
+ parser (3.2.2.3)
143
+ ast (~> 2.4.1)
144
+ racc
145
+ pry (0.14.2)
146
+ coderay (~> 1.1)
147
+ method_source (~> 1.0)
148
+ public_suffix (5.0.3)
149
+ racc (1.7.1)
150
+ rack (2.2.7)
151
+ rack-oauth2 (1.21.3)
152
+ activesupport
153
+ attr_required
154
+ httpclient
155
+ json-jwt (>= 1.11.0)
156
+ rack (>= 2.1.0)
157
+ rack-protection (3.0.6)
158
+ rack
159
+ rack-test (2.1.0)
160
+ rack (>= 1.3)
161
+ rails-dom-testing (2.1.1)
162
+ activesupport (>= 5.0.0)
163
+ minitest
164
+ nokogiri (>= 1.6)
165
+ rails-html-sanitizer (1.6.0)
166
+ loofah (~> 2.21)
167
+ nokogiri (~> 1.14)
168
+ rainbow (3.1.1)
169
+ rake (13.0.6)
170
+ rb-fsevent (0.11.2)
171
+ rb-inotify (0.10.1)
172
+ ffi (~> 1.0)
173
+ regexp_parser (2.8.1)
174
+ rexml (3.2.5)
175
+ rspec (3.11.0)
176
+ rspec-core (~> 3.11.0)
177
+ rspec-expectations (~> 3.11.0)
178
+ rspec-mocks (~> 3.11.0)
179
+ rspec-core (3.11.0)
180
+ rspec-support (~> 3.11.0)
181
+ rspec-expectations (3.11.1)
182
+ diff-lcs (>= 1.2.0, < 2.0)
183
+ rspec-support (~> 3.11.0)
184
+ rspec-mocks (3.11.2)
185
+ diff-lcs (>= 1.2.0, < 2.0)
186
+ rspec-support (~> 3.11.0)
187
+ rspec-support (3.11.1)
188
+ rubocop (1.31.1)
189
+ json (~> 2.3)
190
+ parallel (~> 1.10)
191
+ parser (>= 3.1.0.0)
192
+ rainbow (>= 2.2.2, < 4.0)
193
+ regexp_parser (>= 1.8, < 3.0)
194
+ rexml (>= 3.2.5, < 4.0)
195
+ rubocop-ast (>= 1.18.0, < 2.0)
196
+ ruby-progressbar (~> 1.7)
197
+ unicode-display_width (>= 1.4.0, < 3.0)
198
+ rubocop-ast (1.29.0)
199
+ parser (>= 3.2.1.0)
200
+ rubocop-performance (1.18.0)
201
+ rubocop (>= 1.7.0, < 2.0)
202
+ rubocop-ast (>= 0.4.0)
203
+ rubocop-powerhome (0.5.0)
204
+ rubocop
205
+ rubocop-performance
206
+ rubocop-rails
207
+ rubocop-rake
208
+ rubocop-rspec
209
+ rubocop-rails (2.15.2)
210
+ activesupport (>= 4.2.0)
211
+ rack (>= 1.1)
212
+ rubocop (>= 1.7.0, < 2.0)
213
+ rubocop-rake (0.6.0)
214
+ rubocop (~> 1.0)
215
+ rubocop-rspec (2.12.1)
216
+ rubocop (~> 1.31)
217
+ ruby-progressbar (1.13.0)
218
+ ruby2_keywords (0.0.5)
219
+ rubyzip (2.3.2)
220
+ shellany (0.0.1)
221
+ swd (1.3.0)
222
+ activesupport (>= 3)
223
+ attr_required (>= 0.0.5)
224
+ httpclient (>= 2.4)
225
+ thor (1.2.2)
226
+ timeout (0.4.0)
227
+ tomlrb (2.0.3)
228
+ tzinfo (2.0.6)
229
+ concurrent-ruby (~> 1.0)
230
+ unicode-display_width (2.4.2)
231
+ validate_email (0.1.6)
232
+ activemodel (>= 3.0)
233
+ mail (>= 2.2.5)
234
+ validate_url (1.0.15)
235
+ activemodel (>= 3.0.0)
236
+ public_suffix
237
+ webfinger (1.2.0)
238
+ activesupport
239
+ httpclient (>= 2.4)
240
+ with_env (1.1.0)
241
+ xml-simple (1.1.9)
242
+ rexml
243
+
244
+ PLATFORMS
245
+ arm64-darwin-22
246
+ x86_64-linux
247
+
248
+ DEPENDENCIES
249
+ bundler
250
+ guard-rspec
251
+ license_finder (>= 7.0)
252
+ net-smtp
253
+ omniauth-nitro-id!
254
+ pry
255
+ rake (= 13.0.6)
256
+ rspec (= 3.11.0)
257
+ rubocop (= 1.31.1)
258
+ rubocop-powerhome (>= 0.4.1)
259
+
260
+ BUNDLED WITH
261
+ 2.4.17
@@ -0,0 +1,3 @@
1
+ ---
2
+ - - :inherit_from
3
+ - https://raw.githubusercontent.com/powerhome/oss-guide/master/license_rules.yml
data/docs/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.2.0] - 2023-07-24
11
+
12
+ ### Added
13
+
14
+ * Add `decode_logout_token` method. PR [#13](https://github.com/powerhome/omniauth-nitro-id/pull/13)
15
+
16
+ ## [1.1.1] - 2023-03-06
17
+
18
+ ### Added
19
+
20
+ * Add `omniauth-rails_csrf_protection` dependency. PR [#12](https://github.com/powerhome/omniauth-nitro-id/pull/12)
21
+
10
22
  ## [1.1.0] - 2022-12-14
11
23
 
12
24
  ### Added
@@ -19,6 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
31
 
20
32
  * Initial release
21
33
 
22
- [Unreleased]: https://github.com/powerhome/omniauth-nitro-id/compare/v1.0.0...HEAD
34
+ [Unreleased]: https://github.com/powerhome/omniauth-nitro-id/compare/v1.2.0...HEAD
35
+ [1.2.0]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.2.0
36
+ [1.1.1]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.1.1
23
37
  [1.1.0]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.1.0
24
38
  [1.0.0]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.0.0
data/docs/README.md CHANGED
@@ -31,4 +31,13 @@ config.omniauth :nitro_id, {
31
31
  }
32
32
  ```
33
33
 
34
+ Decoding NitroID's RSA256-encoded logout token
35
+ ```ruby
36
+ token = params[:logout_token]
37
+ # eyJhbGciOiJSUzI1NiIsImtpZCI6InB1YmxpYzpoeWRyYS5vcGVuaWQuaWQtdG9rZW4iLCJ0eXAiOiJK...
38
+
39
+ OmniAuth::Strategies::NitroId.decode_logout_token(token)
40
+ # [{"aud"=>["196da0d5-adc6-4454-98f2-3cabae04855c"], "events"=>{"http://schemas.openid.net/event/backchannel-logout"=>{}}, "iat"=>1688672696, "iss"=>"https://id.powerhrg.com/" ...
41
+ ```
42
+
34
43
  Check out Power's [example Rails app](https://github.com/powerhome/example-rails-app) for details on how to use this gem with Devise.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module NitroId
5
- VERSION = "1.1.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "jwt"
4
+
3
5
  require "omniauth_openid_connect"
4
6
  require_relative "../../extensions/discovery"
5
7
 
@@ -16,6 +18,20 @@ module OmniAuth
16
18
  end
17
19
  end
18
20
 
21
+ def self.decode_logout_token(token)
22
+ jwks = fetch_jwks
23
+ jwks.filter! { |key| key[:use] == "sig" }
24
+ algorithms = jwks.filter_map { |key| key[:alg] }.uniq
25
+ JWT.decode(token, nil, true, algorithms: algorithms, jwks: jwks)
26
+ end
27
+
28
+ def self.fetch_jwks
29
+ conn = Faraday.new(url: default_options[:issuer]) { |faraday| faraday.response :raise_error }
30
+ response = conn.get(".well-known/jwks.json")
31
+ jwks = JSON.parse(response.body)
32
+ JWT::JWK::Set.new(jwks)
33
+ end
34
+
19
35
  private
20
36
 
21
37
  def fetch_key
@@ -17,10 +17,14 @@ Gem::Specification.new do |spec|
17
17
  spec.executables = []
18
18
  spec.require_paths = ["lib"]
19
19
 
20
+ spec.add_dependency "faraday", "2.7.10"
21
+ spec.add_dependency "jwt", "2.7.0"
20
22
  spec.add_dependency "omniauth_openid_connect", "~> 0.4.0"
23
+ spec.add_dependency "omniauth-rails_csrf_protection", "1.0.1"
21
24
 
22
25
  spec.add_development_dependency "bundler"
23
26
  spec.add_development_dependency "guard-rspec"
27
+ spec.add_development_dependency "license_finder", ">= 7.0"
24
28
  spec.add_development_dependency "net-smtp"
25
29
  spec.add_development_dependency "pry"
26
30
  spec.add_development_dependency "rake", "13.0.6"
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-nitro-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Greer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-12-14 00:00:00.000000000 Z
11
+ date: 2023-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 2.7.10
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 2.7.10
27
+ - !ruby/object:Gem::Dependency
28
+ name: jwt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 2.7.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 2.7.0
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: omniauth_openid_connect
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -24,6 +52,20 @@ dependencies:
24
52
  - - "~>"
25
53
  - !ruby/object:Gem::Version
26
54
  version: 0.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: omniauth-rails_csrf_protection
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.0.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '='
67
+ - !ruby/object:Gem::Version
68
+ version: 1.0.1
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: bundler
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +94,20 @@ dependencies:
52
94
  - - ">="
53
95
  - !ruby/object:Gem::Version
54
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: license_finder
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '7.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '7.0'
55
111
  - !ruby/object:Gem::Dependency
56
112
  name: net-smtp
57
113
  requirement: !ruby/object:Gem::Requirement
@@ -144,16 +200,18 @@ extensions: []
144
200
  extra_rdoc_files: []
145
201
  files:
146
202
  - ".github/CODEOWNERS"
147
- - ".github/workflows/ci.yml"
203
+ - ".github/workflows/omniauth-nitro-id.yml"
148
204
  - ".gitignore"
149
205
  - ".rspec"
150
206
  - ".rubocop.yml"
151
207
  - Gemfile
208
+ - Gemfile.lock
152
209
  - Guardfile
153
210
  - LICENSE.txt
154
211
  - Rakefile
155
212
  - bin/console
156
213
  - bin/setup
214
+ - doc/dependency_decisions.yml
157
215
  - docs/CHANGELOG.md
158
216
  - docs/README.md
159
217
  - lib/extensions/discovery.rb
@@ -1,34 +0,0 @@
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