Switch to using oauth-plugin as a gem

Use the oauth-plugin as a gem instead of carrying a local copy.

This also required that commit eff06faf46 be
reverted as it changed the plugin. I don't think the cosmetic improvement
from that patch is worth the hassle of carrying local changes to the plugin.
This commit is contained in:
Tom Hughes 2010-05-24 12:56:23 +01:00
parent 6e7acd171f
commit 41a123334b
50 changed files with 28 additions and 2521 deletions

View file

@ -6,6 +6,16 @@ class ClientApplication < ActiveRecord::Base
validates_uniqueness_of :key
before_validation_on_create :generate_keys
def self.find_token(token_key)
token = OauthToken.find_by_token(token_key, :include => :client_application)
if token && token.authorized?
logger.info "Loaded #{token.token} which was authorized by (user_id=#{token.user_id}) on the #{token.authorized_at}"
token
else
nil
end
end
def self.verify_request(request, options = {}, &block)
begin
signature = OAuth::Signature.build(request, options, &block)

View file

@ -5,16 +5,6 @@ class OauthToken < ActiveRecord::Base
validates_presence_of :client_application, :token, :secret
before_validation_on_create :generate_keys
def self.find_token(token_key)
token = OauthToken.find_by_token(token_key, :include => :client_application)
if token && token.authorized?
logger.info "Loaded #{token.token} which was authorized by (user_id=#{token.user_id}) on the #{token.authorized_at}"
token
else
nil
end
end
def invalidated?
invalidated_at != nil
end