openid_connect 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,13 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openid_connect (0.0.19)
4
+ openid_connect (0.0.20)
5
5
  activemodel (>= 3)
6
6
  attr_required (>= 0.0.3)
7
7
  json (>= 1.4.3)
8
8
  jwt (>= 0.1.3)
9
9
  rack-oauth2 (>= 0.9.4)
10
- swd (>= 0.0.4)
10
+ swd (>= 0.0.6)
11
11
  tzinfo
12
12
  validate_email
13
13
  validate_url
@@ -64,7 +64,7 @@ GEM
64
64
  rspec-expectations (2.6.0)
65
65
  diff-lcs (~> 1.1.2)
66
66
  rspec-mocks (2.6.0)
67
- swd (0.0.4)
67
+ swd (0.0.6)
68
68
  activesupport (>= 3)
69
69
  attr_required (>= 0.0.3)
70
70
  httpclient (>= 2.2.1)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.20
1
+ 0.0.21
@@ -1,9 +1,14 @@
1
1
  require 'json'
2
2
  require 'logger'
3
+ require 'swd'
3
4
  require 'rack/oauth2'
4
5
  require 'rack/oauth2/server/id_token_response'
5
6
 
6
7
  module OpenIDConnect
8
+ VERSION = ::File.read(
9
+ ::File.join(::File.dirname(__FILE__), '../VERSION')
10
+ )
11
+
7
12
  def self.logger
8
13
  @@logger
9
14
  end
@@ -17,19 +22,23 @@ module OpenIDConnect
17
22
  @@debugging
18
23
  end
19
24
  def self.debugging=(boolean)
25
+ SWD.debugging = boolean
20
26
  Rack::OAuth2.debugging = boolean
21
27
  @@debugging = boolean
22
28
  end
23
29
  def self.debug!
24
- Rack::OAuth2.debugging = true
30
+ SWD.debug!
31
+ Rack::OAuth2.debug!
25
32
  self.debugging = true
26
33
  end
27
34
  def self.debug(&block)
35
+ swd_original = SWD.debugging?
28
36
  rack_oauth2_original = Rack::OAuth2.debugging?
29
37
  original = self.debugging?
30
38
  debug!
31
39
  yield
32
40
  ensure
41
+ SWD.debugging = swd_original
33
42
  Rack::OAuth2.debugging = rack_oauth2_original
34
43
  self.debugging = original
35
44
  end
@@ -1,5 +1,3 @@
1
- require 'swd'
2
-
3
1
  module OpenIDConnect
4
2
  module Discovery
5
3
  class Principal
@@ -29,8 +29,6 @@ module OpenIDConnect
29
29
  def from_jwt(jwt_string, key_or_client)
30
30
  attributes = case key_or_client
31
31
  when Client
32
- http_client = HTTPClient.new
33
- http_client.request_filter << Debugger::RequestFilter
34
32
  resource_request do
35
33
  http_client.post key_or_client.check_session_uri, :id_token => jwt_string
36
34
  end
@@ -51,6 +49,16 @@ module OpenIDConnect
51
49
  raise HttpError.new(res.status, 'Unknown HttpError', res)
52
50
  end
53
51
  end
52
+
53
+ private
54
+
55
+ def http_client
56
+ _http_client_ = HTTPClient.new(
57
+ :agent_name => "OpenIDConnect (#{VERSION})"
58
+ )
59
+ _http_client_.request_filter << Debugger::RequestFilter.new if OpenIDConnect.debugging?
60
+ _http_client_
61
+ end
54
62
  end
55
63
  end
56
64
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.add_runtime_dependency "validate_url"
18
18
  s.add_runtime_dependency "validate_email"
19
19
  s.add_runtime_dependency "jwt", ">= 0.1.3"
20
- s.add_runtime_dependency "swd", ">= 0.0.4"
20
+ s.add_runtime_dependency "swd", ">= 0.0.6"
21
21
  s.add_runtime_dependency "rack-oauth2", ">= 0.9.4"
22
22
  s.add_development_dependency "rake", ">= 0.8"
23
23
  s.add_development_dependency "rcov", ">= 0.9"
@@ -1,7 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe OpenIDConnect do
4
- subject { OpenIDConnect }
5
4
  after { OpenIDConnect.debugging = false }
6
5
 
7
6
  its(:logger) { should be_a Logger }
@@ -15,20 +14,25 @@ describe OpenIDConnect do
15
14
  describe '.debug' do
16
15
  it 'should enable debugging within given block' do
17
16
  OpenIDConnect.debug do
17
+ SWD.debugging?.should be_true
18
18
  Rack::OAuth2.debugging?.should be_true
19
19
  OpenIDConnect.debugging?.should be_true
20
20
  end
21
+ SWD.debugging?.should be_false
21
22
  Rack::OAuth2.debugging?.should be_false
22
23
  OpenIDConnect.debugging?.should be_false
23
24
  end
24
25
 
25
26
  it 'should not force disable debugging' do
27
+ SWD.debug!
26
28
  Rack::OAuth2.debug!
27
29
  OpenIDConnect.debug!
28
30
  OpenIDConnect.debug do
31
+ SWD.debugging?.should be_true
29
32
  Rack::OAuth2.debugging?.should be_true
30
33
  OpenIDConnect.debugging?.should be_true
31
34
  end
35
+ SWD.debugging?.should be_true
32
36
  Rack::OAuth2.debugging?.should be_true
33
37
  OpenIDConnect.debugging?.should be_true
34
38
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openid_connect
3
3
  version: !ruby/object:Gem::Version
4
- hash: 55
4
+ hash: 53
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 20
10
- version: 0.0.20
9
+ - 21
10
+ version: 0.0.21
11
11
  platform: ruby
12
12
  authors:
13
13
  - nov matake
@@ -129,12 +129,12 @@ dependencies:
129
129
  requirements:
130
130
  - - ">="
131
131
  - !ruby/object:Gem::Version
132
- hash: 23
132
+ hash: 19
133
133
  segments:
134
134
  - 0
135
135
  - 0
136
- - 4
137
- version: 0.0.4
136
+ - 6
137
+ version: 0.0.6
138
138
  type: :runtime
139
139
  version_requirements: *id008
140
140
  - !ruby/object:Gem::Dependency