test_openid_connect 0.1.4 → 0.1.8
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/omniauth/strategies/test_openid_connect.rb +20 -19
- data/test_openid_connect.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '09b5005499845ddd3461e3a447e7be737a8a77a7839899230746aca5fb08960a'
|
4
|
+
data.tar.gz: 4d5e84a10da97a4a73ee30a541cd1b39df1a2af3966dc3a55e278d869b9cb00b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9244a231387717133b04a4c99e37931550641296a27b05545a6d1b9e015f0341fea23818748fb0bd3eaf322d3cc04c520778ce8bf70d17a9280e005bd6d22ac0
|
7
|
+
data.tar.gz: 103e2063c105aa1480be90af4d8ae11308bdc163f92572c211e3231dde74bf1695c99f67797c22d81e6fbeecb6cc47e16c8a5c784b2c5ef147ad96ff0caf531a
|
data/Gemfile.lock
CHANGED
@@ -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,17 +27,17 @@ module OmniAuth
|
|
26
27
|
userinfo_endpoint: nil,
|
27
28
|
auth_scheme: :basic_auth
|
28
29
|
|
29
|
-
def verbose_log(message)
|
30
|
-
|
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 =
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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}")
|
38
|
+
puts "****************"
|
39
|
+
puts discovery_document
|
40
|
+
puts "****************"
|
40
41
|
discovery_params = {
|
41
42
|
authorize_url: "authorization_endpoint",
|
42
43
|
token_url: "token_endpoint",
|
@@ -88,8 +89,8 @@ module OmniAuth
|
|
88
89
|
end
|
89
90
|
|
90
91
|
def callback_phase
|
91
|
-
if request.params["error"] && request.params["error_description"]
|
92
|
-
verbose_log("Error handled, redirecting\n\n#{response.to_yaml}")
|
92
|
+
if request.params["error"] && request.params["error_description"]
|
93
|
+
# verbose_log("Error handled, redirecting\n\n#{response.to_yaml}")
|
93
94
|
return redirect(response)
|
94
95
|
end
|
95
96
|
|
@@ -116,7 +117,7 @@ module OmniAuth
|
|
116
117
|
# token was acquired via a direct server-server connection to the issuer
|
117
118
|
@id_token_info ||= begin
|
118
119
|
decoded = JWT.decode(access_token['id_token'], nil, false).first
|
119
|
-
verbose_log("Loaded JWT\n\n#{decoded.to_yaml}")
|
120
|
+
# verbose_log("Loaded JWT\n\n#{decoded.to_yaml}")
|
120
121
|
JWT::Verify.verify_claims(decoded,
|
121
122
|
verify_iss: true,
|
122
123
|
iss: options[:client_options][:site],
|
@@ -128,7 +129,7 @@ module OmniAuth
|
|
128
129
|
verify_iat: false,
|
129
130
|
verify_jti: false
|
130
131
|
)
|
131
|
-
verbose_log("Verified JWT\n\n#{decoded.to_yaml}")
|
132
|
+
# verbose_log("Verified JWT\n\n#{decoded.to_yaml}")
|
132
133
|
|
133
134
|
decoded
|
134
135
|
end
|
@@ -137,7 +138,7 @@ module OmniAuth
|
|
137
138
|
def userinfo_response
|
138
139
|
@raw_info ||= begin
|
139
140
|
info = access_token.get(options[:client_options][:userinfo_endpoint]).parsed
|
140
|
-
verbose_log("Fetched userinfo response\n\n#{info.to_yaml}")
|
141
|
+
# verbose_log("Fetched userinfo response\n\n#{info.to_yaml}")
|
141
142
|
info
|
142
143
|
end
|
143
144
|
|
@@ -201,7 +202,7 @@ end
|
|
201
202
|
|
202
203
|
OmniAuth.config.add_camelization 'oauth2', 'OpenIDConnect'
|
203
204
|
|
204
|
-
module OmniAuth
|
205
|
+
module ::OmniAuth
|
205
206
|
module Strategies
|
206
207
|
autoload :OpenIDConnect, "lib/omniauth/test_openid_connect.rb"
|
207
208
|
end
|
data/test_openid_connect.gemspec
CHANGED