oauth 0.5.6 → 0.5.7.pre.pre1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +454 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE +18 -17
- data/README.md +211 -0
- data/TODO +0 -0
- data/bin/oauth +2 -2
- data/lib/oauth/cli/authorize_command.rb +0 -0
- data/lib/oauth/cli/base_command.rb +1 -1
- data/lib/oauth/cli/help_command.rb +0 -0
- data/lib/oauth/cli/query_command.rb +0 -0
- data/lib/oauth/cli/sign_command.rb +0 -0
- data/lib/oauth/cli/version_command.rb +0 -0
- data/lib/oauth/cli.rb +18 -18
- data/lib/oauth/client/action_controller_request.rb +7 -7
- data/lib/oauth/client/em_http.rb +99 -99
- data/lib/oauth/client/helper.rb +22 -22
- data/lib/oauth/client/net_http.rb +5 -5
- data/lib/oauth/client.rb +0 -0
- data/lib/oauth/consumer.rb +49 -38
- data/lib/oauth/errors/error.rb +0 -0
- data/lib/oauth/errors/problem.rb +0 -0
- data/lib/oauth/errors/unauthorized.rb +3 -1
- data/lib/oauth/errors.rb +3 -3
- data/lib/oauth/helper.rb +11 -7
- data/lib/oauth/oauth.rb +0 -0
- data/lib/oauth/oauth_test_helper.rb +4 -4
- data/lib/oauth/request_proxy/action_controller_request.rb +9 -9
- data/lib/oauth/request_proxy/action_dispatch_request.rb +1 -1
- data/lib/oauth/request_proxy/base.rb +16 -16
- data/lib/oauth/request_proxy/curb_request.rb +5 -5
- data/lib/oauth/request_proxy/em_http_request.rb +18 -12
- data/lib/oauth/request_proxy/jabber_request.rb +3 -3
- data/lib/oauth/request_proxy/mock_request.rb +1 -1
- data/lib/oauth/request_proxy/net_http.rb +9 -9
- data/lib/oauth/request_proxy/rack_request.rb +4 -4
- data/lib/oauth/request_proxy/rest_client_request.rb +7 -7
- data/lib/oauth/request_proxy/typhoeus_request.rb +7 -7
- data/lib/oauth/request_proxy.rb +0 -0
- data/lib/oauth/server.rb +2 -2
- data/lib/oauth/signature/base.rb +8 -6
- data/lib/oauth/signature/hmac/sha1.rb +4 -4
- data/lib/oauth/signature/hmac/sha256.rb +4 -4
- data/lib/oauth/signature/plaintext.rb +2 -2
- data/lib/oauth/signature/rsa/sha1.rb +3 -3
- data/lib/oauth/signature.rb +0 -0
- data/lib/oauth/token.rb +5 -5
- data/lib/oauth/tokens/access_token.rb +3 -3
- data/lib/oauth/tokens/consumer_token.rb +0 -0
- data/lib/oauth/tokens/request_token.rb +0 -0
- data/lib/oauth/tokens/server_token.rb +0 -0
- data/lib/oauth/tokens/token.rb +0 -0
- data/lib/oauth/version.rb +1 -1
- data/lib/oauth.rb +8 -7
- metadata +171 -64
- data/README.rdoc +0 -88
data/README.rdoc
DELETED
@@ -1,88 +0,0 @@
|
|
1
|
-
= Ruby OAuth
|
2
|
-
|
3
|
-
== Status
|
4
|
-
|
5
|
-
{<img src="https://travis-ci.org/oauth-xx/oauth-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.com/github/oauth-xx/oauth-ruby]
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
== What
|
10
|
-
|
11
|
-
This is a RubyGem for implementing both OAuth clients and servers in Ruby applications.
|
12
|
-
|
13
|
-
See the OAuth specs http://oauth.net/core/1.0/
|
14
|
-
|
15
|
-
== Installing
|
16
|
-
|
17
|
-
sudo gem install oauth
|
18
|
-
|
19
|
-
The source code is now hosted on the OAuth GitHub Project http://github.com/oauth-xx/oauth-ruby
|
20
|
-
|
21
|
-
== The basics
|
22
|
-
|
23
|
-
This is a ruby library which is intended to be used in creating Ruby Consumer and Service Provider applications. It is NOT a Rails plugin, but could easily be used for the foundation for such a Rails plugin.
|
24
|
-
|
25
|
-
As a matter of fact it has been pulled out from an OAuth Rails GEM (https://rubygems.org/gems/oauth-plugin https://github.com/pelle/oauth-plugin) which now uses this gem as a dependency.
|
26
|
-
|
27
|
-
== Demonstration of usage
|
28
|
-
|
29
|
-
We need to specify the oauth_callback url explicitly, otherwise it defaults to "oob" (Out of Band)
|
30
|
-
|
31
|
-
callback_url = "http://127.0.0.1:3000/oauth/callback"
|
32
|
-
|
33
|
-
Create a new `OAuth::Consumer` instance by passing it a configuration hash:
|
34
|
-
|
35
|
-
oauth_consumer = OAuth::Consumer.new("key", "secret", :site => "https://agree2")
|
36
|
-
|
37
|
-
Start the process by requesting a token
|
38
|
-
|
39
|
-
request_token = oauth_consumer.get_request_token(:oauth_callback => callback_url)
|
40
|
-
|
41
|
-
session[:token] = request_token.token
|
42
|
-
session[:token_secret] = request_token.secret
|
43
|
-
redirect_to request_token.authorize_url(:oauth_callback => callback_url)
|
44
|
-
|
45
|
-
When user returns create an access_token
|
46
|
-
|
47
|
-
hash = { oauth_token: session[:token], oauth_token_secret: session[:token_secret]}
|
48
|
-
request_token = OAuth::RequestToken.from_hash(oauth_consumer, hash)
|
49
|
-
access_token = request_token.get_access_token
|
50
|
-
# For 3-legged authorization, flow oauth_verifier is passed as param in callback
|
51
|
-
# access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier])
|
52
|
-
@photos = access_token.get('/photos.xml')
|
53
|
-
|
54
|
-
Now that you have an access token, you can use Typhoeus to interact with the OAuth provider if you choose.
|
55
|
-
|
56
|
-
require 'typhoeus'
|
57
|
-
require 'oauth/request_proxy/typhoeus_request'
|
58
|
-
oauth_params = {:consumer => oauth_consumer, :token => access_token}
|
59
|
-
hydra = Typhoeus::Hydra.new
|
60
|
-
req = Typhoeus::Request.new(uri, options) # :method needs to be specified in options
|
61
|
-
oauth_helper = OAuth::Client::Helper.new(req, oauth_params.merge(:request_uri => uri))
|
62
|
-
req.options[:headers].merge!({"Authorization" => oauth_helper.header}) # Signs the request
|
63
|
-
hydra.queue(req)
|
64
|
-
hydra.run
|
65
|
-
@response = req.response
|
66
|
-
|
67
|
-
|
68
|
-
== More Information
|
69
|
-
|
70
|
-
* RDoc: http://rdoc.info/github/oauth-xx/oauth-ruby/master/frames
|
71
|
-
* Mailing List/Google Group: http://groups.google.com/group/oauth-ruby
|
72
|
-
|
73
|
-
== How to submit patches
|
74
|
-
|
75
|
-
The source code is now hosted on the OAuth GitHub Project http://github.com/oauth-xx/oauth-ruby
|
76
|
-
|
77
|
-
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.
|
78
|
-
|
79
|
-
== License
|
80
|
-
|
81
|
-
This code is free to use under the terms of the MIT license.
|
82
|
-
|
83
|
-
== Contact
|
84
|
-
|
85
|
-
OAuth Ruby has been created and maintained by a large number of talented individuals.
|
86
|
-
The current maintainer is Aaron Quint (quirkey).
|
87
|
-
|
88
|
-
Comments are welcome. Send an email to via the OAuth Ruby mailing list http://groups.google.com/group/oauth-ruby
|