omniauth-nitro-id 1.1.1 → 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: d597ab3b4ec465274903767494f7261a93cb09afb365618dd6681752ee8ba0c0
4
- data.tar.gz: dbd6d14de7b47202b908d9fc67919832ad75d58c11ef971c3437b2c4c2ac9629
3
+ metadata.gz: 598ab656c80d449f084bd6b56d7daaf87ec9c16d6370c23722e2406c83822a96
4
+ data.tar.gz: 992cea65d60e09ae5d7870299cf10a0efff90570b81b72683efb410523ff8f0e
5
5
  SHA512:
6
- metadata.gz: 82db598358577adbdaccc0346501e8fd00a0dd3e24e09591b9dc51eb1e8e2d9b75a575e3115604c0916ff27bc5aed46a98df08e83de9e15daa5de7cbc358e3ce
7
- data.tar.gz: 5f0a78eeb7a3660ff3688b35d6324c9a0c4f39e2724084259b5ae41038299c56794b507fc585f307ef42386a71f67eca5723d3f013053b8522f58c900b499b0a
6
+ metadata.gz: f57196206bc8307d16a067d71af20cf1c9bc378727d0a238b76e6470bde1b3e6494cb7977e7ae1a314575e359175a4ef76452cf649c264a7d22b96d717c95617
7
+ data.tar.gz: 0e7e79bdf2e1242a01e0e58660ef27e18e0085b1a56919a4fec7d7f25a62e4ead9461d7f90d244e113144fe23092984c72e4e9173311cfba81b0859d9744ac08
@@ -5,9 +5,8 @@ on:
5
5
 
6
6
  jobs:
7
7
  ruby:
8
- uses: powerhome/power-tools/.github/workflows/_ruby-package.yml@main
8
+ uses: powerhome/power-tools/.github/workflows/_ruby-workflow.yml@main
9
9
  with:
10
10
  package: '${{ github.workflow }}'
11
11
  ruby: '["2.7", "3.0", "3.1"]'
12
- rails: '["any"]'
13
12
  secrets: inherit
data/.gitignore CHANGED
@@ -1,7 +1,6 @@
1
1
  /.bundle/
2
2
  /.DS_store
3
3
  /.yardoc
4
- /Gemfile.lock
5
4
  /_yardoc/
6
5
  /coverage/
7
6
  /pkg/
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
data/docs/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ 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
+
10
16
  ## [1.1.1] - 2023-03-06
11
17
 
12
18
  ### Added
@@ -25,7 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
25
31
 
26
32
  * Initial release
27
33
 
28
- [Unreleased]: https://github.com/powerhome/omniauth-nitro-id/compare/v1.1.1...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
29
36
  [1.1.1]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.1.1
30
37
  [1.1.0]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.1.0
31
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.1"
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,6 +17,8 @@ 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"
21
23
  spec.add_dependency "omniauth-rails_csrf_protection", "1.0.1"
22
24
 
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.1
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: 2023-03-06 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
@@ -177,6 +205,7 @@ files:
177
205
  - ".rspec"
178
206
  - ".rubocop.yml"
179
207
  - Gemfile
208
+ - Gemfile.lock
180
209
  - Guardfile
181
210
  - LICENSE.txt
182
211
  - Rakefile