test_openid_connect 0.1.11 → 0.1.15

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: 6c298e7c4c5f7cfa382fa4e9a5bf7654d91037d9b9c4b9094368faec12f9b76e
4
- data.tar.gz: 67afbbc14da04967034572ee9f301691bc5c1543ae81be018d5c0eec5624f6e4
3
+ metadata.gz: 5a79df8bc165b72ca1df75aa05244d8e182962f2f053cf851e9ee7d59dc29fe7
4
+ data.tar.gz: 0a7d019baa4d6363848d7ef49af225001714c245b73f27f69373fffc039d40c6
5
5
  SHA512:
6
- metadata.gz: 1a75faa031d9eaa20d5408c91d143f92960728532c53205d4a4cbede647a22cae3f04fc441020b011d0b6155cfa3bcaf7cd86bdbf7169b4a9daebbf64b5ab97c
7
- data.tar.gz: a926e44a9bd047441e16fe372c938a4066946316b548fbbe63f862626933b6efc7b4011b5452577471f5452453178fc6fea540a11480a4e22398a077a653ea73
6
+ metadata.gz: d129e6865397c8fb68843995c9ccc63855f72a71fc6abb312546ecfd972f847bb3077b6521d7c6d8ae9a7312e4e7888f17e506e5b1ab5dd189507f45323d693f
7
+ data.tar.gz: 749ddecb54b51885b4d465d6bbcaf1100b85de4f2cc51d07f16e5bd9ffd1483d0543b44c0adbf4039130acc508e7c4258f2502fd07a7f04672d2192e51484129
@@ -3,12 +3,12 @@
3
3
  require 'omniauth-oauth2'
4
4
 
5
5
  module ::OmniAuth
6
- module OpenIDConnect
6
+ module Oauth2
7
7
  class DiscoveryError < Error; end
8
8
  end
9
9
 
10
10
  module Strategies
11
- class OpenIDConnect < OmniAuth::Strategies::OAuth2
11
+ class Oauth2 < OmniAuth::Strategies::OAuth2
12
12
  puts "*/*/*/*/*/*/*/*/*/*/*/*/*/*/"
13
13
  option :scope, "openid"
14
14
  option :discovery, true
@@ -46,7 +46,7 @@ module ::OmniAuth
46
46
 
47
47
  discovery_params.each do |internal_key, external_key|
48
48
  val = discovery_document[external_key].to_s
49
- raise ::OmniAuth::OpenIDConnect::DiscoveryError.new("missing discovery parameter #{external_key}") if val.nil? || val.empty?
49
+ raise ::OmniAuth::Oauth2::DiscoveryError.new("missing discovery parameter #{external_key}") if val.nil? || val.empty?
50
50
  options[:client_options][internal_key] = val
51
51
  end
52
52
 
@@ -57,7 +57,7 @@ module ::OmniAuth
57
57
  def request_phase
58
58
  begin
59
59
  discover!
60
- rescue ::OmniAuth::OpenIDConnect::DiscoveryError => e
60
+ rescue ::OmniAuth::Oauth2::DiscoveryError => e
61
61
  fail!(:openid_connect_discovery_error, e)
62
62
  end
63
63
 
@@ -92,28 +92,28 @@ module ::OmniAuth
92
92
  super.merge(params)
93
93
  end
94
94
 
95
- # def callback_phase
96
- # if request.params["error"] && request.params["error_description"]
97
- # # verbose_log("Error handled, redirecting\n\n#{response.to_yaml}")
98
- # return redirect(response)
99
- # end
100
-
101
- # begin
102
- # discover! if options[:discovery]
103
-
104
- # oauth2_callback_phase = super
105
- # return oauth2_callback_phase if env['omniauth.error']
106
-
107
- # if id_token_info["nonce"].nil? || id_token_info["nonce"].empty? || id_token_info["nonce"] != session.delete("omniauth.nonce")
108
- # return fail!(:csrf_detected, CallbackError.new(:csrf_detected, "CSRF detected"))
109
- # end
110
- # oauth2_callback_phase
111
- # rescue ::OmniAuth::OpenIDConnect::DiscoveryError => e
112
- # fail!(:openid_connect_discovery_error, e)
113
- # rescue JWT::DecodeError => e
114
- # fail!(:jwt_decode_failed, e)
115
- # end
116
- # end
95
+ def callback_phase
96
+ if request.params["error"] && request.params["error_description"]
97
+ # verbose_log("Error handled, redirecting\n\n#{response.to_yaml}")
98
+ return redirect(response)
99
+ end
100
+
101
+ begin
102
+ discover!
103
+
104
+ oauth2_callback_phase = super
105
+ return oauth2_callback_phase if env['omniauth.error']
106
+
107
+ if id_token_info["nonce"].nil? || id_token_info["nonce"].empty? || id_token_info["nonce"] != session.delete("omniauth.nonce")
108
+ return fail!(:csrf_detected, CallbackError.new(:csrf_detected, "CSRF detected"))
109
+ end
110
+ oauth2_callback_phase
111
+ rescue ::OmniAuth::Oauth2::DiscoveryError => e
112
+ fail!(:openid_connect_discovery_error, e)
113
+ rescue JWT::DecodeError => e
114
+ fail!(:jwt_decode_failed, e)
115
+ end
116
+ end
117
117
 
118
118
  def id_token_info
119
119
  # Verify the claims in the JWT
@@ -204,10 +204,10 @@ module ::OmniAuth
204
204
  end
205
205
  end
206
206
 
207
- OmniAuth.config.add_camelization 'oauth2', 'OpenIDConnect'
207
+ OmniAuth.config.add_camelization 'oauth2', 'Oauth2'
208
208
 
209
- module ::OmniAuth
210
- module Strategies
211
- autoload :OpenIDConnect, "lib/omniauth/test_openid_connect.rb"
212
- end
213
- end
209
+ # module ::OmniAuth
210
+ # module Strategies
211
+ # autoload :Oauth2, "lib/omniauth/test_openid_connect.rb"
212
+ # end
213
+ # 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.11"
5
+ spec.version = "0.1.15"
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.11
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burak Akça