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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c4d436a5796e1e654b4414fb7fc396f03e65eb51fdef3f901c4753b0110a086
4
- data.tar.gz: 9151c4c2780f12b54389483373873e9866ac6a92df78280f34dd32b40ba2db97
3
+ metadata.gz: '09b5005499845ddd3461e3a447e7be737a8a77a7839899230746aca5fb08960a'
4
+ data.tar.gz: 4d5e84a10da97a4a73ee30a541cd1b39df1a2af3966dc3a55e278d869b9cb00b
5
5
  SHA512:
6
- metadata.gz: 45381da01260ee8385c1b87cf5563f022e54e23cde72f2d4c9b0fe6e5c65ae4f18151682bf1b544c78426da1c082bd8b9e4ee7223d1e1a74417069c9865a9e8f
7
- data.tar.gz: b0667800c9adab7304ec3c2a1d8d5ab63a494aff43926a563033057fc53e64180ee997135872694d691905d12303e87e8d194c0274c73b91b1a8fdb9b89f41d0
6
+ metadata.gz: 9244a231387717133b04a4c99e37931550641296a27b05545a6d1b9e015f0341fea23818748fb0bd3eaf322d3cc04c520778ce8bf70d17a9280e005bd6d22ac0
7
+ data.tar.gz: 103e2063c105aa1480be90af4d8ae11308bdc163f92572c211e3231dde74bf1695c99f67797c22d81e6fbeecb6cc47e16c8a5c784b2c5ef147ad96ff0caf531a
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,17 +27,17 @@ 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}")
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"] && response = options.error_handler.call(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
@@ -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.4"
5
+ spec.version = "0.1.8"
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.4
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burak Akça