opentoken 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +5 -0
- data/lib/opentoken.rb +5 -2
- data/lib/opentoken/version.rb +1 -1
- data/test/test_opentoken.rb +17 -0
- metadata +62 -96
data/.rvmrc
ADDED
data/lib/opentoken.rb
CHANGED
@@ -39,7 +39,7 @@ module OpenToken
|
|
39
39
|
mac << "0x01".hex.chr # OTK version
|
40
40
|
mac << cipher.suite.chr
|
41
41
|
mac << iv
|
42
|
-
mac << serialized
|
42
|
+
mac << force_encoding(serialized, 'BINARY')
|
43
43
|
hash = OpenSSL::HMAC.digest(OpenToken::PasswordKeyGenerator::SHA1_DIGEST, key, mac.join)
|
44
44
|
|
45
45
|
token_string = ""
|
@@ -114,7 +114,7 @@ module OpenToken
|
|
114
114
|
|
115
115
|
unescaped_payload = CGI::unescapeHTML(unparsed_payload)
|
116
116
|
puts 'UNESCAPED PAYLOAD', unescaped_payload if debug?
|
117
|
-
token = OpenToken::KeyValueSerializer.deserialize unescaped_payload
|
117
|
+
token = OpenToken::KeyValueSerializer.deserialize force_encoding(unescaped_payload, 'UTF-8')
|
118
118
|
puts token.inspect if debug?
|
119
119
|
token.validate!
|
120
120
|
token
|
@@ -171,6 +171,9 @@ module OpenToken
|
|
171
171
|
index += 1
|
172
172
|
end
|
173
173
|
end
|
174
|
+
def force_encoding(string, encoding)
|
175
|
+
string.respond_to?(:force_encoding) ? string.force_encoding(encoding) : string
|
176
|
+
end
|
174
177
|
end
|
175
178
|
end
|
176
179
|
|
data/lib/opentoken/version.rb
CHANGED
data/test/test_opentoken.rb
CHANGED
@@ -85,4 +85,21 @@ class TestOpentoken < Test::Unit::TestCase
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
88
|
+
|
89
|
+
context "encoding token with utf-8 values" do
|
90
|
+
setup do
|
91
|
+
OpenToken.password = "Password1"
|
92
|
+
end
|
93
|
+
context "with aes-128-cbc and subject attribute" do
|
94
|
+
setup do
|
95
|
+
@subject = OpenToken.send(:force_encoding, "Andr\xC3\xA9", 'UTF-8')
|
96
|
+
@attributesIn = { "subject" => @subject, "email" => "john@example.com"}
|
97
|
+
@token = OpenToken.encode @attributesIn, OpenToken::Cipher::AES_128_CBC
|
98
|
+
end
|
99
|
+
should "be decodable" do
|
100
|
+
@attributesOut = OpenToken.decode @token
|
101
|
+
assert_equal @attributesIn, @attributesOut
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
88
105
|
end
|
metadata
CHANGED
@@ -1,112 +1,81 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: opentoken
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 1
|
10
|
-
version: 1.2.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Ryan Sonnek
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-02-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: activesupport
|
22
|
-
|
23
|
-
version_requirements: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2174041000 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 1
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 0
|
32
|
-
- 3
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
33
21
|
version: 3.0.3
|
34
|
-
requirement: *id001
|
35
22
|
type: :runtime
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: i18n
|
38
23
|
prerelease: false
|
39
|
-
version_requirements:
|
24
|
+
version_requirements: *2174041000
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: i18n
|
27
|
+
requirement: &2174040480 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
48
|
-
requirement: *id002
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
49
33
|
type: :runtime
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: shoulda
|
52
34
|
prerelease: false
|
53
|
-
version_requirements:
|
35
|
+
version_requirements: *2174040480
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: shoulda
|
38
|
+
requirement: &2174040000 !ruby/object:Gem::Requirement
|
54
39
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
hash: 37
|
59
|
-
segments:
|
60
|
-
- 2
|
61
|
-
- 11
|
62
|
-
- 3
|
40
|
+
requirements:
|
41
|
+
- - =
|
42
|
+
- !ruby/object:Gem::Version
|
63
43
|
version: 2.11.3
|
64
|
-
requirement: *id003
|
65
44
|
type: :development
|
66
|
-
- !ruby/object:Gem::Dependency
|
67
|
-
name: timecop
|
68
45
|
prerelease: false
|
69
|
-
version_requirements:
|
46
|
+
version_requirements: *2174040000
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: timecop
|
49
|
+
requirement: &2174039520 !ruby/object:Gem::Requirement
|
70
50
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
hash: 25
|
75
|
-
segments:
|
76
|
-
- 0
|
77
|
-
- 3
|
78
|
-
- 5
|
51
|
+
requirements:
|
52
|
+
- - =
|
53
|
+
- !ruby/object:Gem::Version
|
79
54
|
version: 0.3.5
|
80
|
-
requirement: *id004
|
81
55
|
type: :development
|
82
|
-
- !ruby/object:Gem::Dependency
|
83
|
-
name: rake
|
84
56
|
prerelease: false
|
85
|
-
version_requirements:
|
57
|
+
version_requirements: *2174039520
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: &2174039040 !ruby/object:Gem::Requirement
|
86
61
|
none: false
|
87
|
-
requirements:
|
88
|
-
- -
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
hash: 63
|
91
|
-
segments:
|
92
|
-
- 0
|
93
|
-
- 9
|
94
|
-
- 2
|
62
|
+
requirements:
|
63
|
+
- - =
|
64
|
+
- !ruby/object:Gem::Version
|
95
65
|
version: 0.9.2
|
96
|
-
requirement: *id005
|
97
66
|
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2174039040
|
98
69
|
description: parse opentoken properties passed for Single Signon requests
|
99
|
-
email:
|
70
|
+
email:
|
100
71
|
- ryan@socialcast.com
|
101
72
|
executables: []
|
102
|
-
|
103
73
|
extensions: []
|
104
|
-
|
105
74
|
extra_rdoc_files: []
|
106
|
-
|
107
|
-
files:
|
75
|
+
files:
|
108
76
|
- .document
|
109
77
|
- .gitignore
|
78
|
+
- .rvmrc
|
110
79
|
- CONTRIBUTORS.txt
|
111
80
|
- Gemfile
|
112
81
|
- LICENSE.txt
|
@@ -123,37 +92,34 @@ files:
|
|
123
92
|
- test/test_opentoken.rb
|
124
93
|
homepage: http://github.com/socialcast/opentoken
|
125
94
|
licenses: []
|
126
|
-
|
127
95
|
post_install_message:
|
128
96
|
rdoc_options: []
|
129
|
-
|
130
|
-
require_paths:
|
97
|
+
require_paths:
|
131
98
|
- lib
|
132
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
100
|
none: false
|
134
|
-
requirements:
|
135
|
-
- -
|
136
|
-
- !ruby/object:Gem::Version
|
137
|
-
|
138
|
-
segments:
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
segments:
|
139
106
|
- 0
|
140
|
-
|
141
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
hash: -3830787979922973573
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
142
109
|
none: false
|
143
|
-
requirements:
|
144
|
-
- -
|
145
|
-
- !ruby/object:Gem::Version
|
146
|
-
|
147
|
-
segments:
|
110
|
+
requirements:
|
111
|
+
- - ! '>='
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
segments:
|
148
115
|
- 0
|
149
|
-
|
116
|
+
hash: -3830787979922973573
|
150
117
|
requirements: []
|
151
|
-
|
152
118
|
rubyforge_project: opentoken
|
153
|
-
rubygems_version: 1.8.
|
119
|
+
rubygems_version: 1.8.13
|
154
120
|
signing_key:
|
155
121
|
specification_version: 3
|
156
122
|
summary: ruby implementation of the opentoken specification
|
157
|
-
test_files:
|
123
|
+
test_files:
|
158
124
|
- test/helper.rb
|
159
125
|
- test/test_opentoken.rb
|