test_openid_connect 0.1.3 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3abf2cc16fdf8767b3dca1fce6c552ac26b316458dfab1181bd82609201ce061
4
- data.tar.gz: f485c20851c173aea54eaf82daeee84c0fa1b412ba24d890ea0c136bdb645f7c
3
+ metadata.gz: a9411261ba29e4fcbf9f47bd7f38c7a66cbb3089496837d7b3686d1d1ab1ea2d
4
+ data.tar.gz: 49ee1c3f569623cb7ea231899e0d23d15854370dbccf690f6d55a07f3e6ecfef
5
5
  SHA512:
6
- metadata.gz: d907236275d056f38e8de41a24d20c3b07223d9d8f5f4ffecdea2a9c79fb2ad6a28c4dd2f9a4b8935f84a78f10ba9d839ab6eb61669279e41bdd8e9c58bb8a14
7
- data.tar.gz: a3814bb9a282d57ac64874701be66aa9f3e5c38fbc64f7cb4dd766e29bbaa8a7a588609fcadbc6202c0bceaba4d4f58eb48166835a2b6596138cc2a733acb98e
6
+ metadata.gz: a3ad45715e4aabf3241f8068a6b3850e10b223917a2dcb2ca36cbb404c5dad340af35b274b9d355d01188fa199c71a183e7768e2a35fddc2cd2356ef84c77313
7
+ data.tar.gz: 3cb9fb4b65ab2e07b8e1554ad7429925e1493a2dc26f4a9bcd70dcdb0962370f77dac82b231b5863bd80f10c26ee7bf8b316bc21f1f75530f43262b29b0c01a1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- test_openid_connect (0.1.0)
4
+ test_openid_connect (0.1.6)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,19 +2,20 @@
2
2
 
3
3
  require 'omniauth-oauth2'
4
4
 
5
- module OmniAuth
5
+ module ::OmniAuth
6
6
  module OpenIDConnect
7
7
  class DiscoveryError < Error; end
8
8
  end
9
9
 
10
10
  module Strategies
11
11
  class OpenIDConnect < OmniAuth::Strategies::OAuth2
12
+ puts "*/*/*/*/*/*/*/*/*/*/*/*/*/*/"
12
13
  option :scope, "openid"
13
14
  option :discovery, true
14
15
  option :use_userinfo, true
15
- option :cache, lambda { |key, &blk| blk.call } # Default no-op cache
16
- option :error_handler, lambda { |error, message| nil } # Default no-op handler
17
- option :verbose_logger, lambda { |message| nil } # Default no-op handler
16
+ # option :cache, lambda { |key, &blk| blk.call } # Default no-op cache
17
+ # option :error_handler, lambda { |error, message| nil } # Default no-op handler
18
+ # option :verbose_logger, lambda { |message| nil } # Default no-op handler
18
19
  option :passthrough_authorize_options, [:p]
19
20
  option :passthrough_token_options, [:p]
20
21
 
@@ -26,16 +27,14 @@ module OmniAuth
26
27
  userinfo_endpoint: nil,
27
28
  auth_scheme: :basic_auth
28
29
 
29
- def verbose_log(message)
30
- options.verbose_logger.call(message)
31
- end
30
+ # def verbose_log(message)
31
+ # options.verbose_logger.call(message)
32
+ # end
32
33
 
33
34
  def discover!
34
- verbose_log("Fetching discovery document from #{options[:client_options][:discovery_document]}")
35
- discovery_document = options.cache.call("openid_discovery_#{options[:client_options][:discovery_document]}") do
36
- client.request(:get, options[:client_options][:discovery_document], parse: :json).parsed
37
- end
38
- verbose_log("Discovery document loaded\n\n#{discovery_document.to_yaml}")
35
+ # verbose_log("Fetching discovery document from #{options[:client_options][:discovery_document]}")
36
+ discovery_document = client.request(:get, options[:client_options][:discovery_document], parse: :json).parsed
37
+ # verbose_log("Discovery document loaded\n\n#{discovery_document.to_yaml}")
39
38
 
40
39
  discovery_params = {
41
40
  authorize_url: "authorization_endpoint",
@@ -88,8 +87,8 @@ module OmniAuth
88
87
  end
89
88
 
90
89
  def callback_phase
91
- if request.params["error"] && request.params["error_description"] && response = options.error_handler.call(request.params["error"], request.params["error_description"])
92
- verbose_log("Error handled, redirecting\n\n#{response.to_yaml}")
90
+ if request.params["error"] && request.params["error_description"]
91
+ # verbose_log("Error handled, redirecting\n\n#{response.to_yaml}")
93
92
  return redirect(response)
94
93
  end
95
94
 
@@ -116,7 +115,7 @@ module OmniAuth
116
115
  # token was acquired via a direct server-server connection to the issuer
117
116
  @id_token_info ||= begin
118
117
  decoded = JWT.decode(access_token['id_token'], nil, false).first
119
- verbose_log("Loaded JWT\n\n#{decoded.to_yaml}")
118
+ # verbose_log("Loaded JWT\n\n#{decoded.to_yaml}")
120
119
  JWT::Verify.verify_claims(decoded,
121
120
  verify_iss: true,
122
121
  iss: options[:client_options][:site],
@@ -128,7 +127,7 @@ module OmniAuth
128
127
  verify_iat: false,
129
128
  verify_jti: false
130
129
  )
131
- verbose_log("Verified JWT\n\n#{decoded.to_yaml}")
130
+ # verbose_log("Verified JWT\n\n#{decoded.to_yaml}")
132
131
 
133
132
  decoded
134
133
  end
@@ -137,7 +136,7 @@ module OmniAuth
137
136
  def userinfo_response
138
137
  @raw_info ||= begin
139
138
  info = access_token.get(options[:client_options][:userinfo_endpoint]).parsed
140
- verbose_log("Fetched userinfo response\n\n#{info.to_yaml}")
139
+ # verbose_log("Fetched userinfo response\n\n#{info.to_yaml}")
141
140
  info
142
141
  end
143
142
 
@@ -199,9 +198,9 @@ module OmniAuth
199
198
  end
200
199
  end
201
200
 
202
- OmniAuth.config.add_camelization 'test_openid_connect', 'OpenIDConnect'
201
+ OmniAuth.config.add_camelization 'oauth2', 'OpenIDConnect'
203
202
 
204
- module OmniAuth
203
+ module ::OmniAuth
205
204
  module Strategies
206
205
  autoload :OpenIDConnect, "lib/omniauth/test_openid_connect.rb"
207
206
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "test_openid_connect"
5
- spec.version = "0.1.3"
5
+ spec.version = "0.1.7"
6
6
  spec.required_ruby_version = ">= 2.4.0"
7
7
  spec.authors = ["Burak Akça"]
8
8
  spec.email = ["burak.akca834@gmail.com"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burak Akça