omniauth-nitro-id 1.0.0 → 1.1.1

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: b3b09237f96562c54df18acc4a2974ee10c321d587bd2c0878865c30aa57a0ed
4
- data.tar.gz: 7bf933d671741411f8184693d372ccddadc64d74158b8177eb7d7cc68bccf7a1
3
+ metadata.gz: d597ab3b4ec465274903767494f7261a93cb09afb365618dd6681752ee8ba0c0
4
+ data.tar.gz: dbd6d14de7b47202b908d9fc67919832ad75d58c11ef971c3437b2c4c2ac9629
5
5
  SHA512:
6
- metadata.gz: ba8f9dcf267a4c63ba805f7fa7cca57e798534b070cd81fd40890a3b7f0b475a142a4f626bf8c93e78ce18ae54d227fc5187e98415bf1a516d16e58832813192
7
- data.tar.gz: 43bf42fcd09e559514a7e16376d0f9b5c2686eb67119daeaaf7620094464acbdb891e0cad2cbd268749653d473bf7292f61b8e0bd39933d400a8dcdcf3f8ab0d
6
+ metadata.gz: 82db598358577adbdaccc0346501e8fd00a0dd3e24e09591b9dc51eb1e8e2d9b75a575e3115604c0916ff27bc5aed46a98df08e83de9e15daa5de7cbc358e3ce
7
+ data.tar.gz: 5f0a78eeb7a3660ff3688b35d6324c9a0c4f39e2724084259b5ae41038299c56794b507fc585f307ef42386a71f67eca5723d3f013053b8522f58c900b499b0a
@@ -0,0 +1,13 @@
1
+ name: omniauth-nitro-id
2
+
3
+ on:
4
+ push:
5
+
6
+ jobs:
7
+ ruby:
8
+ uses: powerhome/power-tools/.github/workflows/_ruby-package.yml@main
9
+ with:
10
+ package: '${{ github.workflow }}'
11
+ ruby: '["2.7", "3.0", "3.1"]'
12
+ rails: '["any"]'
13
+ secrets: inherit
data/.gitignore CHANGED
@@ -4,7 +4,6 @@
4
4
  /Gemfile.lock
5
5
  /_yardoc/
6
6
  /coverage/
7
- /doc/
8
7
  /pkg/
9
8
  /spec/examples.txt
10
9
  /spec/reports/
@@ -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,11 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.1] - 2023-03-06
11
+
12
+ ### Added
13
+
14
+ * Add `omniauth-rails_csrf_protection` dependency. PR [#12](https://github.com/powerhome/omniauth-nitro-id/pull/12)
15
+
16
+ ## [1.1.0] - 2022-12-14
17
+
18
+ ### Added
19
+
20
+ * Add support for `id_token_hint`. PR [#8](https://github.com/powerhome/omniauth-nitro-id/pull/8)
21
+
10
22
  ## [1.0.0] - 2022-12-05
11
23
 
12
24
  ### Added
13
25
 
14
26
  * Initial release
15
27
 
16
- [Unreleased]: https://github.com/powerhome/omniauth-nitro-id/compare/v1.0.0...HEAD
28
+ [Unreleased]: https://github.com/powerhome/omniauth-nitro-id/compare/v1.1.1...HEAD
29
+ [1.1.1]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.1.1
30
+ [1.1.0]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.1.0
17
31
  [1.0.0]: https://github.com/powerhome/omniauth-nitro-id/releases/tag/v1.0.0
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Extensions
4
+ module Discovery
5
+ Module.new do
6
+ # Monkey patch allow HTTP instead of forcing HTTPS for discovery.
7
+
8
+ attr_reader :scheme
9
+
10
+ def initialize(uri)
11
+ @scheme = uri.scheme
12
+ super
13
+ end
14
+
15
+ def endpoint
16
+ URI::Generic.build(scheme: scheme, host: host, port: port, path: path)
17
+ rescue URI::Error => e
18
+ raise SWD::Exception, e.message
19
+ end
20
+
21
+ prepend_features(::OpenIDConnect::Discovery::Provider::Config::Resource)
22
+ end
23
+ end
24
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module NitroId
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.1"
6
6
  end
7
7
  end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth_openid_connect"
4
+ require_relative "../../extensions/discovery"
5
+
6
+ module OmniAuth
7
+ module Strategies
8
+ class BaseStrategy < OmniAuth::Strategies::OpenIDConnect
9
+ def public_key
10
+ @public_key ||= if options.discovery
11
+ config.jwks
12
+ elsif key_or_secret
13
+ key_or_secret
14
+ elsif client_options.jwks_uri
15
+ fetch_key
16
+ end
17
+ end
18
+
19
+ private
20
+
21
+ def fetch_key
22
+ @fetch_key ||= parse_jwk_key(::OpenIDConnect.http_client.get_content(client_options.jwks_uri))
23
+ end
24
+
25
+ def key_or_secret
26
+ @key_or_secret ||=
27
+ case options.client_signing_alg&.to_sym
28
+ when :HS256, :HS384, :HS512
29
+ client_options.secret
30
+ when :RS256, :RS384, :RS512
31
+ parse_key
32
+ end
33
+ end
34
+
35
+ def encoded_post_logout_redirect_uri
36
+ return unless options.post_logout_redirect_uri
37
+
38
+ query = {
39
+ post_logout_redirect_uri: options.post_logout_redirect_uri,
40
+ }
41
+ query = query.merge({ id_token_hint: params["id_token_hint"] }) if params["id_token_hint"]
42
+
43
+ URI.encode_www_form(query)
44
+ end
45
+
46
+ def parse_key
47
+ if options.client_jwk_signing_key
48
+ parse_jwk_key(options.client_jwk_signing_key)
49
+ elsif options.client_x509_signing_key
50
+ parse_x509_key(options.client_x509_signing_key)
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,18 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "omniauth_openid_connect"
3
+ require_relative "base_strategy"
4
4
 
5
5
  module OmniAuth
6
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
7
+ class NitroId < BaseStrategy
8
+ option :name, "nitro_id"
13
9
  option :discovery, true
14
- option :issuer, DEFAULT_ISSUER
15
- option :client_options, host: DEFAULT_HOST
10
+ option :issuer, "https://id.powerhrg.com/"
11
+ option :client_options, host: "id.powerhrg.com"
16
12
  end
17
13
  end
18
14
  end
@@ -1,18 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "omniauth_openid_connect"
3
+ require_relative "base_strategy"
4
4
 
5
5
  module OmniAuth
6
6
  module Strategies
7
- class TempoId < OmniAuth::Strategies::OpenIDConnect
8
- DEFAULT_STRATEGY_NAME = "tempo_id"
9
- DEFAULT_ISSUER = "https://id.streamfinancial.io/"
10
- DEFAULT_HOST = "id.streamfinancial.io"
11
-
12
- option :name, DEFAULT_STRATEGY_NAME
7
+ class TempoId < BaseStrategy
8
+ option :name, "tempo_id"
13
9
  option :discovery, true
14
- option :issuer, DEFAULT_ISSUER
15
- option :client_options, host: DEFAULT_HOST
10
+ option :issuer, "https://id.streamfinancial.io/"
11
+ option :client_options, host: "id.streamfinancial.io"
16
12
  end
17
13
  end
18
14
  end
@@ -18,9 +18,11 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "omniauth_openid_connect", "~> 0.4.0"
21
+ spec.add_dependency "omniauth-rails_csrf_protection", "1.0.1"
21
22
 
22
23
  spec.add_development_dependency "bundler"
23
24
  spec.add_development_dependency "guard-rspec"
25
+ spec.add_development_dependency "license_finder", ">= 7.0"
24
26
  spec.add_development_dependency "net-smtp"
25
27
  spec.add_development_dependency "pry"
26
28
  spec.add_development_dependency "rake", "13.0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-nitro-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
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-05 00:00:00.000000000 Z
11
+ date: 2023-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth_openid_connect
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.4.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-rails_csrf_protection
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.1
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: bundler
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: license_finder
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '7.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '7.0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: net-smtp
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -144,7 +172,7 @@ extensions: []
144
172
  extra_rdoc_files: []
145
173
  files:
146
174
  - ".github/CODEOWNERS"
147
- - ".github/workflows/ci.yml"
175
+ - ".github/workflows/omniauth-nitro-id.yml"
148
176
  - ".gitignore"
149
177
  - ".rspec"
150
178
  - ".rubocop.yml"
@@ -154,11 +182,14 @@ files:
154
182
  - Rakefile
155
183
  - bin/console
156
184
  - bin/setup
185
+ - doc/dependency_decisions.yml
157
186
  - docs/CHANGELOG.md
158
187
  - docs/README.md
188
+ - lib/extensions/discovery.rb
159
189
  - lib/omniauth-nitro-id.rb
160
190
  - lib/omniauth/nitro_id.rb
161
191
  - lib/omniauth/nitro_id/version.rb
192
+ - lib/omniauth/strategies/base_strategy.rb
162
193
  - lib/omniauth/strategies/nitro_id.rb
163
194
  - lib/omniauth/strategies/tempo_id.rb
164
195
  - mkdocs.yml
@@ -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