oauth-plugin 0.4.0.pre3 → 0.4.0.pre4
Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
0.4.0-pre4
|
2
|
+
- Fixed bug when creating a new user from a new consumer token
|
3
|
+
- Fix typo in consumer token [krasio]
|
4
|
+
- Fix issue with mongoid not supporting find_by_x style queries. [3en]
|
1
5
|
0.4.0-pre3
|
2
6
|
- Experimental rack filter for OAuth 1.0a:
|
3
7
|
see lib/oauth/rack/oauth_filter.rb for details
|
@@ -2,4 +2,10 @@ require 'oauth/models/consumers/token'
|
|
2
2
|
class ConsumerToken < ActiveRecord::Base
|
3
3
|
include Oauth::Models::Consumers::Token
|
4
4
|
|
5
|
+
# You can safely remove this callback if you don't allow login from any of your services
|
6
|
+
before_create :create_user
|
7
|
+
|
8
|
+
# Modify this with class_name etc to match your application
|
9
|
+
belongs_to :user
|
10
|
+
|
5
11
|
end
|
data/lib/oauth-plugin/version.rb
CHANGED
@@ -75,7 +75,7 @@ module Oauth
|
|
75
75
|
throw RecordNotFound unless OAUTH_CREDENTIALS.include?(consumer_key)
|
76
76
|
deny_access! unless logged_in? || OAUTH_CREDENTIALS[consumer_key][:allow_login]
|
77
77
|
@consumer="#{consumer_key.to_s.camelcase}Token".constantize
|
78
|
-
@token=@consumer.
|
78
|
+
@token=@consumer.find(:first, :conditions=>{:user_id=>current_user.id.to_s}) if logged_in?
|
79
79
|
end
|
80
80
|
|
81
81
|
# Override this in you controller to deny user or redirect to login screen.
|
@@ -43,7 +43,7 @@ module Oauth
|
|
43
43
|
user.consumer_tokens.first(:conditions=>{:type=>self.to_s,:token=>access_token.token}) ||
|
44
44
|
user.consumer_tokens.create!(:type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
|
45
45
|
else
|
46
|
-
ConsumerToken.first( :token=>access_token.token,:type=>self.to_s) ||
|
46
|
+
ConsumerToken.first( :conditions =>{ :token=>access_token.token,:type=>self.to_s}) ||
|
47
47
|
create(:type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
|
48
48
|
end
|
49
49
|
end
|
@@ -63,7 +63,7 @@ module Oauth
|
|
63
63
|
# Main client for interfacing with remote service. Override this to use
|
64
64
|
# preexisting library eg. Twitter gem.
|
65
65
|
def client
|
66
|
-
@client||=OAuth::AccessToken.new
|
66
|
+
@client||=OAuth::AccessToken.new self.class.consumer,token,secret
|
67
67
|
end
|
68
68
|
|
69
69
|
def simple_client
|
@@ -86,4 +86,4 @@ module Oauth
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
89
|
-
end
|
89
|
+
end
|
metadata
CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
|
|
6
6
|
- 0
|
7
7
|
- 4
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.4.0.
|
9
|
+
- pre4
|
10
|
+
version: 0.4.0.pre4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pelle Braendgaard
|
@@ -75,7 +75,6 @@ files:
|
|
75
75
|
- README.rdoc
|
76
76
|
- Rakefile
|
77
77
|
- UPGRADE.rdoc
|
78
|
-
- VERSION
|
79
78
|
- generators/oauth_consumer/USAGE
|
80
79
|
- generators/oauth_consumer/oauth_consumer_generator.rb
|
81
80
|
- generators/oauth_consumer/templates/consumer_token.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.4.0.pre3
|