omniauth_openid_connect 0.3.5 → 0.5.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.
@@ -1,32 +1,64 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class StrategyTestCase < MiniTest::Test
2
4
  class DummyApp
3
5
  def call(env); end
4
6
  end
5
7
 
6
- attr_accessor :identifier, :secret
8
+ attr_accessor :identifier, :secret, :issuer, :nonce
7
9
 
8
10
  def setup
9
11
  @identifier = '1234'
10
12
  @secret = '1234asdgat3'
13
+ @issuer = 'https://server.example.com'
14
+ @nonce = SecureRandom.hex(16)
11
15
  end
12
16
 
13
17
  def client
14
18
  strategy.client
15
19
  end
16
20
 
21
+ def payload
22
+ {
23
+ "iss": issuer,
24
+ "aud": identifier,
25
+ "sub": '248289761001',
26
+ "nonce": nonce,
27
+ "exp": Time.now.to_i + 1000,
28
+ "iat": Time.now.to_i,
29
+ }
30
+ end
31
+
32
+ def private_key
33
+ @private_key ||= OpenSSL::PKey::RSA.generate(512)
34
+ end
35
+
36
+ def jwt
37
+ @jwt ||= JSON::JWT.new(payload).sign(private_key, :RS256)
38
+ end
39
+
40
+ def jwks
41
+ @jwks ||= begin
42
+ key = JSON::JWK.new(private_key)
43
+ keyset = JSON::JWK::Set.new(key)
44
+ { keys: keyset }
45
+ end
46
+ end
47
+
17
48
  def user_info
18
49
  @user_info ||= OpenIDConnect::ResponseObject::UserInfo.new(
19
50
  sub: SecureRandom.hex(16),
20
51
  name: Faker::Name.name,
21
52
  email: Faker::Internet.email,
53
+ email_verified: Faker::Boolean.boolean,
22
54
  nickname: Faker::Name.first_name,
23
55
  preferred_username: Faker::Internet.user_name,
24
56
  given_name: Faker::Name.first_name,
25
57
  family_name: Faker::Name.last_name,
26
58
  gender: 'female',
27
- picture: Faker::Internet.url + '.png',
59
+ picture: "#{Faker::Internet.url}.png",
28
60
  phone_number: Faker::PhoneNumber.phone_number,
29
- website: Faker::Internet.url,
61
+ website: Faker::Internet.url
30
62
  )
31
63
  end
32
64
 
@@ -37,6 +69,7 @@ class StrategyTestCase < MiniTest::Test
37
69
  request.stubs(:env).returns({})
38
70
  request.stubs(:scheme).returns({})
39
71
  request.stubs(:ssl?).returns(false)
72
+ request.stubs(:path).returns('')
40
73
  end
41
74
  end
42
75
 
@@ -46,6 +79,7 @@ class StrategyTestCase < MiniTest::Test
46
79
  strategy.options.client_options.secret = @secret
47
80
  strategy.stubs(:request).returns(request)
48
81
  strategy.stubs(:user_info).returns(user_info)
82
+ strategy.stubs(:script_name).returns('')
49
83
  end
50
84
  end
51
85
  end
data/test/test_helper.rb CHANGED
@@ -1,16 +1,26 @@
1
- lib = File.expand_path('../../lib', __FILE__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
1
+ # frozen_string_literal: true
3
2
 
4
3
  require 'simplecov'
5
- require 'coveralls'
6
4
  require 'minitest/autorun'
7
5
  require 'mocha/minitest'
8
6
  require 'faker'
9
7
  require 'active_support'
8
+
9
+ SimpleCov.start do
10
+ if ENV['CI']
11
+ require 'simplecov-lcov'
12
+
13
+ SimpleCov::Formatter::LcovFormatter.config do |c|
14
+ c.report_with_single_file = true
15
+ c.single_report_path = 'coverage/lcov.info'
16
+ end
17
+
18
+ formatter SimpleCov::Formatter::LcovFormatter
19
+ end
20
+ end
21
+
22
+ lib = File.expand_path('../lib', __dir__)
23
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
10
24
  require 'omniauth_openid_connect'
11
25
  require_relative 'strategy_test_case'
12
-
13
- SimpleCov.command_name 'test'
14
- SimpleCov.start
15
- Coveralls.wear!
16
26
  OmniAuth.config.test_mode = true
metadata CHANGED
@@ -1,44 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth_openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Bohn
8
8
  - Ilya Shcherbinin
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-06-07 00:00:00.000000000 Z
12
+ date: 2022-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: addressable
16
- requirement: !ruby/object:Gem::Requirement
17
- requirements:
18
- - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '2.5'
21
- type: :runtime
22
- prerelease: false
23
- version_requirements: !ruby/object:Gem::Requirement
24
- requirements:
25
- - - "~>"
26
- - !ruby/object:Gem::Version
27
- version: '2.5'
28
14
  - !ruby/object:Gem::Dependency
29
15
  name: omniauth
30
16
  requirement: !ruby/object:Gem::Requirement
31
17
  requirements:
32
- - - "~>"
18
+ - - ">="
33
19
  - !ruby/object:Gem::Version
34
20
  version: '1.9'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '3'
35
24
  type: :runtime
36
25
  prerelease: false
37
26
  version_requirements: !ruby/object:Gem::Requirement
38
27
  requirements:
39
- - - "~>"
28
+ - - ">="
40
29
  - !ruby/object:Gem::Version
41
30
  version: '1.9'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
42
34
  - !ruby/object:Gem::Dependency
43
35
  name: openid_connect
44
36
  requirement: !ruby/object:Gem::Requirement
@@ -53,34 +45,20 @@ dependencies:
53
45
  - - "~>"
54
46
  - !ruby/object:Gem::Version
55
47
  version: '1.1'
56
- - !ruby/object:Gem::Dependency
57
- name: coveralls
58
- requirement: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: '0.8'
63
- type: :development
64
- prerelease: false
65
- version_requirements: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - "~>"
68
- - !ruby/object:Gem::Version
69
- version: '0.8'
70
48
  - !ruby/object:Gem::Dependency
71
49
  name: faker
72
50
  requirement: !ruby/object:Gem::Requirement
73
51
  requirements:
74
52
  - - "~>"
75
53
  - !ruby/object:Gem::Version
76
- version: '1.6'
54
+ version: '2.0'
77
55
  type: :development
78
56
  prerelease: false
79
57
  version_requirements: !ruby/object:Gem::Requirement
80
58
  requirements:
81
59
  - - "~>"
82
60
  - !ruby/object:Gem::Version
83
- version: '1.6'
61
+ version: '2.0'
84
62
  - !ruby/object:Gem::Dependency
85
63
  name: guard
86
64
  requirement: !ruby/object:Gem::Requirement
@@ -171,28 +149,42 @@ dependencies:
171
149
  requirements:
172
150
  - - "~>"
173
151
  - !ruby/object:Gem::Version
174
- version: '0.63'
152
+ version: '1.12'
175
153
  type: :development
176
154
  prerelease: false
177
155
  version_requirements: !ruby/object:Gem::Requirement
178
156
  requirements:
179
157
  - - "~>"
180
158
  - !ruby/object:Gem::Version
181
- version: '0.63'
159
+ version: '1.12'
182
160
  - !ruby/object:Gem::Dependency
183
161
  name: simplecov
184
162
  requirement: !ruby/object:Gem::Requirement
185
163
  requirements:
186
164
  - - "~>"
187
165
  - !ruby/object:Gem::Version
188
- version: '0.12'
166
+ version: '0.21'
167
+ type: :development
168
+ prerelease: false
169
+ version_requirements: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.21'
174
+ - !ruby/object:Gem::Dependency
175
+ name: simplecov-lcov
176
+ requirement: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.8'
189
181
  type: :development
190
182
  prerelease: false
191
183
  version_requirements: !ruby/object:Gem::Requirement
192
184
  requirements:
193
185
  - - "~>"
194
186
  - !ruby/object:Gem::Version
195
- version: '0.12'
187
+ version: '0.8'
196
188
  description: OpenID Connect Strategy for OmniAuth.
197
189
  email:
198
190
  - jjbohn@gmail.com
@@ -201,12 +193,10 @@ executables: []
201
193
  extensions: []
202
194
  extra_rdoc_files: []
203
195
  files:
204
- - ".github/config/rubocop_linter_action.yml"
205
196
  - ".github/stale.yml"
206
- - ".github/workflows/rubocop.yml"
197
+ - ".github/workflows/main.yml"
207
198
  - ".gitignore"
208
199
  - ".rubocop.yml"
209
- - ".travis.yml"
210
200
  - CHANGELOG.md
211
201
  - Gemfile
212
202
  - Guardfile
@@ -219,8 +209,6 @@ files:
219
209
  - lib/omniauth/strategies/openid_connect.rb
220
210
  - lib/omniauth_openid_connect.rb
221
211
  - omniauth_openid_connect.gemspec
222
- - test/fixtures/id_token.txt
223
- - test/fixtures/jwks.json
224
212
  - test/fixtures/test.crt
225
213
  - test/lib/omniauth/strategies/openid_connect_test.rb
226
214
  - test/strategy_test_case.rb
@@ -228,8 +216,13 @@ files:
228
216
  homepage: https://github.com/m0n9oose/omniauth_openid_connect
229
217
  licenses:
230
218
  - MIT
231
- metadata: {}
232
- post_install_message:
219
+ metadata:
220
+ bug_tracker_uri: https://github.com/m0n9oose/omniauth_openid_connect/issues
221
+ changelog_uri: https://github.com/m0n9oose/omniauth_openid_connect/releases
222
+ documentation_uri: https://github.com/m0n9oose/omniauth_openid_connect/tree/v0.5.0#readme
223
+ source_code_uri: https://github.com/m0n9oose/omniauth_openid_connect/tree/v0.5.0
224
+ rubygems_mfa_required: 'true'
225
+ post_install_message:
233
226
  rdoc_options: []
234
227
  require_paths:
235
228
  - lib
@@ -244,13 +237,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
237
  - !ruby/object:Gem::Version
245
238
  version: '0'
246
239
  requirements: []
247
- rubygems_version: 3.0.6
248
- signing_key:
240
+ rubygems_version: 3.3.26
241
+ signing_key:
249
242
  specification_version: 4
250
243
  summary: OpenID Connect Strategy for OmniAuth
251
244
  test_files:
252
- - test/fixtures/id_token.txt
253
- - test/fixtures/jwks.json
254
245
  - test/fixtures/test.crt
255
246
  - test/lib/omniauth/strategies/openid_connect_test.rb
256
247
  - test/strategy_test_case.rb
@@ -1,59 +0,0 @@
1
- # Description: The name of the check that will be created.
2
- # Valid Options: A reasonably sized string.
3
- # Default: 'Rubocop Action'
4
- check_name: 'Rubocop Results'
5
-
6
- # Description: Versions required to run your RuboCop checks.
7
- # Valid options: RuboCop and any RuboCop extension, by default the latest gem version will be used. You can explicitly state that
8
- # (not required) or use a version number, like '1.5.1'.
9
- # Default:
10
- # versions:
11
- # - rubocop: 'latest'
12
- versions:
13
- - rubocop
14
- - rubocop-minitest
15
- - rubocop-performance: '1.5.1'
16
-
17
- # Description: Rubocop configuration file path relative to the workspace.
18
- # Valid options: A valid file path inside of the workspace.
19
- # Default: nil
20
- # Note: This does not need to be filled out for Rubocop to still find your config.
21
- # Resource: https://rubocop.readthedocs.io/en/stable/configuration/
22
- rubocop_config_path: '.rubocop.yml'
23
-
24
- # Run all cops enabled by configuration except this list.
25
- # Valid options: list of valid cop(s) and/or departments.
26
- # Default: nil
27
- # Resource: https://rubocop.readthedocs.io/en/stable/cops/
28
- # rubocop_excluded_cops:
29
- # - 'Style/FrozenStringLiteralComment'
30
-
31
- # Minimum severity for exit with error code
32
- # Valid options: 'refactor', 'convention', 'warning', 'error', or 'fatal'.
33
- # Default: 'warning'
34
- # Resource: https://rubocop.readthedocs.io/en/stable/configuration/#severity
35
- # rubocop_fail_level: 'warning'
36
-
37
- # Whether or not to use --force-exclusion when building the rubocop command. Use this if you are only linting modified
38
- # files and typically excluded files have been changed. For example, if you exclude db/schema.rb in your rubocop.yml
39
- # but a change gets made, then with the check_scope config set to 'modified' rubocop will lint db/schema.rb. If you set
40
- # this to true, rubocop will ignore it.
41
- # Valid options: true || false
42
- # Default: false
43
-
44
- # Instead of installing gems from rubygems, we can run `bundle install` on your project,
45
- # you would need to do this if you are using something like 'rubocop-github' or if you don't
46
- # want to list out dependencies with the `versions` key.
47
- # Valid options: true || false
48
- # Default: false
49
- # bundle: false
50
-
51
- # The scope of code that Rubocop should lint. Use this if you only want to lint changed files. If this is not set
52
- # or not equal to 'modified', Rubocop is run against the entire codebase. Note that this will not work on the master branch.
53
- # Valid options: 'modified'
54
- # Default: nil
55
-
56
- # The base branch against which changes will be compared, if check_scope config is set to 'modified'.
57
- # This setting is not used if check_scope != 'modified'.
58
- # Valid options: 'origin/another_branch'
59
- # Default: 'origin/master'
@@ -1,22 +0,0 @@
1
- name: Rubocop check
2
-
3
- on:
4
- pull_request:
5
- branches:
6
- - "*"
7
- push:
8
- branches:
9
- - master
10
- jobs:
11
- build:
12
- name: RuboCop Action
13
- runs-on: ubuntu-latest
14
- steps:
15
- - name: Checkout Action
16
- uses: actions/checkout@v1
17
- - name: Rubocop Linter Action
18
- uses: andrewmcodes/rubocop-linter-action@v3.2.0
19
- with:
20
- action_config_path: '.github/config/rubocop_linter_action.yml'
21
- env:
22
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.4
4
- - 2.5
5
- - 2.6
6
- - 2.7
7
- - jruby-head
8
- - ruby-head
@@ -1 +0,0 @@
1
- eyJhbGciOiJSUzI1NiIsImtpZCI6IjFlOWdkazcifQ.ewogImlzcyI6ICJodHRwOi8vc2VydmVyLmV4YW1wbGUuY29tIiwKICJzdWIiOiAiMjQ4Mjg5NzYxMDAxIiwKICJhdWQiOiAiczZCaGRSa3F0MyIsCiAibm9uY2UiOiAibi0wUzZfV3pBMk1qIiwKICJleHAiOiAxMzExMjgxOTcwLAogImlhdCI6IDEzMTEyODA5NzAKfQ.ggW8hZ1EuVLuxNuuIJKX_V8a_OMXzR0EHR9R6jgdqrOOF4daGU96Sr_P6qJp6IcmD3HP99Obi1PRs-cwh3LO-p146waJ8IhehcwL7F09JdijmBqkvPeB2T9CJNqeGpe-gccMg4vfKjkM8FcGvnzZUN4_KSP0aAp1tOJ1zZwgjxqGByKHiOtX7TpdQyHE5lcMiKPXfEIQILVq0pc_E2DzL7emopWoaoZTF_m0_N0YzFC6g6EJbOEoRoSK5hoDalrcvRYLSrQAZZKflyuVCyixEoV9GfNQC3_osjzw2PAithfubEEBLuVVk4XUVrWOLrLl0nx7RkKU8NXNHq-rvKMzqg
@@ -1,8 +0,0 @@
1
- {"keys": [{
2
- "kty": "RSA",
3
- "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
4
- "e": "AQAB",
5
- "alg": "RS256",
6
- "kid": "1e9gdk7"
7
- }]
8
- }