# is optional.
def setup_user_auth
# try and setup using OAuth
- if Authenticator.new(self, [:token]).allow?
- @user = current_token.user
- else
+ if not Authenticator.new(self, [:token]).allow?
username, passwd = get_auth_data # parse from headers
# authenticate per-scheme
if username.nil?
return [user, pass]
end
+ # used by oauth plugin to set the current user
+ def current_user=(user)
+ @user=user
+ end
+
# override to stop oauth plugin sending errors
def invalid_oauth_response
end
--- /dev/null
+require 'oauth/rack/oauth_filter'
+
+Rails.configuration.middleware.use OAuth::Rack::OAuthFilter
+
+module OAuth::RequestProxy
+ class RackRequest
+ def method
+ request.request_method
+ end
+ end
+end