openid_connect 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -1
- data/VERSION +1 -1
- data/lib/openid_connect/response_object/id_token.rb +16 -3
- data/openid_connect.gemspec +1 -0
- metadata +21 -10
data/Gemfile.lock
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
openid_connect (0.0.
|
4
|
+
openid_connect (0.0.1)
|
5
5
|
activemodel
|
6
6
|
attr_required
|
7
|
+
jwt
|
7
8
|
rack-oauth2 (>= 0.9.0)
|
8
9
|
tzinfo
|
9
10
|
validate_email
|
@@ -23,6 +24,8 @@ GEM
|
|
23
24
|
httpclient (2.2.1)
|
24
25
|
i18n (0.5.0)
|
25
26
|
json (1.5.3)
|
27
|
+
jwt (0.1.3)
|
28
|
+
json (>= 1.2.4)
|
26
29
|
mail (2.3.0)
|
27
30
|
i18n (>= 0.4.0)
|
28
31
|
mime-types (~> 1.16)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
@@ -1,12 +1,25 @@
|
|
1
|
+
require 'jwt'
|
2
|
+
|
1
3
|
module OpenIDConnect
|
2
4
|
class ResponseObject
|
3
5
|
class IdToken < ResponseObject
|
4
|
-
attr_required :iss, :user_id, :aud, :exp
|
6
|
+
attr_required :iss, :user_id, :aud, :exp, :secret
|
5
7
|
attr_optional :iso29115, :nonce, :issued_to
|
6
8
|
|
9
|
+
def as_json
|
10
|
+
(required_attributes + optional_attributes - [:secret]).inject({}) do |hash, key|
|
11
|
+
hash.merge! key => self.send(key)
|
12
|
+
end.delete_if do |key, value|
|
13
|
+
value.nil?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
7
17
|
def to_jwt
|
8
|
-
|
9
|
-
|
18
|
+
JWT.encode as_json, secret
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.from_jwt(jwt, secret)
|
22
|
+
new JWT.decode(jwt, secret).with_indifferent_access.merge(:secret => secret)
|
10
23
|
end
|
11
24
|
end
|
12
25
|
end
|
data/openid_connect.gemspec
CHANGED
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.add_runtime_dependency "validate_url"
|
15
15
|
s.add_runtime_dependency "validate_email"
|
16
16
|
s.add_runtime_dependency "tzinfo"
|
17
|
+
s.add_runtime_dependency "jwt"
|
17
18
|
s.add_runtime_dependency "attr_required"
|
18
19
|
s.add_runtime_dependency "rack-oauth2", ">= 0.9.0"
|
19
20
|
s.add_development_dependency "rake", ">= 0.8"
|
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.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- nov matake
|
@@ -57,7 +57,7 @@ dependencies:
|
|
57
57
|
type: :runtime
|
58
58
|
version_requirements: *id004
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
|
-
name:
|
60
|
+
name: jwt
|
61
61
|
prerelease: false
|
62
62
|
requirement: &id005 !ruby/object:Gem::Requirement
|
63
63
|
none: false
|
@@ -68,49 +68,60 @@ dependencies:
|
|
68
68
|
type: :runtime
|
69
69
|
version_requirements: *id005
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
71
|
+
name: attr_required
|
72
72
|
prerelease: false
|
73
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
76
|
- - ">="
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 0
|
78
|
+
version: "0"
|
79
79
|
type: :runtime
|
80
80
|
version_requirements: *id006
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
82
|
+
name: rack-oauth2
|
83
83
|
prerelease: false
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.9.0
|
90
|
+
type: :runtime
|
91
|
+
version_requirements: *id007
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: rake
|
94
|
+
prerelease: false
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
85
96
|
none: false
|
86
97
|
requirements:
|
87
98
|
- - ">="
|
88
99
|
- !ruby/object:Gem::Version
|
89
100
|
version: "0.8"
|
90
101
|
type: :development
|
91
|
-
version_requirements: *
|
102
|
+
version_requirements: *id008
|
92
103
|
- !ruby/object:Gem::Dependency
|
93
104
|
name: rcov
|
94
105
|
prerelease: false
|
95
|
-
requirement: &
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
96
107
|
none: false
|
97
108
|
requirements:
|
98
109
|
- - ">="
|
99
110
|
- !ruby/object:Gem::Version
|
100
111
|
version: "0.9"
|
101
112
|
type: :development
|
102
|
-
version_requirements: *
|
113
|
+
version_requirements: *id009
|
103
114
|
- !ruby/object:Gem::Dependency
|
104
115
|
name: rspec
|
105
116
|
prerelease: false
|
106
|
-
requirement: &
|
117
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
107
118
|
none: false
|
108
119
|
requirements:
|
109
120
|
- - ">="
|
110
121
|
- !ruby/object:Gem::Version
|
111
122
|
version: "2"
|
112
123
|
type: :development
|
113
|
-
version_requirements: *
|
124
|
+
version_requirements: *id010
|
114
125
|
description: OpenID Connect Server & Client Library
|
115
126
|
email:
|
116
127
|
- nov@matake.jp
|