monkeyhelper-oauth 0.3.1 → 0.3.5
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.
- data/History.txt +62 -17
- data/Manifest.txt +14 -1
- data/README.rdoc +7 -9
- data/Rakefile +7 -5
- data/TODO +17 -0
- data/bin/oauth +2 -2
- data/examples/yql.rb +44 -0
- data/lib/oauth/cli.rb +267 -31
- data/lib/oauth/client/action_controller_request.rb +14 -12
- data/lib/oauth/client/helper.rb +22 -14
- data/lib/oauth/client/net_http.rb +53 -22
- data/lib/oauth/consumer.rb +217 -111
- data/lib/oauth/errors/error.rb +4 -0
- data/lib/oauth/errors/problem.rb +14 -0
- data/lib/oauth/errors/unauthorized.rb +12 -0
- data/lib/oauth/errors.rb +3 -0
- data/lib/oauth/helper.rb +67 -6
- data/lib/oauth/oauth.rb +11 -0
- data/lib/oauth/oauth_test_helper.rb +12 -13
- data/lib/oauth/request_proxy/action_controller_request.rb +8 -8
- data/lib/oauth/request_proxy/base.rb +102 -44
- data/lib/oauth/request_proxy/jabber_request.rb +1 -2
- data/lib/oauth/request_proxy/mock_request.rb +8 -0
- data/lib/oauth/request_proxy/net_http.rb +2 -2
- data/lib/oauth/request_proxy/rack_request.rb +7 -7
- data/lib/oauth/server.rb +31 -33
- data/lib/oauth/signature/base.rb +23 -21
- data/lib/oauth/signature/hmac/base.rb +1 -1
- data/lib/oauth/signature/hmac/sha1.rb +0 -1
- data/lib/oauth/signature/plaintext.rb +2 -2
- data/lib/oauth/signature/rsa/sha1.rb +5 -4
- data/lib/oauth/signature.rb +9 -0
- data/lib/oauth/token.rb +6 -136
- data/lib/oauth/tokens/access_token.rb +68 -0
- data/lib/oauth/tokens/consumer_token.rb +33 -0
- data/lib/oauth/tokens/request_token.rb +32 -0
- data/lib/oauth/tokens/server_token.rb +9 -0
- data/lib/oauth/tokens/token.rb +17 -0
- data/lib/oauth/version.rb +1 -1
- data/lib/oauth.rb +1 -0
- data/oauth.gemspec +12 -6
- data/test/cases/spec/1_0-final/test_construct_request_url.rb +1 -1
- data/test/test_access_token.rb +28 -0
- data/test/test_action_controller_request_proxy.rb +105 -6
- data/test/test_consumer.rb +41 -5
- data/test/test_helper.rb +0 -5
- data/test/test_net_http_client.rb +38 -20
- data/test/test_net_http_request_proxy.rb +43 -8
- data/test/test_oauth_helper.rb +50 -0
- data/test/test_request_token.rb +53 -0
- data/test/test_server.rb +1 -1
- data/test/test_signature.rb +19 -11
- data/website/index.html +2 -2
- metadata +41 -3
data/History.txt
CHANGED
@@ -1,8 +1,50 @@
|
|
1
|
-
== 0.3.
|
1
|
+
== 0.3.5 2009-06-03
|
2
2
|
|
3
|
-
*
|
3
|
+
* `query` CLI command to access protected resources (Seth)
|
4
|
+
* Added -H, -Q CLI options for specifying the authorization scheme (Seth)
|
5
|
+
* Added -O CLI option for specifying a file containing options (Seth)
|
6
|
+
* Support streamable body contents for large request bodies (Seth Cousins)
|
7
|
+
* Support for OAuth 1.0a (Seth)
|
8
|
+
* Added proxy support to OAuth::Consumer (Marshall Huss)
|
9
|
+
* Added --scope CLI option for Google's 'scope' parameter (Seth)
|
4
10
|
|
5
|
-
== 0.3.
|
11
|
+
== 0.3.4 2009-05-06
|
12
|
+
|
13
|
+
* OAuth::Client::Helper uses OAuth::VERSION (chadisfaction)
|
14
|
+
* Fix OAuth::RequestProxy::ActionControllerRequest's handling of params
|
15
|
+
(Tristan Groléat)
|
16
|
+
|
17
|
+
== 0.3.3 2009-05-04
|
18
|
+
|
19
|
+
* Corrected OAuth XMPP namespace (Seth)
|
20
|
+
* Improved error handling for invalid Authorization headers (Matt Sanford)
|
21
|
+
* Fixed signatures for non-ASCII under $KCODE other than 'u' (Matt Sanford)
|
22
|
+
* Fixed edge cases in ActionControllerRequestProxy where params were being
|
23
|
+
incorrectly signed (Marcos Wright Kuhns)
|
24
|
+
* Support for arguments in OAuth::Consumer#get_access_token (Matt Sanford)
|
25
|
+
* Add gem version to user-agent header (Matt Sanford)
|
26
|
+
* Handle input from aggressive form encoding libraries (Matt Wood)
|
27
|
+
|
28
|
+
== 0.3.2 2009-03-23
|
29
|
+
|
30
|
+
* 2xx statuses should be treated as success (Anders Conbere)
|
31
|
+
* Support applications using the MethodOverride Rack middleware (László Bácsi)
|
32
|
+
* `authorize` command for `oauth` CLI (Seth)
|
33
|
+
* Initial support for Problem Reporting extension (Seth)
|
34
|
+
* Verify SSL certificates if CA certificates are available (Seth)
|
35
|
+
* Fixed ActionController parameter escaping behavior (Thiago Arrais, László
|
36
|
+
Bácsi, Brett Gibson, et al)
|
37
|
+
* Fixed signature calculation when both options and a block were provided to
|
38
|
+
OAuth::Signature::Base#initialize (Seth)
|
39
|
+
* Added help to the 'oauth' CLI (Seth)
|
40
|
+
* Fixed a problem when attempting to normalize MockRequest URIs (Seth)
|
41
|
+
|
42
|
+
== 0.3.1 2009-1-26
|
43
|
+
|
44
|
+
* Fixed a problem with relative and absolute token request paths. (Michael
|
45
|
+
Wood)
|
46
|
+
|
47
|
+
== 0.3.0 2009-1-25
|
6
48
|
|
7
49
|
* Support ActionController::Request from Edge Rails (László Bácsi)
|
8
50
|
* Correctly handle multi-valued parameters (Seth)
|
@@ -15,23 +57,25 @@
|
|
15
57
|
* Improved test-cases and compatibility for encoding issues. (Pelle)
|
16
58
|
|
17
59
|
== 0.2.7 2008-9-10 The lets fix the last release release
|
18
|
-
Fix in plain text signatures to bug found by Andrew Arrow. Who contributed new new unit tests for plain text sigs.
|
19
60
|
|
20
|
-
|
61
|
+
* Fixed plain text signatures (Andrew Arrow)
|
62
|
+
* Fixed RSA requests using OAuthTokens. (Philip Lipu Tsai)
|
21
63
|
|
22
64
|
== 0.2.6 2008-9-9 The lets RSA release
|
23
65
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
66
|
+
* Improved support for Ruby 1.8.7 (Bill Kocik)
|
67
|
+
* Fixed RSA verification to support RSA providers
|
68
|
+
now using Ruby and RSA
|
69
|
+
* Improved RSA testing
|
70
|
+
* Omit token when signing with RSA
|
71
|
+
* Added support for 'private_key_file' option for RSA signatures (Chris Mear)
|
72
|
+
* Fixed several edge cases where params were being incorrectly signed (Scott
|
73
|
+
Hill)
|
74
|
+
* Fixed RSA signing (choonkeat)
|
31
75
|
|
32
76
|
== 0.2.2 2008-2-22 Lets actually support SSL release
|
33
77
|
|
34
|
-
|
78
|
+
* Use HTTPS when required.
|
35
79
|
|
36
80
|
== 0.2 2008-1-19 All together now release
|
37
81
|
|
@@ -39,10 +83,11 @@ This is a big release, where we have merged the efforts of various parties into
|
|
39
83
|
|
40
84
|
== 0.1.2 2007-12-1
|
41
85
|
|
42
|
-
*
|
43
|
-
*
|
86
|
+
* Fixed checks for missing OAuth params to improve performance
|
87
|
+
* Includes Pat's fix for getting the realm out.
|
44
88
|
|
45
89
|
== 0.1.1 2007-11-26
|
46
90
|
|
47
|
-
*
|
48
|
-
|
91
|
+
* First release as a GEM
|
92
|
+
* Moved all non-Rails functionality from the Rails plugin:
|
93
|
+
http://code.google.com/p/oauth-plugin/
|
data/Manifest.txt
CHANGED
@@ -5,13 +5,19 @@ README.rdoc
|
|
5
5
|
Rakefile
|
6
6
|
TODO
|
7
7
|
bin/oauth
|
8
|
+
examples/yql.rb
|
8
9
|
lib/oauth.rb
|
10
|
+
lib/oauth/oauth.rb
|
9
11
|
lib/oauth/cli.rb
|
10
12
|
lib/oauth/client.rb
|
11
13
|
lib/oauth/client/action_controller_request.rb
|
12
14
|
lib/oauth/client/helper.rb
|
13
15
|
lib/oauth/client/net_http.rb
|
14
16
|
lib/oauth/consumer.rb
|
17
|
+
lib/oauth/errors.rb
|
18
|
+
lib/oauth/errors/error.rb
|
19
|
+
lib/oauth/errors/problem.rb
|
20
|
+
lib/oauth/errors/unauthorized.rb
|
15
21
|
lib/oauth/helper.rb
|
16
22
|
lib/oauth/oauth_test_helper.rb
|
17
23
|
lib/oauth/request_proxy.rb
|
@@ -34,13 +40,17 @@ lib/oauth/signature/plaintext.rb
|
|
34
40
|
lib/oauth/signature/rsa/sha1.rb
|
35
41
|
lib/oauth/signature/sha1.rb
|
36
42
|
lib/oauth/token.rb
|
43
|
+
lib/oauth/tokens/access_token.rb
|
44
|
+
lib/oauth/tokens/consumer_token.rb
|
45
|
+
lib/oauth/tokens/request_token.rb
|
46
|
+
lib/oauth/tokens/server_token.rb
|
47
|
+
lib/oauth/tokens/token.rb
|
37
48
|
lib/oauth/version.rb
|
38
49
|
oauth.gemspec
|
39
50
|
script/destroy
|
40
51
|
script/generate
|
41
52
|
script/txt2html
|
42
53
|
setup.rb
|
43
|
-
specs.txt
|
44
54
|
tasks/deployment.rake
|
45
55
|
tasks/environment.rake
|
46
56
|
tasks/website.rake
|
@@ -51,13 +61,16 @@ test/cases/spec/1_0-final/test_parameter_encodings.rb
|
|
51
61
|
test/cases/spec/1_0-final/test_signature_base_strings.rb
|
52
62
|
test/keys/rsa.cert
|
53
63
|
test/keys/rsa.pem
|
64
|
+
test/test_access_token.rb
|
54
65
|
test/test_action_controller_request_proxy.rb
|
55
66
|
test/test_consumer.rb
|
56
67
|
test/test_helper.rb
|
57
68
|
test/test_hmac_sha1.rb
|
58
69
|
test/test_net_http_client.rb
|
59
70
|
test/test_net_http_request_proxy.rb
|
71
|
+
test/test_oauth_helper.rb
|
60
72
|
test/test_rack_request_proxy.rb
|
73
|
+
test/test_request_token.rb
|
61
74
|
test/test_rsa_sha1.rb
|
62
75
|
test/test_server.rb
|
63
76
|
test/test_signature.rb
|
data/README.rdoc
CHANGED
@@ -12,7 +12,7 @@ See the OAuth specs http://oauth.net/core/1.0/
|
|
12
12
|
|
13
13
|
You can also install it from the oauth rubyforge project http://rubyforge.org/projects/oauth/.
|
14
14
|
|
15
|
-
The source code is now hosted on the OAuth GitHub Project http://github.com/
|
15
|
+
The source code is now hosted on the OAuth GitHub Project http://github.com/mojodna/oauth
|
16
16
|
|
17
17
|
== The basics
|
18
18
|
|
@@ -24,20 +24,18 @@ As a matter of fact it has been pulled out from an OAuth Rails Plugin http://cod
|
|
24
24
|
|
25
25
|
Create a new consumer instance by passing it a configuration hash:
|
26
26
|
|
27
|
-
@consumer=OAuth::Consumer.new(
|
28
|
-
:site=>"https://agree2"
|
29
|
-
})
|
27
|
+
@consumer = OAuth::Consumer.new("key","secret", :site => "https://agree2")
|
30
28
|
|
31
29
|
Start the process by requesting a token
|
32
30
|
|
33
|
-
@request_token
|
34
|
-
session[:request_token]
|
31
|
+
@request_token = @consumer.get_request_token
|
32
|
+
session[:request_token] = @request_token
|
35
33
|
redirect_to @request_token.authorize_url
|
36
34
|
|
37
35
|
When user returns create an access_token
|
38
36
|
|
39
|
-
@access_token
|
40
|
-
@photos
|
37
|
+
@access_token = @request_token.get_access_token
|
38
|
+
@photos = @access_token.get('/photos.xml')
|
41
39
|
|
42
40
|
For more detailed instructions I have written this OAuth Client Tutorial http://stakeventures.com/articles/2008/02/23/developing-oauth-clients-in-ruby and "How to turn your rails site into an OAuth Provider ":http://stakeventures.com/articles/2007/11/26/how-to-turn-your-rails-site-into-an-oauth-provider .
|
43
41
|
|
@@ -59,7 +57,7 @@ http://groups.google.com/group/oauth-ruby
|
|
59
57
|
|
60
58
|
Read the "8 steps for fixing other people's code" http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/.
|
61
59
|
|
62
|
-
The source code is now hosted on the OAuth GitHub Project http://github.com/
|
60
|
+
The source code is now hosted on the OAuth GitHub Project http://github.com/mojodna/oauth
|
63
61
|
|
64
62
|
To submit a patch, please fork the oauth project and create a patch with tests. Once you're happy with it send a pull request and post a message to the google group.
|
65
63
|
|
data/Rakefile
CHANGED
@@ -6,21 +6,23 @@ require 'oauth/version'
|
|
6
6
|
# Generate all the Rake tasks
|
7
7
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
8
8
|
$hoe = Hoe.new('oauth', OAuth::VERSION) do |p|
|
9
|
-
p.author = ['Pelle Braendgaard','Blaine Cook','Larry Halff','Jesse Clark','Jon Crosby', 'Seth Fitzsimmons']
|
10
|
-
p.email = "
|
9
|
+
p.author = ['Pelle Braendgaard','Blaine Cook','Larry Halff','Jesse Clark','Jon Crosby', 'Seth Fitzsimmons']
|
10
|
+
p.email = "oauth-ruby@googlegroups.com"
|
11
11
|
p.description = "OAuth Core Ruby implementation"
|
12
12
|
p.summary = p.description
|
13
13
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
14
14
|
p.rubyforge_name = p.name # TODO this is default value
|
15
15
|
p.url = "http://oauth.rubyforge.org"
|
16
|
-
|
16
|
+
|
17
17
|
p.extra_deps = [
|
18
18
|
['ruby-hmac','>= 0.3.1']
|
19
19
|
]
|
20
20
|
p.extra_dev_deps = [
|
21
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
21
|
+
['newgem', ">= #{::Newgem::VERSION}"],
|
22
|
+
['actionpack'],
|
23
|
+
['rack']
|
22
24
|
]
|
23
|
-
|
25
|
+
|
24
26
|
p.clean_globs |= %w[**/.DS_Store tmp *.log **/.*.sw? *.gem .config **/.DS_Store]
|
25
27
|
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
26
28
|
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
data/TODO
CHANGED
@@ -12,3 +12,20 @@ Common use-cases should be streamlined:
|
|
12
12
|
errors, if available).
|
13
13
|
* I want to host an OAuth-enabled web service.
|
14
14
|
* I want to test my OAuth-enabled web service (i.e. test helpers)
|
15
|
+
|
16
|
+
Example applications for:
|
17
|
+
* Ning
|
18
|
+
* Fire Eagle
|
19
|
+
* Google (blogger, contacts)
|
20
|
+
* Twitter
|
21
|
+
* YOS / YQL
|
22
|
+
* Netflix
|
23
|
+
|
24
|
+
In addition to providing best practices of use, these can also be part of
|
25
|
+
the pre-release checks to make sure that there have been no regressions.
|
26
|
+
|
27
|
+
Random TODOs:
|
28
|
+
* finish CLI
|
29
|
+
* sensible Exception hierarchy
|
30
|
+
* Tokens as Modules
|
31
|
+
* don't tie to Net::HTTP
|
data/bin/oauth
CHANGED
data/examples/yql.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby -rubygems
|
2
|
+
|
3
|
+
# Sample queries:
|
4
|
+
# ./yql.rb --consumer-key <key> --consumer-secret <secret> "show tables"
|
5
|
+
# ./yql.rb --consumer-key <key> --consumer-secret <secret> "select * from flickr.photos.search where text='Cat' limit 10"
|
6
|
+
|
7
|
+
require 'oauth'
|
8
|
+
require 'optparse'
|
9
|
+
require 'json'
|
10
|
+
require 'pp'
|
11
|
+
|
12
|
+
options = {}
|
13
|
+
|
14
|
+
option_parser = OptionParser.new do |opts|
|
15
|
+
opts.banner = "Usage: #{$0} [options] <query>"
|
16
|
+
|
17
|
+
opts.on("--consumer-key KEY", "Specifies the consumer key to use.") do |v|
|
18
|
+
options[:consumer_key] = v
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on("--consumer-secret SECRET", "Specifies the consumer secret to use.") do |v|
|
22
|
+
options[:consumer_secret] = v
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
option_parser.parse!
|
27
|
+
query = ARGV.pop
|
28
|
+
query = STDIN.read if query == "-"
|
29
|
+
|
30
|
+
if options[:consumer_key].nil? || options[:consumer_secret].nil? || query.nil?
|
31
|
+
puts option_parser.help
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
|
35
|
+
consumer = OAuth::Consumer.new \
|
36
|
+
options[:consumer_key],
|
37
|
+
options[:consumer_secret],
|
38
|
+
:site => "http://query.yahooapis.com"
|
39
|
+
|
40
|
+
access_token = OAuth::AccessToken.new(consumer)
|
41
|
+
|
42
|
+
response = access_token.request(:get, "/v1/yql?q=#{OAuth::Helper.escape(query)}&format=json")
|
43
|
+
rsp = JSON.parse(response.body)
|
44
|
+
pp rsp
|