openid_connect 0.0.16 → 0.0.17

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.
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ rvm:
2
+ - 1.8.7
3
+ - 1.9.2
4
+ - 1.9.3
5
+ - jruby
6
+ - ree
data/Gemfile CHANGED
@@ -1,4 +1,10 @@
1
1
  source "http://rubygems.org"
2
2
 
3
+ group :test do
4
+ platforms :jruby do
5
+ gem 'jruby-openssl', '>= 0.7'
6
+ end
7
+ end
8
+
3
9
  # Specify your gem's dependencies in openid_connect.gemspec
4
10
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- openid_connect (0.0.15)
4
+ openid_connect (0.0.16)
5
5
  activemodel (>= 3)
6
6
  attr_required (>= 0.0.3)
7
7
  json (>= 1.4.3)
@@ -15,19 +15,27 @@ PATH
15
15
  GEM
16
16
  remote: http://rubygems.org/
17
17
  specs:
18
- activemodel (3.0.10)
19
- activesupport (= 3.0.10)
20
- builder (~> 2.1.2)
21
- i18n (~> 0.5.0)
22
- activesupport (3.0.10)
18
+ activemodel (3.1.0)
19
+ activesupport (= 3.1.0)
20
+ bcrypt-ruby (~> 3.0.0)
21
+ builder (~> 3.0.0)
22
+ i18n (~> 0.6)
23
+ activesupport (3.1.0)
24
+ multi_json (~> 1.0)
23
25
  addressable (2.2.6)
24
26
  attr_required (0.0.3)
25
- builder (2.1.2)
27
+ bcrypt-ruby (3.0.0)
28
+ bcrypt-ruby (3.0.0-java)
29
+ bouncy-castle-java (1.5.0146.1)
30
+ builder (3.0.0)
26
31
  crack (0.1.8)
27
- diff-lcs (1.1.2)
32
+ diff-lcs (1.1.3)
28
33
  httpclient (2.2.1)
29
- i18n (0.5.0)
30
- json (1.5.3)
34
+ i18n (0.6.0)
35
+ jruby-openssl (0.7.4)
36
+ bouncy-castle-java
37
+ json (1.5.4)
38
+ json (1.5.4-java)
31
39
  jwt (0.1.3)
32
40
  json (>= 1.2.4)
33
41
  mail (2.3.0)
@@ -35,6 +43,7 @@ GEM
35
43
  mime-types (~> 1.16)
36
44
  treetop (~> 1.4.8)
37
45
  mime-types (1.16)
46
+ multi_json (1.0.3)
38
47
  polyglot (0.3.2)
39
48
  rack (1.3.2)
40
49
  rack-oauth2 (0.9.2)
@@ -46,6 +55,7 @@ GEM
46
55
  rack (>= 1.1)
47
56
  rake (0.9.2)
48
57
  rcov (0.9.10)
58
+ rcov (0.9.10-java)
49
59
  rspec (2.6.0)
50
60
  rspec-core (~> 2.6.0)
51
61
  rspec-expectations (~> 2.6.0)
@@ -69,14 +79,16 @@ GEM
69
79
  mail (>= 2.2.5)
70
80
  validate_url (0.2.0)
71
81
  activemodel (>= 3.0.0)
72
- webmock (1.7.4)
73
- addressable (> 2.2.5, ~> 2.2)
82
+ webmock (1.7.5)
83
+ addressable (~> 2.2, > 2.2.5)
74
84
  crack (>= 0.1.7)
75
85
 
76
86
  PLATFORMS
87
+ java
77
88
  ruby
78
89
 
79
90
  DEPENDENCIES
91
+ jruby-openssl (>= 0.7)
80
92
  openid_connect!
81
93
  rake (>= 0.8)
82
94
  rcov (>= 0.9)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.16
1
+ 0.0.17
@@ -25,8 +25,30 @@ module OpenIDConnect
25
25
  JWT.encode as_json, key, algorithm
26
26
  end
27
27
 
28
- def self.from_jwt(jwt_string, key)
29
- new JWT.decode(jwt_string, key).with_indifferent_access
28
+ class << self
29
+ def from_jwt(jwt_string, key_or_client)
30
+ attributes = case key_or_client
31
+ when Client
32
+ resource_request do
33
+ HTTPClient.new.post key_or_client.check_session_uri, :id_token => jwt_string
34
+ end
35
+ else
36
+ JWT.decode(jwt_string, key).with_indifferent_access
37
+ end
38
+ new attributes
39
+ end
40
+
41
+ def resource_request
42
+ res = yield
43
+ case res.status
44
+ when 200
45
+ JSON.parse(res.body).with_indifferent_access
46
+ when 400
47
+ raise BadRequest.new('Check Session Faild', res)
48
+ else
49
+ raise HttpError.new(res.status, 'Unknown HttpError', res)
50
+ end
51
+ end
30
52
  end
31
53
  end
32
54
  end
data/spec/spec_helper.rb CHANGED
@@ -12,5 +12,5 @@ def public_key
12
12
  end
13
13
 
14
14
  def private_key
15
- @private_key ||= OpenSSL::PKey::RSA.new rsa.export(OpenSSL::Cipher::Cipher.new('aes256'), 'pass-phrase'), 'pass-phrase'
15
+ @private_key ||= OpenSSL::PKey::RSA.new rsa.export(OpenSSL::Cipher::Cipher.new('aes-256-cbc'), 'pass-phrase'), 'pass-phrase'
16
16
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: openid_connect
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.16
5
+ version: 0.0.17
6
6
  platform: ruby
7
7
  authors:
8
8
  - nov matake
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-24 00:00:00 Z
13
+ date: 2011-09-10 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
@@ -167,6 +167,7 @@ extra_rdoc_files: []
167
167
  files:
168
168
  - .gitignore
169
169
  - .rspec
170
+ - .travis.yml
170
171
  - Gemfile
171
172
  - Gemfile.lock
172
173
  - LICENSE
@@ -254,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
255
  requirements: []
255
256
 
256
257
  rubyforge_project:
257
- rubygems_version: 1.8.5
258
+ rubygems_version: 1.8.10
258
259
  signing_key:
259
260
  specification_version: 3
260
261
  summary: OpenID Connect Server & Client Library