signet 0.15.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +11 -0
- data/CHANGELOG.md +63 -45
- data/CODE_OF_CONDUCT.md +43 -0
- data/SECURITY.md +7 -0
- data/lib/signet/oauth_1/client.rb +1 -1
- data/lib/signet/oauth_1/credential.rb +1 -1
- data/lib/signet/oauth_1/server.rb +3 -3
- data/lib/signet/oauth_1/signature_methods/hmac_sha1.rb +1 -1
- data/lib/signet/oauth_1/signature_methods/plaintext.rb +1 -1
- data/lib/signet/oauth_1/signature_methods/rsa_sha1.rb +1 -1
- data/lib/signet/oauth_1.rb +1 -1
- data/lib/signet/oauth_2/client.rb +25 -12
- data/lib/signet/oauth_2.rb +2 -2
- data/lib/signet/version.rb +1 -1
- data/lib/signet.rb +1 -1
- metadata +25 -39
- data/Gemfile +0 -8
- data/Rakefile +0 -112
- data/signet.gemspec +0 -45
- data/spec/signet/oauth_1/client_spec.rb +0 -810
- data/spec/signet/oauth_1/credential_spec.rb +0 -169
- data/spec/signet/oauth_1/server_spec.rb +0 -839
- data/spec/signet/oauth_1/signature_methods/hmac_sha1_spec.rb +0 -61
- data/spec/signet/oauth_1/signature_methods/plaintext_spec.rb +0 -61
- data/spec/signet/oauth_1/signature_methods/rsa_sha1_spec.rb +0 -126
- data/spec/signet/oauth_1_spec.rb +0 -1036
- data/spec/signet/oauth_2/client_spec.rb +0 -1254
- data/spec/signet/oauth_2_spec.rb +0 -194
- data/spec/signet_spec.rb +0 -78
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +0 -10
- data/spec/spec_helper_spec.rb +0 -17
- data/website/index.html +0 -95
@@ -1,61 +0,0 @@
|
|
1
|
-
# Copyright (C) 2010 Google Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
require "spec_helper"
|
15
|
-
require "signet"
|
16
|
-
require "signet/oauth_1"
|
17
|
-
require "signet/oauth_1/signature_methods/hmac_sha1"
|
18
|
-
|
19
|
-
describe Signet::OAuth1::HMACSHA1 do
|
20
|
-
it "should correctly generate a signature" do
|
21
|
-
method = "GET"
|
22
|
-
uri = "http://photos.example.net/photos"
|
23
|
-
parameters = {
|
24
|
-
"oauth_consumer_key" => "dpf43f3p2l4k3l03",
|
25
|
-
"oauth_token" => "nnch734d00sl2jdk",
|
26
|
-
"oauth_signature_method" => "HMAC-SHA1",
|
27
|
-
"oauth_timestamp" => "1191242096",
|
28
|
-
"oauth_nonce" => "kllo9940pd9333jh",
|
29
|
-
"oauth_version" => "1.0",
|
30
|
-
"file" => "vacation.jpg",
|
31
|
-
"size" => "original"
|
32
|
-
}
|
33
|
-
client_credential_secret = "kd94hf93k423kf44"
|
34
|
-
token_credential_secret = "pfkkdhi9sl3r4s00"
|
35
|
-
base_string = Signet::OAuth1.generate_base_string method, uri, parameters
|
36
|
-
expect(Signet::OAuth1::HMACSHA1.generate_signature(
|
37
|
-
base_string, client_credential_secret, token_credential_secret
|
38
|
-
)).to eq "tR3+Ty81lMeYAr/Fid0kMTYa/WM="
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should correctly generate a signature" do
|
42
|
-
method = "GET"
|
43
|
-
uri = "http://photos.example.net/photos"
|
44
|
-
parameters = {
|
45
|
-
"oauth_consumer_key" => "www.example.com",
|
46
|
-
"oauth_token" => "4/QL2GT6b5uznYem1ZGH6v+-9mMvRL",
|
47
|
-
"oauth_signature_method" => "HMAC-SHA1",
|
48
|
-
"oauth_timestamp" => "1191242096",
|
49
|
-
"oauth_nonce" => "kllo9940pd9333jh",
|
50
|
-
"oauth_version" => "1.0",
|
51
|
-
"file" => "vacation.jpg",
|
52
|
-
"size" => "original"
|
53
|
-
}
|
54
|
-
client_credential_secret = "Kv+o2XXL/9RxkQW3lO3QTVlH"
|
55
|
-
token_credential_secret = "QllSuL9eQ5FXFO1Z/HcgL4ON"
|
56
|
-
base_string = Signet::OAuth1.generate_base_string method, uri, parameters
|
57
|
-
expect(Signet::OAuth1::HMACSHA1.generate_signature(
|
58
|
-
base_string, client_credential_secret, token_credential_secret
|
59
|
-
)).to eq "G/nkdbmbpEA+6RD1Sc5uIefhFfQ="
|
60
|
-
end
|
61
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
# Copyright (C) 2010 Google Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
require "spec_helper"
|
15
|
-
require "signet"
|
16
|
-
require "signet/oauth_1"
|
17
|
-
require "signet/oauth_1/signature_methods/plaintext"
|
18
|
-
|
19
|
-
describe Signet::OAuth1::PLAINTEXT do
|
20
|
-
it "should correctly generate a signature" do
|
21
|
-
method = "GET"
|
22
|
-
uri = "http://photos.example.net/photos"
|
23
|
-
parameters = {
|
24
|
-
"oauth_consumer_key" => "dpf43f3p2l4k3l03",
|
25
|
-
"oauth_token" => "nnch734d00sl2jdk",
|
26
|
-
"oauth_signature_method" => "HMAC-SHA1",
|
27
|
-
"oauth_timestamp" => "1191242096",
|
28
|
-
"oauth_nonce" => "kllo9940pd9333jh",
|
29
|
-
"oauth_version" => "1.0",
|
30
|
-
"file" => "vacation.jpg",
|
31
|
-
"size" => "original"
|
32
|
-
}
|
33
|
-
client_credential_secret = "kd94hf93k423kf44"
|
34
|
-
token_credential_secret = "pfkkdhi9sl3r4s00"
|
35
|
-
base_string = Signet::OAuth1.generate_base_string method, uri, parameters
|
36
|
-
expect(Signet::OAuth1::PLAINTEXT.generate_signature(
|
37
|
-
base_string, client_credential_secret, token_credential_secret
|
38
|
-
)).to eq "kd94hf93k423kf44%26pfkkdhi9sl3r4s00"
|
39
|
-
end
|
40
|
-
|
41
|
-
it "should correctly generate a signature" do
|
42
|
-
method = "GET"
|
43
|
-
uri = "http://photos.example.net/photos"
|
44
|
-
parameters = {
|
45
|
-
"oauth_consumer_key" => "www.example.com",
|
46
|
-
"oauth_token" => "4/QL2GT6b5uznYem1ZGH6v+-9mMvRL",
|
47
|
-
"oauth_signature_method" => "HMAC-SHA1",
|
48
|
-
"oauth_timestamp" => "1191242096",
|
49
|
-
"oauth_nonce" => "kllo9940pd9333jh",
|
50
|
-
"oauth_version" => "1.0",
|
51
|
-
"file" => "vacation.jpg",
|
52
|
-
"size" => "original"
|
53
|
-
}
|
54
|
-
client_credential_secret = "Kv+o2XXL/9RxkQW3lO3QTVlH"
|
55
|
-
token_credential_secret = "QllSuL9eQ5FXFO1Z/HcgL4ON"
|
56
|
-
base_string = Signet::OAuth1.generate_base_string method, uri, parameters
|
57
|
-
expect(Signet::OAuth1::PLAINTEXT.generate_signature(
|
58
|
-
base_string, client_credential_secret, token_credential_secret
|
59
|
-
)).to eq "Kv%252Bo2XXL%252F9RxkQW3lO3QTVlH%26QllSuL9eQ5FXFO1Z%252FHcgL4ON"
|
60
|
-
end
|
61
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# Copyright (C) 2010 Google Inc.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
6
|
-
#
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
-
#
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
-
# See the License for the specific language governing permissions and
|
13
|
-
# limitations under the License.
|
14
|
-
require "spec_helper"
|
15
|
-
require "signet"
|
16
|
-
require "signet/oauth_1"
|
17
|
-
require "signet/oauth_1/signature_methods/rsa_sha1"
|
18
|
-
|
19
|
-
describe Signet::OAuth1::RSASHA1 do
|
20
|
-
it "should correctly generate a signature" do
|
21
|
-
method = "GET"
|
22
|
-
uri = "http://term.ie/oauth/example/request_token.php"
|
23
|
-
parameters = {
|
24
|
-
"oauth_consumer_key" => "key",
|
25
|
-
"oauth_signature_method" => "RSA-SHA1",
|
26
|
-
"oauth_timestamp" => "1377815426",
|
27
|
-
"oauth_nonce" => "c3839c47cb204a20e042b11a5cc9f971",
|
28
|
-
"oauth_version" => "1.0"
|
29
|
-
}
|
30
|
-
client_credential_secret = "-----BEGIN PRIVATE KEY-----
|
31
|
-
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALRiMLAh9iimur8V
|
32
|
-
A7qVvdqxevEuUkW4K+2KdMXmnQbG9Aa7k7eBjK1S+0LYmVjPKlJGNXHDGuy5Fw/d
|
33
|
-
7rjVJ0BLB+ubPK8iA/Tw3hLQgXMRRGRXXCn8ikfuQfjUS1uZSatdLB81mydBETlJ
|
34
|
-
hI6GH4twrbDJCR2Bwy/XWXgqgGRzAgMBAAECgYBYWVtleUzavkbrPjy0T5FMou8H
|
35
|
-
X9u2AC2ry8vD/l7cqedtwMPp9k7TubgNFo+NGvKsl2ynyprOZR1xjQ7WgrgVB+mm
|
36
|
-
uScOM/5HVceFuGRDhYTCObE+y1kxRloNYXnx3ei1zbeYLPCHdhxRYW7T0qcynNmw
|
37
|
-
rn05/KO2RLjgQNalsQJBANeA3Q4Nugqy4QBUCEC09SqylT2K9FrrItqL2QKc9v0Z
|
38
|
-
zO2uwllCbg0dwpVuYPYXYvikNHHg+aCWF+VXsb9rpPsCQQDWR9TT4ORdzoj+Nccn
|
39
|
-
qkMsDmzt0EfNaAOwHOmVJ2RVBspPcxt5iN4HI7HNeG6U5YsFBb+/GZbgfBT3kpNG
|
40
|
-
WPTpAkBI+gFhjfJvRw38n3g/+UeAkwMI2TJQS4n8+hid0uus3/zOjDySH3XHCUno
|
41
|
-
cn1xOJAyZODBo47E+67R4jV1/gzbAkEAklJaspRPXP877NssM5nAZMU0/O/NGCZ+
|
42
|
-
3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT898jusgQJAd5Zrr6Q8
|
43
|
-
AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54
|
44
|
-
Lw03eHTNQghS0A==
|
45
|
-
-----END PRIVATE KEY-----"
|
46
|
-
token_credential_secret = "pfkkdhi9sl3r4s00"
|
47
|
-
base_string = Signet::OAuth1.generate_base_string method, uri, parameters
|
48
|
-
|
49
|
-
expect(Signet::OAuth1::RSASHA1.generate_signature(
|
50
|
-
base_string, client_credential_secret, token_credential_secret
|
51
|
-
)).to eq "P72T4RS8dVBneQPJSY71D3iLEjge2tiivxEasPVoaoDldDgPdwpQfhS1q0th19jB3B3+9P6tBWjpWaVPxrNZe3ssBCiwS/EmXZ/6VCJGU3YoDHMtz+0jCd36NjHj5I6TpLVQ8/rtfy6+EzpdUMz7ydnhKXYqJFPOWnNv8HM1W7I="
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe Signet::OAuth1::RSASHA1 do
|
56
|
-
it "should correctly generate a signature" do
|
57
|
-
method = "GET"
|
58
|
-
uri = "http://photos.example.net/photos"
|
59
|
-
parameters = {
|
60
|
-
"oauth_consumer_key" => "dpf43f3p2l4k3l03",
|
61
|
-
"oauth_signature_method" => "RSA-SHA1",
|
62
|
-
"oauth_timestamp" => "1196666512",
|
63
|
-
"oauth_nonce" => "13917289812797014437",
|
64
|
-
"oauth_version" => "1.0",
|
65
|
-
"file" => "vacaction.jpg",
|
66
|
-
"size" => "original"
|
67
|
-
}
|
68
|
-
client_credential_secret = "-----BEGIN PRIVATE KEY-----
|
69
|
-
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALRiMLAh9iimur8V
|
70
|
-
A7qVvdqxevEuUkW4K+2KdMXmnQbG9Aa7k7eBjK1S+0LYmVjPKlJGNXHDGuy5Fw/d
|
71
|
-
7rjVJ0BLB+ubPK8iA/Tw3hLQgXMRRGRXXCn8ikfuQfjUS1uZSatdLB81mydBETlJ
|
72
|
-
hI6GH4twrbDJCR2Bwy/XWXgqgGRzAgMBAAECgYBYWVtleUzavkbrPjy0T5FMou8H
|
73
|
-
X9u2AC2ry8vD/l7cqedtwMPp9k7TubgNFo+NGvKsl2ynyprOZR1xjQ7WgrgVB+mm
|
74
|
-
uScOM/5HVceFuGRDhYTCObE+y1kxRloNYXnx3ei1zbeYLPCHdhxRYW7T0qcynNmw
|
75
|
-
rn05/KO2RLjgQNalsQJBANeA3Q4Nugqy4QBUCEC09SqylT2K9FrrItqL2QKc9v0Z
|
76
|
-
zO2uwllCbg0dwpVuYPYXYvikNHHg+aCWF+VXsb9rpPsCQQDWR9TT4ORdzoj+Nccn
|
77
|
-
qkMsDmzt0EfNaAOwHOmVJ2RVBspPcxt5iN4HI7HNeG6U5YsFBb+/GZbgfBT3kpNG
|
78
|
-
WPTpAkBI+gFhjfJvRw38n3g/+UeAkwMI2TJQS4n8+hid0uus3/zOjDySH3XHCUno
|
79
|
-
cn1xOJAyZODBo47E+67R4jV1/gzbAkEAklJaspRPXP877NssM5nAZMU0/O/NGCZ+
|
80
|
-
3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT898jusgQJAd5Zrr6Q8
|
81
|
-
AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54
|
82
|
-
Lw03eHTNQghS0A==
|
83
|
-
-----END PRIVATE KEY-----"
|
84
|
-
token_credential_secret = "pfkkdhi9sl3r4s00"
|
85
|
-
base_string = Signet::OAuth1.generate_base_string method, uri, parameters
|
86
|
-
|
87
|
-
expect(Signet::OAuth1::RSASHA1.generate_signature(
|
88
|
-
base_string, client_credential_secret, token_credential_secret
|
89
|
-
)).to eq "jvTp/wX1TYtByB1m+Pbyo0lnCOLIsyGCH7wke8AUs3BpnwZJtAuEJkvQL2/9n4s5wUmUl4aCI4BwpraNx4RtEXMe5qg5T1LVTGliMRpKasKsW//e+RinhejgCuzoH26dyF8iY2ZZ/5D1ilgeijhV/vBka5twt399mXwaYdCwFYE="
|
90
|
-
end
|
91
|
-
|
92
|
-
|
93
|
-
it "should correctly generate a signature" do
|
94
|
-
method = "GET"
|
95
|
-
uri = "http://term.ie/oauth/example/access_token.php"
|
96
|
-
parameters = {
|
97
|
-
"oauth_consumer_key" => "key",
|
98
|
-
"oauth_token" => "requestkey",
|
99
|
-
"oauth_signature_method" => "RSA-SHA1",
|
100
|
-
"oauth_timestamp" => "1377815426",
|
101
|
-
"oauth_nonce" => "8ae9ac8192dd3cd7372e0324bf879602",
|
102
|
-
"oauth_version" => "1.0"
|
103
|
-
}
|
104
|
-
client_credential_secret = "-----BEGIN PRIVATE KEY-----
|
105
|
-
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALRiMLAh9iimur8V
|
106
|
-
A7qVvdqxevEuUkW4K+2KdMXmnQbG9Aa7k7eBjK1S+0LYmVjPKlJGNXHDGuy5Fw/d
|
107
|
-
7rjVJ0BLB+ubPK8iA/Tw3hLQgXMRRGRXXCn8ikfuQfjUS1uZSatdLB81mydBETlJ
|
108
|
-
hI6GH4twrbDJCR2Bwy/XWXgqgGRzAgMBAAECgYBYWVtleUzavkbrPjy0T5FMou8H
|
109
|
-
X9u2AC2ry8vD/l7cqedtwMPp9k7TubgNFo+NGvKsl2ynyprOZR1xjQ7WgrgVB+mm
|
110
|
-
uScOM/5HVceFuGRDhYTCObE+y1kxRloNYXnx3ei1zbeYLPCHdhxRYW7T0qcynNmw
|
111
|
-
rn05/KO2RLjgQNalsQJBANeA3Q4Nugqy4QBUCEC09SqylT2K9FrrItqL2QKc9v0Z
|
112
|
-
zO2uwllCbg0dwpVuYPYXYvikNHHg+aCWF+VXsb9rpPsCQQDWR9TT4ORdzoj+Nccn
|
113
|
-
qkMsDmzt0EfNaAOwHOmVJ2RVBspPcxt5iN4HI7HNeG6U5YsFBb+/GZbgfBT3kpNG
|
114
|
-
WPTpAkBI+gFhjfJvRw38n3g/+UeAkwMI2TJQS4n8+hid0uus3/zOjDySH3XHCUno
|
115
|
-
cn1xOJAyZODBo47E+67R4jV1/gzbAkEAklJaspRPXP877NssM5nAZMU0/O/NGCZ+
|
116
|
-
3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT898jusgQJAd5Zrr6Q8
|
117
|
-
AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54
|
118
|
-
Lw03eHTNQghS0A==
|
119
|
-
-----END PRIVATE KEY-----"
|
120
|
-
token_credential_secret = "QllSuL9eQ5FXFO1Z/HcgL4ON"
|
121
|
-
base_string = Signet::OAuth1.generate_base_string method, uri, parameters
|
122
|
-
expect(Signet::OAuth1::RSASHA1.generate_signature(
|
123
|
-
base_string, client_credential_secret, token_credential_secret
|
124
|
-
)).to eq "Q1O7Ovi0jdacl/OTJoH3MAyOO/9H/tTXmoJzP/YqiKEJ+/wfShXo1RXX0xmlcjDR1XYxB1RMgHkFWQYYwz1qGCUhkXlH1c/to2qxPksptfPHRe7PJTxRClrdqLFOlhN7w2kO7tHVCeEp8IJIKON9q7cdXroTP7ctPPS+Q883SS0="
|
125
|
-
end
|
126
|
-
end
|