mbleigh-twitter-auth 0.1.16 → 0.1.18

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -29,6 +29,15 @@ This will generate a migration as well as set up the stubs needed to use the Rai
29
29
 
30
30
  Finally, it will create a configuration file in `config/twitter_auth.yml` in which you should input your OAuth consumer key and secret (if using the OAuth strategy) as well as a custom callback for development (the `oauth_callback` option is where Twitter will send the browser after authentication is complete. If you leave it blank Twitter will send it to the URL set up when you registered your application).
31
31
 
32
+ Sign in with Twitter
33
+ --------------------
34
+
35
+ Twitter recently implemented a convenience layer on top of OAuth called [Sign in with Twitter](http://apiwiki.twitter.com/Sign-in-with-Twitter). TwitterAuth makes use of this by default in newly generated applications by setting the `authorize_path` in `twitter_auth.yml`.
36
+
37
+ If you already have an application utilizing TwitterAuth that you would like to utilize the new system, simply add this line to your `twitter_auth.yml` in each environment:
38
+
39
+ authorize_path: "/oauth/authenticate"
40
+
32
41
  Usage Basics
33
42
  ------------
34
43
 
@@ -84,7 +93,7 @@ Tips and Tricks
84
93
  Resources
85
94
  ---------
86
95
 
87
- * **Bug Reports:** See the [Lighthouse Project](http://mbleigh.lighthouseapp.com/projects/27783-twitterauth) to report any problems you have using TwitterAuth.
96
+ * **Bug Reports:** See the [Issues Page](http://github.com/mbleigh/twitter-auth/issues) to report any problems you have using TwitterAuth.
88
97
  * **Blog Post:** The [original blog post about TwitterAuth](http://intridea.com/2009/3/23/twitter-auth-for-near-instant-twitter-apps) has a tutorial as well to get you started.
89
98
  * **GitHub Pages:** TwitterAuth has a [simple GitHub page](http://mbleigh.com/twitter-auth)
90
99
 
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ begin
18
18
  s.email = "michael@intridea.com"
19
19
  s.homepage = "http://github.com/mbleigh/twitter-auth"
20
20
  s.description = "TwitterAuth is a Rails plugin gem that provides Single Sign-On capabilities for Rails applications via Twitter. Both OAuth and HTTP Basic are supported."
21
- s.files = FileList["[A-Z]*", "{bin,generators,lib,spec,config,app,rails}/**/*"]
21
+ s.files = FileList["[A-Z]*", "{bin,generators,lib,spec,config,app,rails}/**/*"] - FileList["**/*.log"]
22
22
 
23
23
  s.authors = ["Michael Bleigh"]
24
24
  s.add_dependency('oauth', '>= 0.3.1')
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 16
4
+ :patch: 18
@@ -4,6 +4,7 @@ development:
4
4
  oauth_consumer_key: devkey
5
5
  oauth_consumer_secret: devsecret
6
6
  base_url: "https://twitter.com"
7
+ authorize_path: "/oauth/authenticate"
7
8
  api_timeout: 10
8
9
  remember_for: 14 # days
9
10
  oauth_callback: "http://localhost:3000/oauth_callback"
@@ -12,13 +13,15 @@ test:
12
13
  oauth_consumer_key: testkey
13
14
  oauth_consumer_secret: testsecret
14
15
  base_url: "https://twitter.com"
16
+ authorize_path: "/oauth/authenticate"
15
17
  api_timeout: 10
16
18
  remember_for: 14 # days
17
19
  oauth_callback: "http://localhost:3000/oauth_callback"
18
20
  production:
19
21
  strategy: oauth
20
22
  oauth_consumer_key: prodkey
21
- oauth_consumer_secret: prodsecret
23
+ oauth_consumer_secret: prodsecret
24
+ authorize_path: "/oauth/authenticate"
22
25
  base_url: "https://twitter.com"
23
26
  api_timeout: 10
24
27
  remember_for: 14 # days
data/lib/twitter_auth.rb CHANGED
@@ -56,10 +56,18 @@ module TwitterAuth
56
56
 
57
57
  # The OAuth consumer used by TwitterAuth for authentication. The consumer key and secret are set in your application's +config/twitter.yml+
58
58
  def self.consumer
59
+ options = {:site => TwitterAuth.base_url}
60
+ [ :authorize_path,
61
+ :request_token_path,
62
+ :access_token_path,
63
+ :scheme ].each do |oauth_option|
64
+ options[oauth_option] = TwitterAuth.config[oauth_option.to_s] if TwitterAuth.config[oauth_option.to_s]
65
+ end
66
+
59
67
  OAuth::Consumer.new(
60
68
  config['oauth_consumer_key'],
61
69
  config['oauth_consumer_secret'],
62
- :site => TwitterAuth.base_url
70
+ options
63
71
  )
64
72
  end
65
73
 
@@ -70,6 +78,10 @@ module TwitterAuth
70
78
  net.read_timeout = TwitterAuth.api_timeout
71
79
  net
72
80
  end
81
+
82
+ def self.authorize_path
83
+ config['authorize_path'] || '/oauth/authorize'
84
+ end
73
85
  end
74
86
 
75
87
  require 'twitter_auth/controller_extensions'
@@ -11,6 +11,12 @@ describe TwitterAuth do
11
11
  TwitterAuth.stub!(:config).and_return({'base_url' => 'https://example.com'})
12
12
  TwitterAuth.base_url.should == 'https://example.com'
13
13
  end
14
+
15
+ it 'should utilize oauth consumer settings' do
16
+ @config = TwitterAuth.config
17
+ TwitterAuth.stub!(:config).and_return(@config.merge('authorize_path' => '/somewhere_else'))
18
+ TwitterAuth.consumer.authorize_path.should == '/somewhere_else'
19
+ end
14
20
  end
15
21
 
16
22
  describe ".path_prefix" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mbleigh-twitter-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-31 00:00:00 -07:00
12
+ date: 2009-04-17 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency