oauthenticator 1.4.0 → 1.4.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +2 -2
- data/lib/oauthenticator/parse_authorization.rb +5 -9
- data/lib/oauthenticator/rack_authenticator.rb +1 -1
- data/lib/oauthenticator/signable_request.rb +2 -2
- data/lib/oauthenticator/signed_request.rb +1 -1
- data/lib/oauthenticator/version.rb +1 -1
- metadata +11 -144
- data/.simplecov +0 -1
- data/Rakefile.rb +0 -14
- data/test/config_methods_test.rb +0 -44
- data/test/faraday_signer_test.rb +0 -82
- data/test/helper.rb +0 -30
- data/test/parse_authorization_test.rb +0 -86
- data/test/rack_authenticator_test.rb +0 -615
- data/test/rack_test_signer_test.rb +0 -61
- data/test/signable_request_test.rb +0 -676
- data/test/signed_request_test.rb +0 -12
- data/test/test_config_methods.rb +0 -74
data/test/signed_request_test.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
proc { |p| $:.unshift(p) unless $:.any? { |lp| File.expand_path(lp) == p } }.call(File.expand_path('.', File.dirname(__FILE__)))
|
3
|
-
require 'helper'
|
4
|
-
|
5
|
-
# most everything about this is tested via the middlware in oauthenticator_test, so not a lot here
|
6
|
-
describe OAuthenticator::SignedRequest do
|
7
|
-
describe '#initialize' do
|
8
|
-
it 'checks for unrecognized attributes' do
|
9
|
-
assert_raises(ArgumentError) { OAuthenticator::SignedRequest.new(:foo => 'bar') }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
data/test/test_config_methods.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# config methods for testing OAuthenticator. simple
|
4
|
-
module OAuthenticatorTestConfigMethods
|
5
|
-
class << self
|
6
|
-
# a set of nonces
|
7
|
-
define_method(:nonces) { @nonces ||= Set.new }
|
8
|
-
# a Hash keyed by consumer keys with values of consumer secrets
|
9
|
-
define_method(:consumer_secrets) { @consumer_secrets ||= {} }
|
10
|
-
# a Hash keyed by tokens with values of token secrets
|
11
|
-
define_method(:token_secrets) { @token_secrets ||= {} }
|
12
|
-
# a Hash keyed by tokens with values of consumer keys
|
13
|
-
define_method(:token_consumers) { @token_consumers ||= {} }
|
14
|
-
end
|
15
|
-
|
16
|
-
def nonce_used?
|
17
|
-
OAuthenticatorTestConfigMethods.nonces.include?(nonce)
|
18
|
-
end
|
19
|
-
|
20
|
-
def use_nonce!
|
21
|
-
if OAuthenticatorTestConfigMethods.nonces.include?(nonce)
|
22
|
-
# checking the same thing as #nonce_used? lets #nonce_used? be overridden to return false and things still work
|
23
|
-
raise OAuthenticator::NonceUsedError
|
24
|
-
else
|
25
|
-
OAuthenticatorTestConfigMethods.nonces << nonce
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def timestamp_valid_period
|
30
|
-
10
|
31
|
-
end
|
32
|
-
|
33
|
-
def allowed_signature_methods
|
34
|
-
%w(HMAC-SHA1 RSA-SHA1 PLAINTEXT)
|
35
|
-
end
|
36
|
-
|
37
|
-
def consumer_secret
|
38
|
-
OAuthenticatorTestConfigMethods.consumer_secrets[consumer_key]
|
39
|
-
end
|
40
|
-
|
41
|
-
def token_secret
|
42
|
-
OAuthenticatorTestConfigMethods.token_secrets[token]
|
43
|
-
end
|
44
|
-
|
45
|
-
def token_belongs_to_consumer?
|
46
|
-
OAuthenticatorTestConfigMethods.token_consumers[token] == consumer_key
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
module TestHelperMethods
|
51
|
-
def self.let(name, &block)
|
52
|
-
define_method(name) { |*args| (@lets ||= {}).key?(name) ? @lets[name] : (@lets[name] = instance_eval(*args, &block)) }
|
53
|
-
end
|
54
|
-
|
55
|
-
let(:simpleapp) { proc { |env| [200, {'Content-Type' => 'text/plain; charset=UTF-8'}, ['☺']] } }
|
56
|
-
let(:oapp) { OAuthenticator::RackAuthenticator.new(simpleapp, :config_methods => OAuthenticatorTestConfigMethods) }
|
57
|
-
|
58
|
-
let(:consumer) do
|
59
|
-
{:key => "test_client_app_key", :secret => "test_client_app_secret"}.tap do |consumer|
|
60
|
-
OAuthenticatorTestConfigMethods.consumer_secrets[consumer[:key]] = consumer[:secret]
|
61
|
-
end
|
62
|
-
end
|
63
|
-
let(:consumer_key) { consumer[:key] }
|
64
|
-
let(:consumer_secret) { consumer[:secret] }
|
65
|
-
|
66
|
-
let(:token_hash) do
|
67
|
-
{:token => 'test_token', :secret => 'test_token_secret', :consumer_key => consumer_key}.tap do |hash|
|
68
|
-
OAuthenticatorTestConfigMethods.token_secrets[hash[:token]] = hash[:secret]
|
69
|
-
OAuthenticatorTestConfigMethods.token_consumers[hash[:token]] = hash[:consumer_key]
|
70
|
-
end
|
71
|
-
end
|
72
|
-
let(:token) { token_hash[:token] }
|
73
|
-
let(:token_secret) { token_hash[:secret] }
|
74
|
-
end
|