oauthenticator 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +23 -0
- data/README.md +9 -4
- data/Rakefile.rb +2 -1
- data/lib/oauthenticator/config_methods.rb +4 -3
- data/lib/oauthenticator/faraday_signer.rb +4 -3
- data/lib/oauthenticator/parse_authorization.rb +4 -4
- data/lib/oauthenticator/rack_authenticator.rb +3 -2
- data/lib/oauthenticator/rack_test_signer.rb +1 -0
- data/lib/oauthenticator/signable_request.rb +54 -2
- data/lib/oauthenticator/signed_request.rb +2 -2
- data/lib/oauthenticator/version.rb +1 -1
- data/test/config_methods_test.rb +3 -3
- data/test/faraday_signer_test.rb +17 -0
- data/test/rack_authenticator_test.rb +4 -1
- data/test/signable_request_test.rb +26 -3
- metadata +46 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 98e9bd15e6f01dd9896f6d499d3141f56614f93fd13fc9ac000c24796e74c5c2
|
4
|
+
data.tar.gz: 5479b9b613a4a0b77758a325a007e258dbeaa9b9aaa430414223737870abb7b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6920168511a6582d34d4f4201e9c9d2c24adce1968389dc72e8d33878477b2a78d378aa4a140a817790ef41a8983c8ab620c631c83e6790333d7a7a3df41beff
|
7
|
+
data.tar.gz: 4260c1569b7a47d3bc1e9c3e40fb559cda77f5f1e888edeef1cb5943a927afd600f99348d0e6483a0de53005ad14707cd5e307e5509e41a138590c8190f9456f
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
# 1.4.0
|
2
|
+
|
3
|
+
- support signature methods HMAC-SHA256, HMAC-SHA512
|
4
|
+
|
5
|
+
# 1.3.5
|
6
|
+
|
7
|
+
- relax faraday and rack gem dependency constraints
|
8
|
+
|
9
|
+
# 1.3.4
|
10
|
+
|
11
|
+
- relax json gem dependency constraint
|
12
|
+
|
13
|
+
# 1.3.3
|
14
|
+
|
15
|
+
- env["oauth.signed_request"] contains the signed request. this makes any helper methods from the implemented
|
16
|
+
config methods module available and helps avoid code duplication (and sometimes duplicated db queries -
|
17
|
+
depending on implementation)
|
18
|
+
- fix irrelevant warning with Hash#reject called on hash with a default proc
|
19
|
+
|
20
|
+
# 1.3.2
|
21
|
+
|
22
|
+
- loosen dependency to allow rack 2.0
|
23
|
+
|
1
24
|
# 1.3.1
|
2
25
|
|
3
26
|
- set media type to the default that the adapter will use if it's not specified on a request that is expected to have a body
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# OAuthenticator
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/notEthan/oauthenticator.svg?branch=master)](https://travis-ci.org/notEthan/oauthenticator)
|
4
|
+
|
3
5
|
OAuthenticator signs outgoing requests with OAuth 1.0.
|
4
6
|
|
5
7
|
OAuthenticator authenticates incoming OAuth 1.0 signed requests, primarily as a middleware, and forms useful
|
@@ -46,7 +48,10 @@ connection.get '/path'
|
|
46
48
|
```
|
47
49
|
|
48
50
|
Note that `:url_encoded` is only included to illustrate that other middleware should all go before
|
49
|
-
`:oauthenticator_signer`; the use of `:url_encoded` is not related to OAuthenticator.
|
51
|
+
`:oauthenticator_signer`; the use of `:url_encoded` is not related to OAuthenticator.
|
52
|
+
|
53
|
+
Note that for the RSA-SHA1 signature method, the token secret is the contents of the RSA certificate
|
54
|
+
used for signing the requests.
|
50
55
|
|
51
56
|
### Any other HTTP library
|
52
57
|
|
@@ -73,13 +78,13 @@ See the documentation for {OAuthenticator::SignableRequest} for more detailed in
|
|
73
78
|
|
74
79
|
### OAuth Request Body Hash
|
75
80
|
|
76
|
-
The [OAuth Request Body Hash](https://
|
81
|
+
The [OAuth Request Body Hash](https://tools.ietf.org/html/draft-eaton-oauth-bodyhash-00)
|
77
82
|
specification is supported. By default all signing of outgoing does include the body hash. This can be
|
78
83
|
disabled by setting the `:hash_body?` / `'hash_body?'` attribute to false when instantiating an
|
79
84
|
OAuthenticator::SignableRequest.
|
80
85
|
|
81
86
|
For info on when to include the body hash, see
|
82
|
-
[When to Include the Body Hash](https://
|
87
|
+
[When to Include the Body Hash](https://tools.ietf.org/html/draft-eaton-oauth-bodyhash-00#section-4.1.1).
|
83
88
|
|
84
89
|
## Authenticating incoming requests
|
85
90
|
|
@@ -193,7 +198,7 @@ methods it needs to function.
|
|
193
198
|
|
194
199
|
### OAuth Request Body Hash
|
195
200
|
|
196
|
-
The [OAuth Request Body Hash](https://
|
201
|
+
The [OAuth Request Body Hash](https://tools.ietf.org/html/draft-eaton-oauth-bodyhash-00)
|
197
202
|
specification is supported. Requests which include the oauth_body_hash parameter are authenticated according
|
198
203
|
to the spec.
|
199
204
|
|
data/Rakefile.rb
CHANGED
@@ -66,9 +66,10 @@ module OAuthenticator
|
|
66
66
|
end
|
67
67
|
|
68
68
|
# the signature methods which the application will accept. this MUST be a subset of the signature methods
|
69
|
-
# defined in the OAuth 1.0 protocol
|
70
|
-
#
|
71
|
-
# methods
|
69
|
+
# defined in the OAuth 1.0 protocol plus OAuthenticator-defined extensions:
|
70
|
+
# `%w(HMAC-SHA1 RSA-SHA1 PLAINTEXT HMAC-SHA512 HMAC-SHA256)`.
|
71
|
+
# the default value for this is all allowed signature methods, and may remain unimplemented if you wish
|
72
|
+
# to allow all defined signature methods.
|
72
73
|
#
|
73
74
|
# @return [Array<String>]
|
74
75
|
def allowed_signature_methods
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require 'oauthenticator'
|
2
1
|
require 'faraday'
|
2
|
+
require 'rack'
|
3
3
|
|
4
4
|
if Faraday.respond_to?(:register_middleware)
|
5
5
|
Faraday.register_middleware(:request, :oauthenticator_signer => proc { OAuthenticator::FaradaySigner })
|
@@ -30,7 +30,7 @@ module OAuthenticator
|
|
30
30
|
class FaradaySigner
|
31
31
|
# options are passed to {OAuthenticator::SignableRequest}.
|
32
32
|
#
|
33
|
-
# attributes of the request are added by the middleware, so you should not provide those as
|
33
|
+
# attributes of the request are added by the middleware, so you should not provide those as options
|
34
34
|
# (it would not make sense to do so on the connection level).
|
35
35
|
#
|
36
36
|
# These are the options you should or may provide (see {OAuthenticator::SignableRequest} for details of
|
@@ -54,10 +54,11 @@ module OAuthenticator
|
|
54
54
|
|
55
55
|
# do the thing
|
56
56
|
def call(request_env)
|
57
|
+
media_type = Rack::Request.new('CONTENT_TYPE' => request_env[:request_headers]['Content-Type']).media_type
|
57
58
|
request_attributes = {
|
58
59
|
:request_method => request_env[:method],
|
59
60
|
:uri => request_env[:url],
|
60
|
-
:media_type =>
|
61
|
+
:media_type => media_type,
|
61
62
|
:body => request_env[:body]
|
62
63
|
}
|
63
64
|
# the adapter will set the media type to form-encoded when not otherwise specified on
|
@@ -33,16 +33,16 @@ module OAuthenticator
|
|
33
33
|
header = header.to_s
|
34
34
|
scanner = StringScanner.new(header)
|
35
35
|
auth_parse_error = proc { |message| raise ParseError.new(message, {'Authorization' => [message]}) }
|
36
|
-
scanner.scan(/OAuth\s*/i) || auth_parse_error.call("Authorization scheme is not OAuth -
|
37
|
-
attributes =
|
38
|
-
while
|
36
|
+
scanner.scan(/OAuth\s*/i) || auth_parse_error.call("Authorization scheme is not OAuth - received: #{header}")
|
37
|
+
attributes = {}
|
38
|
+
while scanner.scan(/(\w+)="([^"]*)"\s*(,?)\s*/)
|
39
39
|
key = scanner[1]
|
40
40
|
value = scanner[2]
|
41
41
|
comma_follows = !scanner[3].empty?
|
42
42
|
if !comma_follows && !scanner.eos?
|
43
43
|
auth_parse_error.call("Could not parse Authorization header: #{header}\naround or after character #{scanner.pos}: #{scanner.rest}")
|
44
44
|
end
|
45
|
-
attributes[unescape(key)] << unescape(value)
|
45
|
+
(attributes[unescape(key)] ||= []) << unescape(value)
|
46
46
|
end
|
47
47
|
unless scanner.eos?
|
48
48
|
auth_parse_error.call("Could not parse Authorization header: #{header}\naround or after character #{scanner.pos}: #{scanner.rest}")
|
@@ -25,8 +25,8 @@ module OAuthenticator
|
|
25
25
|
#
|
26
26
|
# - `:realm` - 401 responses include a `WWW-Authenticate` with the realm set to the given value. default
|
27
27
|
# is an empty string.
|
28
|
-
def initialize(app, options={})
|
29
|
-
@app=app
|
28
|
+
def initialize(app, options = {})
|
29
|
+
@app = app
|
30
30
|
@options = options
|
31
31
|
unless @options[:config_methods].is_a?(Module)
|
32
32
|
raise ArgumentError, "options[:config_methods] must be a Module"
|
@@ -48,6 +48,7 @@ module OAuthenticator
|
|
48
48
|
unauthenticated_response(oauth_request.errors)
|
49
49
|
else
|
50
50
|
log_success(env, oauth_request)
|
51
|
+
env["oauth.signed_request"] = oauth_request
|
51
52
|
env["oauth.consumer_key"] = oauth_request.consumer_key
|
52
53
|
env["oauth.token"] = oauth_request.token
|
53
54
|
env["oauth.authenticated"] = true
|
@@ -33,6 +33,7 @@ end
|
|
33
33
|
|
34
34
|
class Rack::Test::Session
|
35
35
|
actual_process_request = instance_method(:process_request)
|
36
|
+
remove_method(:process_request)
|
36
37
|
define_method(:process_request) do |uri, env, &block|
|
37
38
|
oauth_attrs = Thread.current[:oauthenticator_rack_test_attributes]
|
38
39
|
if oauth_attrs
|
@@ -304,9 +304,33 @@ module OAuthenticator
|
|
304
304
|
#
|
305
305
|
# @return [String]
|
306
306
|
def hmac_sha1_signature
|
307
|
+
hmac_digest_signature(OpenSSL::Digest::SHA1)
|
308
|
+
end
|
309
|
+
|
310
|
+
# signature, with method HMAC-SHA256. OAuthenticator extension, outside of spec. do not use.
|
311
|
+
# unless you want to.
|
312
|
+
#
|
313
|
+
# @return [String]
|
314
|
+
def hmac_sha256_signature
|
315
|
+
hmac_digest_signature(OpenSSL::Digest::SHA256)
|
316
|
+
end
|
317
|
+
|
318
|
+
# signature, with method HMAC-SHA512. OAuthenticator extension, outside of spec. do not use.
|
319
|
+
# unless you want to.
|
320
|
+
#
|
321
|
+
# @return [String]
|
322
|
+
def hmac_sha512_signature
|
323
|
+
hmac_digest_signature(OpenSSL::Digest::SHA512)
|
324
|
+
end
|
325
|
+
|
326
|
+
# signature with a HMAC digest
|
327
|
+
#
|
328
|
+
# @param digest_class [Class] the digest class
|
329
|
+
# @return [String]
|
330
|
+
def hmac_digest_signature(digest_class)
|
307
331
|
# hmac secret is same as plaintext signature
|
308
332
|
secret = plaintext_signature
|
309
|
-
Base64.encode64(OpenSSL::HMAC.digest(
|
333
|
+
Base64.encode64(OpenSSL::HMAC.digest(digest_class.new, secret, signature_base)).gsub(/\n/, '')
|
310
334
|
end
|
311
335
|
|
312
336
|
# signature, with method plaintext. section 3.4.4
|
@@ -320,13 +344,39 @@ module OAuthenticator
|
|
320
344
|
#
|
321
345
|
# @return [String]
|
322
346
|
def sha1_body_hash
|
323
|
-
|
347
|
+
digest_body_hash(OpenSSL::Digest::SHA1)
|
348
|
+
end
|
349
|
+
|
350
|
+
# body hash, with a signature method which uses SHA256. OAuthenticator extension, outside of spec.
|
351
|
+
# do not use. unless you want to.
|
352
|
+
#
|
353
|
+
# @return [String]
|
354
|
+
def sha256_body_hash
|
355
|
+
digest_body_hash(OpenSSL::Digest::SHA256)
|
356
|
+
end
|
357
|
+
|
358
|
+
# body hash, with a signature method which uses SHA512. OAuthenticator extension, outside of spec.
|
359
|
+
# do not use. unless you want to.
|
360
|
+
#
|
361
|
+
# @return [String]
|
362
|
+
def sha512_body_hash
|
363
|
+
digest_body_hash(OpenSSL::Digest::SHA512)
|
364
|
+
end
|
365
|
+
|
366
|
+
# body hash with a given digest
|
367
|
+
#
|
368
|
+
# @param digest_class [Class] the digest class
|
369
|
+
# @return [String]
|
370
|
+
def digest_body_hash(digest_class)
|
371
|
+
Base64.encode64(digest_class.digest(read_body)).gsub(/\n/, '')
|
324
372
|
end
|
325
373
|
|
326
374
|
# map of oauth signature methods to their signature instance methods on this class
|
327
375
|
SIGNATURE_METHODS = {
|
328
376
|
'RSA-SHA1'.freeze => instance_method(:rsa_sha1_signature),
|
329
377
|
'HMAC-SHA1'.freeze => instance_method(:hmac_sha1_signature),
|
378
|
+
'HMAC-SHA256'.freeze => instance_method(:hmac_sha256_signature),
|
379
|
+
'HMAC-SHA512'.freeze => instance_method(:hmac_sha512_signature),
|
330
380
|
'PLAINTEXT'.freeze => instance_method(:plaintext_signature),
|
331
381
|
}.freeze
|
332
382
|
|
@@ -335,6 +385,8 @@ module OAuthenticator
|
|
335
385
|
BODY_HASH_METHODS = {
|
336
386
|
'RSA-SHA1'.freeze => instance_method(:sha1_body_hash),
|
337
387
|
'HMAC-SHA1'.freeze => instance_method(:sha1_body_hash),
|
388
|
+
'HMAC-SHA256'.freeze => instance_method(:sha256_body_hash),
|
389
|
+
'HMAC-SHA512'.freeze => instance_method(:sha512_body_hash),
|
338
390
|
}.freeze
|
339
391
|
end
|
340
392
|
end
|
@@ -234,13 +234,13 @@ module OAuthenticator
|
|
234
234
|
require 'oauthenticator/config_methods'
|
235
235
|
include ConfigMethods
|
236
236
|
|
237
|
-
private
|
238
|
-
|
239
237
|
# hash of header params. keys should be a subset of OAUTH_ATTRIBUTE_KEYS.
|
240
238
|
def oauth_header_params
|
241
239
|
@oauth_header_params ||= OAuthenticator.parse_authorization(authorization)
|
242
240
|
end
|
243
241
|
|
242
|
+
private
|
243
|
+
|
244
244
|
# raise a nice error message for a method that needs to be implemented on a module of config methods
|
245
245
|
def config_method_not_implemented
|
246
246
|
caller_name = caller[0].match(%r(in `(.*?)'))[1]
|
data/test/config_methods_test.rb
CHANGED
@@ -8,7 +8,7 @@ describe OAuthenticator::SignedRequest do
|
|
8
8
|
exc = assert_raises(NotImplementedError) do
|
9
9
|
OAuthenticator::SignedRequest.new({}).public_send(method_without_default)
|
10
10
|
end
|
11
|
-
assert_match
|
11
|
+
assert_match(/included in a subclass of OAuthenticator::SignedRequest/, exc.message)
|
12
12
|
end
|
13
13
|
it "uses the method #{method_without_default} when implemented" do
|
14
14
|
called = false
|
@@ -21,7 +21,7 @@ describe OAuthenticator::SignedRequest do
|
|
21
21
|
exc = assert_raises(NotImplementedError) do
|
22
22
|
OAuthenticator::RackAuthenticator.new(proc {}, {:config_methods => Module.new}).call({'HTTP_AUTHORIZATION' => %q(OAuth oauth_timestamp="1")})
|
23
23
|
end
|
24
|
-
assert_match
|
24
|
+
assert_match(/passed to OAuthenticator::RackAuthenticator using the option :config_methods./, exc.message)
|
25
25
|
end
|
26
26
|
it "complains RackAuthenticator is not given config methods" do
|
27
27
|
assert_raises(ArgumentError) do
|
@@ -36,7 +36,7 @@ describe OAuthenticator::SignedRequest do
|
|
36
36
|
assert_equal 2, called
|
37
37
|
end
|
38
38
|
it 'uses the default value for allowed signature methods' do
|
39
|
-
assert_equal %w(RSA-SHA1 HMAC-SHA1 PLAINTEXT).sort, OAuthenticator::SignedRequest.new({}).allowed_signature_methods.sort
|
39
|
+
assert_equal %w(RSA-SHA1 HMAC-SHA256 HMAC-SHA512 HMAC-SHA1 PLAINTEXT).sort, OAuthenticator::SignedRequest.new({}).allowed_signature_methods.sort
|
40
40
|
end
|
41
41
|
it 'uses default value for body_hash_required?' do
|
42
42
|
assert_equal false, OAuthenticator::SignedRequest.new({}).body_hash_required?
|
data/test/faraday_signer_test.rb
CHANGED
@@ -46,6 +46,23 @@ describe OAuthenticator::FaradaySigner do
|
|
46
46
|
assert_response 200, '☺', response
|
47
47
|
end
|
48
48
|
|
49
|
+
it 'succeeds with charset' do
|
50
|
+
signing_options = {
|
51
|
+
:signature_method => 'HMAC-SHA1',
|
52
|
+
:consumer_key => consumer_key,
|
53
|
+
:consumer_secret => consumer_secret,
|
54
|
+
:token => token,
|
55
|
+
:token_secret => token_secret,
|
56
|
+
}
|
57
|
+
|
58
|
+
connection = Faraday.new(:url => 'http://example.com', :headers => {'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8'}) do |faraday|
|
59
|
+
faraday.request :oauthenticator_signer, signing_options
|
60
|
+
faraday.adapter :rack, oapp
|
61
|
+
end
|
62
|
+
response = connection.post('/', 'a=b')
|
63
|
+
assert_response 200, '☺', response
|
64
|
+
end
|
65
|
+
|
49
66
|
it 'is unauthorized' do
|
50
67
|
signing_options = {
|
51
68
|
:signature_method => 'PLAINTEXT',
|
@@ -592,14 +592,16 @@ describe OAuthenticator::RackAuthenticator do
|
|
592
592
|
end
|
593
593
|
end
|
594
594
|
|
595
|
-
it 'sets oauth.authenticated, oauth.token, oauth.consumer_key' do
|
595
|
+
it 'sets oauth.authenticated, oauth.token, oauth.consumer_key, oauth.signed_request' do
|
596
596
|
oauth_authenticated = nil
|
597
597
|
oauth_token = nil
|
598
598
|
oauth_consumer_key = nil
|
599
|
+
oauth_signed_request = nil
|
599
600
|
testapp = proc do |env|
|
600
601
|
oauth_authenticated = env['oauth.authenticated']
|
601
602
|
oauth_token = env['oauth.token']
|
602
603
|
oauth_consumer_key = env['oauth.consumer_key']
|
604
|
+
oauth_signed_request = env['oauth.signed_request']
|
603
605
|
[200, {}, ['☺']]
|
604
606
|
end
|
605
607
|
otestapp = OAuthenticator::RackAuthenticator.new(testapp, :config_methods => OAuthenticatorTestConfigMethods)
|
@@ -607,6 +609,7 @@ describe OAuthenticator::RackAuthenticator do
|
|
607
609
|
assert_equal(token, oauth_token)
|
608
610
|
assert_equal(consumer_key, oauth_consumer_key)
|
609
611
|
assert_equal(true, oauth_authenticated)
|
612
|
+
assert_kind_of(OAuthenticator::SignedRequest, oauth_signed_request)
|
610
613
|
end
|
611
614
|
end
|
612
615
|
end
|
@@ -87,7 +87,7 @@ describe OAuthenticator::SignableRequest do
|
|
87
87
|
end
|
88
88
|
it 'does not generate timestamp' do
|
89
89
|
request = example_request(:signature_method => 'PLAINTEXT')
|
90
|
-
assert(!request.protocol_params.key?('
|
90
|
+
assert(!request.protocol_params.key?('oauth_timestamp'))
|
91
91
|
end
|
92
92
|
end
|
93
93
|
end
|
@@ -127,7 +127,7 @@ describe OAuthenticator::SignableRequest do
|
|
127
127
|
it 'complains about missing required params' do
|
128
128
|
err = assert_raises(ArgumentError) { OAuthenticator::SignableRequest.new({}) }
|
129
129
|
%w(request_method uri media_type body consumer_key signature_method).each do |required|
|
130
|
-
assert_match
|
130
|
+
assert_match(/#{required}/, err.message)
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
@@ -135,7 +135,7 @@ describe OAuthenticator::SignableRequest do
|
|
135
135
|
|
136
136
|
describe 'the example in 3.1' do
|
137
137
|
# a request with attributes from the oauth spec
|
138
|
-
def spec_request
|
138
|
+
def spec_request
|
139
139
|
example_request({
|
140
140
|
:request_method => 'POST',
|
141
141
|
:uri => 'http://example.com/request?b5=%3D%253D&a3=a&c%40=&a2=r%20b',
|
@@ -231,6 +231,20 @@ describe OAuthenticator::SignableRequest do
|
|
231
231
|
end
|
232
232
|
end
|
233
233
|
|
234
|
+
describe 'HMAC-SHA256' do
|
235
|
+
it 'signs with a HMAC-SHA256 digest of the signature base' do
|
236
|
+
request = example_request(
|
237
|
+
:token => 'a token',
|
238
|
+
:token_secret => 'a token secret',
|
239
|
+
:signature_method => 'HMAC-SHA256',
|
240
|
+
:nonce => 'a nonce',
|
241
|
+
:timestamp => 1397726597,
|
242
|
+
:hash_body? => false
|
243
|
+
)
|
244
|
+
assert_equal('Cb4UAr3l25eqC7p2PSm0l6j7lgXvh5SPnMOhPAJ1jWU=', request.signed_protocol_params['oauth_signature'])
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
234
248
|
describe 'RSA-SHA1' do
|
235
249
|
it 'signs with a RSA private key SHA1 signature' do
|
236
250
|
request = example_request(
|
@@ -329,6 +343,7 @@ describe OAuthenticator::SignableRequest do
|
|
329
343
|
|
330
344
|
it 'excludes query and fragment' do
|
331
345
|
assert_equal('http://example.com/FooBar', example_request(:uri => 'http://example.com/FooBar?foo=bar#foobar').send(:base_string_uri))
|
346
|
+
assert_equal('http://example.com/FooBar', example_request(:uri => 'http://example.com/FooBar#foobar').send(:base_string_uri))
|
332
347
|
end
|
333
348
|
end
|
334
349
|
|
@@ -486,6 +501,10 @@ describe OAuthenticator::SignableRequest do
|
|
486
501
|
request = example_request(:media_type => 'text/plain', :body => 'foo=bar', :signature_method => 'HMAC-SHA1')
|
487
502
|
assert_equal('L7j0ARXdHmlcviPU+Xzlsftpfu4=', request.protocol_params['oauth_body_hash'])
|
488
503
|
end
|
504
|
+
it 'includes by default with non-form-encoded and HMAC-SHA256' do
|
505
|
+
request = example_request(:media_type => 'text/plain', :body => 'foo=bar', :signature_method => 'HMAC-SHA256')
|
506
|
+
assert_equal('O6iQfnolIydIjfOQ7VF8Rblt6tAzYAIZvcpxB9HT+Io=', request.protocol_params['oauth_body_hash'])
|
507
|
+
end
|
489
508
|
it 'includes by default with non-form-encoded and RSA-SHA1' do
|
490
509
|
request = example_request(:media_type => 'text/plain', :body => 'foo=bar', :signature_method => 'RSA-SHA1', :consumer_secret => rsa_private_key)
|
491
510
|
assert_equal('L7j0ARXdHmlcviPU+Xzlsftpfu4=', request.protocol_params['oauth_body_hash'])
|
@@ -498,6 +517,10 @@ describe OAuthenticator::SignableRequest do
|
|
498
517
|
request = example_request(:media_type => 'application/x-www-form-urlencoded', :body => 'foo=bar', :signature_method => 'HMAC-SHA1')
|
499
518
|
assert(!request.protocol_params.key?('oauth_body_hash'))
|
500
519
|
end
|
520
|
+
it 'does not include by default with form-encoded and HMAC-SHA256' do
|
521
|
+
request = example_request(:media_type => 'application/x-www-form-urlencoded', :body => 'foo=bar', :signature_method => 'HMAC-SHA256')
|
522
|
+
assert(!request.protocol_params.key?('oauth_body_hash'))
|
523
|
+
end
|
501
524
|
it 'does not include by default with form-encoded and RSA-SHA1' do
|
502
525
|
request = example_request(:media_type => 'application/x-www-form-urlencoded', :body => 'foo=bar', :signature_method => 'RSA-SHA1', :consumer_secret => rsa_private_key)
|
503
526
|
assert(!request.protocol_params.key?('oauth_body_hash'))
|
metadata
CHANGED
@@ -1,181 +1,193 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oauthenticator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.4'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.4'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: json
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- -
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '0'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- -
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: faraday
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- -
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '0.9'
|
54
|
+
- - "<"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '2.0'
|
48
57
|
type: :runtime
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
|
-
- -
|
61
|
+
- - ">="
|
53
62
|
- !ruby/object:Gem::Version
|
54
63
|
version: '0.9'
|
64
|
+
- - "<"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '2.0'
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: addressable
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
59
|
-
- - ~>
|
71
|
+
- - "~>"
|
60
72
|
- !ruby/object:Gem::Version
|
61
73
|
version: '2.3'
|
62
74
|
type: :runtime
|
63
75
|
prerelease: false
|
64
76
|
version_requirements: !ruby/object:Gem::Requirement
|
65
77
|
requirements:
|
66
|
-
- - ~>
|
78
|
+
- - "~>"
|
67
79
|
- !ruby/object:Gem::Version
|
68
80
|
version: '2.3'
|
69
81
|
- !ruby/object:Gem::Dependency
|
70
82
|
name: rake
|
71
83
|
requirement: !ruby/object:Gem::Requirement
|
72
84
|
requirements:
|
73
|
-
- -
|
85
|
+
- - ">="
|
74
86
|
- !ruby/object:Gem::Version
|
75
87
|
version: '0'
|
76
88
|
type: :development
|
77
89
|
prerelease: false
|
78
90
|
version_requirements: !ruby/object:Gem::Requirement
|
79
91
|
requirements:
|
80
|
-
- -
|
92
|
+
- - ">="
|
81
93
|
- !ruby/object:Gem::Version
|
82
94
|
version: '0'
|
83
95
|
- !ruby/object:Gem::Dependency
|
84
96
|
name: minitest
|
85
97
|
requirement: !ruby/object:Gem::Requirement
|
86
98
|
requirements:
|
87
|
-
- -
|
99
|
+
- - ">="
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '0'
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
93
105
|
requirements:
|
94
|
-
- -
|
106
|
+
- - ">="
|
95
107
|
- !ruby/object:Gem::Version
|
96
108
|
version: '0'
|
97
109
|
- !ruby/object:Gem::Dependency
|
98
110
|
name: minitest-reporters
|
99
111
|
requirement: !ruby/object:Gem::Requirement
|
100
112
|
requirements:
|
101
|
-
- -
|
113
|
+
- - ">="
|
102
114
|
- !ruby/object:Gem::Version
|
103
115
|
version: '0'
|
104
116
|
type: :development
|
105
117
|
prerelease: false
|
106
118
|
version_requirements: !ruby/object:Gem::Requirement
|
107
119
|
requirements:
|
108
|
-
- -
|
120
|
+
- - ">="
|
109
121
|
- !ruby/object:Gem::Version
|
110
122
|
version: '0'
|
111
123
|
- !ruby/object:Gem::Dependency
|
112
124
|
name: rack-test
|
113
125
|
requirement: !ruby/object:Gem::Requirement
|
114
126
|
requirements:
|
115
|
-
- -
|
127
|
+
- - ">="
|
116
128
|
- !ruby/object:Gem::Version
|
117
129
|
version: '0'
|
118
130
|
type: :development
|
119
131
|
prerelease: false
|
120
132
|
version_requirements: !ruby/object:Gem::Requirement
|
121
133
|
requirements:
|
122
|
-
- -
|
134
|
+
- - ">="
|
123
135
|
- !ruby/object:Gem::Version
|
124
136
|
version: '0'
|
125
137
|
- !ruby/object:Gem::Dependency
|
126
138
|
name: timecop
|
127
139
|
requirement: !ruby/object:Gem::Requirement
|
128
140
|
requirements:
|
129
|
-
- -
|
141
|
+
- - ">="
|
130
142
|
- !ruby/object:Gem::Version
|
131
143
|
version: '0'
|
132
144
|
type: :development
|
133
145
|
prerelease: false
|
134
146
|
version_requirements: !ruby/object:Gem::Requirement
|
135
147
|
requirements:
|
136
|
-
- -
|
148
|
+
- - ">="
|
137
149
|
- !ruby/object:Gem::Version
|
138
150
|
version: '0'
|
139
151
|
- !ruby/object:Gem::Dependency
|
140
152
|
name: simplecov
|
141
153
|
requirement: !ruby/object:Gem::Requirement
|
142
154
|
requirements:
|
143
|
-
- -
|
155
|
+
- - ">="
|
144
156
|
- !ruby/object:Gem::Version
|
145
157
|
version: '0'
|
146
158
|
type: :development
|
147
159
|
prerelease: false
|
148
160
|
version_requirements: !ruby/object:Gem::Requirement
|
149
161
|
requirements:
|
150
|
-
- -
|
162
|
+
- - ">="
|
151
163
|
- !ruby/object:Gem::Version
|
152
164
|
version: '0'
|
153
165
|
- !ruby/object:Gem::Dependency
|
154
166
|
name: api_hammer
|
155
167
|
requirement: !ruby/object:Gem::Requirement
|
156
168
|
requirements:
|
157
|
-
- -
|
169
|
+
- - ">="
|
158
170
|
- !ruby/object:Gem::Version
|
159
171
|
version: '0'
|
160
172
|
type: :development
|
161
173
|
prerelease: false
|
162
174
|
version_requirements: !ruby/object:Gem::Requirement
|
163
175
|
requirements:
|
164
|
-
- -
|
176
|
+
- - ">="
|
165
177
|
- !ruby/object:Gem::Version
|
166
178
|
version: '0'
|
167
179
|
- !ruby/object:Gem::Dependency
|
168
180
|
name: yard
|
169
181
|
requirement: !ruby/object:Gem::Requirement
|
170
182
|
requirements:
|
171
|
-
- -
|
183
|
+
- - ">="
|
172
184
|
- !ruby/object:Gem::Version
|
173
185
|
version: '0'
|
174
186
|
type: :development
|
175
187
|
prerelease: false
|
176
188
|
version_requirements: !ruby/object:Gem::Requirement
|
177
189
|
requirements:
|
178
|
-
- -
|
190
|
+
- - ">="
|
179
191
|
- !ruby/object:Gem::Version
|
180
192
|
version: '0'
|
181
193
|
description: OAuthenticator signs and authenticates OAuth 1.0 requests
|
@@ -185,8 +197,8 @@ executables: []
|
|
185
197
|
extensions: []
|
186
198
|
extra_rdoc_files: []
|
187
199
|
files:
|
188
|
-
- .simplecov
|
189
|
-
- .yardopts
|
200
|
+
- ".simplecov"
|
201
|
+
- ".yardopts"
|
190
202
|
- CHANGELOG.md
|
191
203
|
- LICENSE.txt
|
192
204
|
- README.md
|
@@ -219,17 +231,16 @@ require_paths:
|
|
219
231
|
- lib
|
220
232
|
required_ruby_version: !ruby/object:Gem::Requirement
|
221
233
|
requirements:
|
222
|
-
- -
|
234
|
+
- - ">="
|
223
235
|
- !ruby/object:Gem::Version
|
224
236
|
version: '0'
|
225
237
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
238
|
requirements:
|
227
|
-
- -
|
239
|
+
- - ">="
|
228
240
|
- !ruby/object:Gem::Version
|
229
241
|
version: '0'
|
230
242
|
requirements: []
|
231
|
-
|
232
|
-
rubygems_version: 2.2.2
|
243
|
+
rubygems_version: 3.0.6
|
233
244
|
signing_key:
|
234
245
|
specification_version: 4
|
235
246
|
summary: OAuth 1.0 request signing and authentication
|
@@ -243,5 +254,4 @@ test_files:
|
|
243
254
|
- test/signable_request_test.rb
|
244
255
|
- test/signed_request_test.rb
|
245
256
|
- test/test_config_methods.rb
|
246
|
-
- .simplecov
|
247
|
-
has_rdoc:
|
257
|
+
- ".simplecov"
|