oauth-plugin 0.4.0.pre2 → 0.4.0.pre3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ doc
2
+ pkg
3
+ *.log
4
+ .DS_Store
5
+ .svn
6
+ *.gem
7
+ .bundle
8
+ .swp
data/CHANGELOG CHANGED
@@ -1,5 +1,10 @@
1
- 0.4.0
2
- - Fixed bug with AR ORM Generator [theirix]
1
+ 0.4.0-pre3
2
+ - Experimental rack filter for OAuth 1.0a:
3
+ see lib/oauth/rack/oauth_filter.rb for details
4
+ 0.4.0-pre2
5
+ - mongoid defaults to being embedded
6
+ - new :auto_login option in oauth_config.rb which lets you use eg. twitter as a primary authentication method
7
+ 0.4.0-pre1
3
8
  - mongoid support in rails 3 [Alexander Semyonov]
4
9
  - OAUTH 2.0 authorization_code and password grant types
5
10
  - Supports OAuth 2.0 draft 10 (Note this is incompatible with previous drafts)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in oauth-plugin.gemspec
4
+ gemspec
data/Rakefile CHANGED
@@ -1,43 +1,2 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- desc 'Test the oauth plugin.'
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.pattern = 'test/**/*_test.rb'
12
- t.verbose = true
13
- end
14
-
15
- desc 'Generate documentation for the oauth plugin.'
16
- Rake::RDocTask.new(:rdoc) do |rdoc|
17
- rdoc.rdoc_dir = 'rdoc'
18
- rdoc.title = 'OAuth Plugin'
19
- rdoc.options << '--line-numbers' << '--inline-source'
20
- rdoc.rdoc_files.include('README')
21
- rdoc.rdoc_files.include('lib/**/*.rb')
22
- end
23
-
24
- begin
25
- require 'jeweler'
26
- Jeweler::Tasks.new do |gemspec|
27
- gemspec.name = "oauth-plugin"
28
- gemspec.summary = "Ruby on Rails Plugin for OAuth Provider and Consumer"
29
- gemspec.description = "Rails plugin for implementing an OAuth Provider or Consumer"
30
- gemspec.email = "oauth-ruby@googlegroups.com"
31
- gemspec.homepage = "http://github.com/pelle/oauth-plugin"
32
- gemspec.authors = ["Pelle Braendgaard"]
33
- gemspec.add_dependency('oauth', '>= 0.4.4')
34
- gemspec.rubyforge_project = 'oauth'
35
- end
36
-
37
- Jeweler::RubyforgeTasks.new do |rubyforge|
38
- rubyforge.doc_task = "rdoc"
39
- end
40
-
41
- rescue LoadError
42
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
43
- end
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/UPGRADE.rdoc ADDED
@@ -0,0 +1,21 @@
1
+ A few non backwards compatible changes have been made that are really easy to fix.
2
+
3
+ If you are upgrading a oauth_consumer from 0.3.x to 0.4.x add the following line to your consumer_token model:
4
+
5
+ belongs_to :user
6
+
7
+ So it looks like this:
8
+
9
+ require 'oauth/models/consumers/token'
10
+ class ConsumerToken < ActiveRecord::Base
11
+ include Oauth::Models::Consumers::Token
12
+ belongs_to :user
13
+ end
14
+
15
+ You should also upgrade your oauth_consumer_controller as we no longer call login_required in the library. This should make it easier for implementing it with other authentication frameworks:
16
+
17
+ require 'oauth/controllers/consumer_controller'
18
+ class OauthConsumersController < ApplicationController
19
+ include Oauth::Controllers::ConsumerController
20
+ # Replace this with the equivalent for your authentication framework
21
+ before_filter :login_required, :only=>:index
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0.pre2
1
+ 0.4.0.pre3
@@ -1,5 +1,11 @@
1
1
  require 'oauth/models/consumers/token'
2
2
  class ConsumerToken < ActiveRecord::Base
3
3
  include Oauth::Models::Consumers::Token
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
4
9
  belongs_to :user
10
+
5
11
  end
@@ -3,12 +3,37 @@ class ConsumerToken
3
3
  include Mongoid::Document
4
4
  include Mongoid::Timestamps
5
5
  include Oauth::Models::Consumers::Token
6
+
7
+ # You can safely remove this callback if you don't allow login from any of your services
8
+ before_create :create_user
6
9
 
7
10
  field :token, :type => String
8
11
  field :secret, :type => String
9
12
 
10
- index :token, :unique => true
13
+ index :token
11
14
 
12
- referenced_in :user
15
+ # Add the following to your user model:
16
+ #
17
+ # embeds_many :consumer_tokens
18
+ # index "consumer_tokens.token"
19
+ #
20
+ embedded_in :user, :inverse_of => :consumer_tokens
21
+
22
+ def self.find_or_create_from_access_token(user,access_token)
23
+ if user
24
+ user.consumer_tokens.first(:conditions=>{:_type=>self.to_s,:token=>access_token.token}) ||
25
+ user.consumer_tokens.create!(:_type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
26
+ else
27
+ # Is there a better way of doing this in mongoid?
28
+ # Please submit a patch
29
+ user = User.first(:conditions=>{:_type=>self.to_s,"consumer_tokens.token"=>access_token.token})
30
+ if user
31
+ user.consumer_tokens.detect{|t| t.token==access_token.token && t.is_a?(self)}
32
+ else
33
+ user = User.create
34
+ user.consumer_tokens.create!(:_type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
35
+ end
36
+ end
37
+ end
13
38
 
14
39
  end
@@ -1,8 +1,11 @@
1
- This creates an OAuth Provider controller as well as requisite models.
1
+ This creates an OAuth Consumer controller as well as requisite models.
2
2
 
3
3
  It requires an authentication framework such as acts_as_authenticated, restful_authentication or restful_open_id_authentication that provides the methods "login_required" and "current_user".
4
4
 
5
+ See comments in generated controller for more info about overriding these.
6
+
5
7
  If you generated the migration file (true by default), make sure you run
6
- rake db:migrate
8
+
9
+ rake db:migrate
7
10
 
8
11
  See README.rdoc for more.
@@ -1,6 +1,11 @@
1
1
  require 'oauth/controllers/consumer_controller'
2
2
  class OauthConsumersController < ApplicationController
3
3
  include Oauth::Controllers::ConsumerController
4
+ # Replace this with the equivalent for your authentication framework
5
+ # Eg. for devise
6
+ #
7
+ # before_filter :authenticate_user!, :only=>:index
8
+ before_filter :login_required, :only=>:index
4
9
 
5
10
  def index
6
11
  @consumer_tokens=ConsumerToken.all :conditions=>{:user_id=>current_user.id}
@@ -16,4 +21,30 @@ class OauthConsumersController < ApplicationController
16
21
  redirect_to root_url
17
22
  end
18
23
 
24
+ # The plugin requires logged_in? to return true or false if the user is logged in. Uncomment and
25
+ # call your auth frameworks equivalent below if different. eg. for devise:
26
+ #
27
+ # def logged_in?
28
+ # user_signed_in?
29
+ # end
30
+
31
+ # The plugin requires current_user to return the current logged in user. Uncomment and
32
+ # call your auth frameworks equivalent below if different.
33
+ # def current_user
34
+ # current_person
35
+ # end
36
+
37
+ # The plugin requires a way to log a user in. Call your auth frameworks equivalent below
38
+ # if different. eg. for devise:
39
+ #
40
+ # def current_user=(user)
41
+ # sign_in(user)
42
+ # end
43
+
44
+ # Override this to deny the user or redirect to a login screen depending on your framework and app
45
+ # if different. eg. for devise:
46
+ #
47
+ # def deny_access!
48
+ # raise Acl9::AccessDenied
49
+ # end
19
50
  end
@@ -6,7 +6,8 @@
6
6
  # OAUTH_CREDENTIALS={
7
7
  # :twitter=>{
8
8
  # :key=>"",
9
- # :secret=>""
9
+ # :secret=>"",
10
+ # :allow_login => true # Use :allow_login => true to allow user to login to account
10
11
  # },
11
12
  # :google=>{
12
13
  # :key=>"",
@@ -44,10 +44,19 @@ module OAuth
44
44
  def params
45
45
  controller.send :params
46
46
  end
47
+
47
48
  def request
48
49
  controller.send :request
49
50
  end
50
51
 
52
+ def env
53
+ request.env
54
+ end
55
+
56
+ def using_rack_filter?
57
+ request.env["oauth_plugin"]
58
+ end
59
+
51
60
  def allow?
52
61
  if @strategies.any? do |strategy|
53
62
  @strategy = strategy.to_sym
@@ -77,22 +86,32 @@ module OAuth
77
86
  end
78
87
 
79
88
  def oauth10_token
80
- begin
81
- if ClientApplication.verify_request(request) do |request_proxy|
82
- @oauth_token = ClientApplication.find_token(request_proxy.token)
83
- if @oauth_token.respond_to?(:provided_oauth_verifier=)
84
- @oauth_token.provided_oauth_verifier=request_proxy.oauth_verifier
85
- end
86
- # return the token secret and the consumer secret
87
- [(@oauth_token.nil? ? nil : @oauth_token.secret), (@oauth_token.client_application.nil? ? nil : @oauth_token.client_application.secret)]
88
- end
89
+ if using_rack_filter?
90
+ if env["oauth.token"]
91
+ @oauth_token = env["oauth.token"]
89
92
  controller.send :current_token=, @oauth_token
90
93
  true
91
94
  else
92
95
  false
93
96
  end
94
- rescue
95
- false
97
+ else
98
+ begin
99
+ if ClientApplication.verify_request(request) do |request_proxy|
100
+ @oauth_token = ClientApplication.find_token(request_proxy.token)
101
+ if @oauth_token.respond_to?(:provided_oauth_verifier=)
102
+ @oauth_token.provided_oauth_verifier=request_proxy.oauth_verifier
103
+ end
104
+ # return the token secret and the consumer secret
105
+ [(@oauth_token.nil? ? nil : @oauth_token.secret), (@oauth_token.client_application.nil? ? nil : @oauth_token.client_application.secret)]
106
+ end
107
+ controller.send :current_token=, @oauth_token
108
+ true
109
+ else
110
+ false
111
+ end
112
+ rescue
113
+ false
114
+ end
96
115
  end
97
116
  end
98
117
 
@@ -109,23 +128,30 @@ module OAuth
109
128
  end
110
129
 
111
130
  def two_legged
112
- begin
113
- if ClientApplication.verify_request(request) do |request_proxy|
114
- @client_application = ClientApplication.find_by_key(request_proxy.consumer_key)
131
+ if using_rack_filter?
132
+ if env["oauth.client_application"]
133
+ @client_application = env["oauth.client_application"]
134
+ controller.send :current_client_application=, @client_application
135
+ end
136
+ else
137
+ begin
138
+ if ClientApplication.verify_request(request) do |request_proxy|
139
+ @client_application = ClientApplication.find_by_key(request_proxy.consumer_key)
115
140
 
116
- # Store this temporarily in client_application object for use in request token generation
117
- @client_application.token_callback_url=request_proxy.oauth_callback if request_proxy.oauth_callback
141
+ # Store this temporarily in client_application object for use in request token generation
142
+ @client_application.token_callback_url=request_proxy.oauth_callback if request_proxy.oauth_callback
118
143
 
119
- # return the token secret and the consumer secret
120
- [nil, @client_application.secret]
144
+ # return the token secret and the consumer secret
145
+ [nil, @client_application.secret]
146
+ end
147
+ controller.send :current_client_application=, @client_application
148
+ true
149
+ else
150
+ false
121
151
  end
122
- controller.send :current_client_application=, @client_application
123
- true
124
- else
152
+ rescue
125
153
  false
126
154
  end
127
- rescue
128
- false
129
155
  end
130
156
  end
131
157
 
@@ -3,7 +3,6 @@ module Oauth
3
3
  module ConsumerController
4
4
  def self.included(controller)
5
5
  controller.class_eval do
6
- before_filter :login_required
7
6
  before_filter :load_consumer, :except=>:index
8
7
  skip_before_filter :verify_authenticity_token,:only=>:callback
9
8
  end
@@ -13,8 +12,7 @@ module Oauth
13
12
  @consumer_tokens=ConsumerToken.all :conditions=>{:user_id=>current_user.id}
14
13
  # The services the user hasn't already connected to
15
14
  @services=OAUTH_CREDENTIALS.keys-@consumer_tokens.collect{|c| c.class.service_name}
16
- end
17
-
15
+ end
18
16
 
19
17
  # creates request token and redirects on to oauth provider's auth page
20
18
  # If user is already connected it displays a page with an option to disconnect and redo
@@ -31,11 +29,19 @@ module Oauth
31
29
  end
32
30
 
33
31
  def callback
32
+ logger.info "CALLBACK"
34
33
  @request_token_secret=session[params[:oauth_token]]
35
34
  if @request_token_secret
36
- @token=@consumer.create_from_request_token(current_user,params[:oauth_token],@request_token_secret,params[:oauth_verifier])
35
+ @token=@consumer.find_or_create_from_request_token(current_user,params[:oauth_token],@request_token_secret,params[:oauth_verifier])
36
+ session[params[:oauth_token]] = nil
37
37
  if @token
38
- flash[:notice] = "#{params[:id].humanize} was successfully connected to your account"
38
+ # Log user in
39
+ if logged_in?
40
+ flash[:notice] = "#{params[:id].humanize} was successfully connected to your account"
41
+ else
42
+ self.current_user = @token.user
43
+ flash[:notice] = "You logged in with #{params[:id].humanize}"
44
+ end
39
45
  go_back
40
46
  else
41
47
  flash[:error] = "An error happened, please try connecting again"
@@ -67,8 +73,14 @@ module Oauth
67
73
  def load_consumer
68
74
  consumer_key=params[:id].to_sym
69
75
  throw RecordNotFound unless OAUTH_CREDENTIALS.include?(consumer_key)
76
+ deny_access! unless logged_in? || OAUTH_CREDENTIALS[consumer_key][:allow_login]
70
77
  @consumer="#{consumer_key.to_s.camelcase}Token".constantize
71
- @token=@consumer.find_by_user_id current_user.id
78
+ @token=@consumer.find_by_user_id current_user.id if logged_in?
79
+ end
80
+
81
+ # Override this in you controller to deny user or redirect to login screen.
82
+ def deny_access!
83
+ head 401
72
84
  end
73
85
 
74
86
  end
@@ -10,6 +10,7 @@ if defined? ConsumerToken && defined? OAUTH_CREDENTIALS
10
10
  class_name=value[:class_name]||"#{key.to_s.classify}Token"
11
11
  unless Object.const_defined?(class_name.to_sym)
12
12
  if File.exists?(File.join(File.dirname(__FILE__), "services","#{key.to_s}_token.rb"))
13
+ Rails.logger.info File.join(File.dirname(__FILE__), "services","#{key.to_s}_token")
13
14
  require File.join(File.dirname(__FILE__), "services","#{key.to_s}_token")
14
15
  else
15
16
  begin
@@ -0,0 +1,15 @@
1
+ require 'opentransact'
2
+ class OpenTransactToken < ConsumerToken
3
+
4
+ # def self.server
5
+ # @consumer||=OpenTransact::Server.new credentials
6
+ # end
7
+
8
+ # def self.consumer
9
+ # @consumer||=server.consumer
10
+ # end
11
+
12
+ def client
13
+ @client ||= OpenTransact::Client.new self.class.credentials.merge( {:token=>token, :secret=>secret})
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ require File.join(File.dirname(__FILE__),'opentransact_token')
2
+
3
+ class PicomoneyToken < OpenTransactToken
4
+
5
+ def self.credentials
6
+ @credentials||={
7
+ :site=>"https://picomoney.com",
8
+ :consumer_key => super[:key],
9
+ :consumer_secret => super[:secret]
10
+ }.merge(super)
11
+ end
12
+
13
+ def about_user
14
+ client.get("/about_user")
15
+ end
16
+
17
+ end
@@ -26,17 +26,30 @@ module Oauth
26
26
  end
27
27
 
28
28
  def get_request_token(callback_url)
29
+ Rails.logger.info "OAUTH_CONSUMER #{consumer.inspect}"
29
30
  consumer.get_request_token(:oauth_callback=>callback_url)
30
31
  end
31
32
 
32
- def create_from_request_token(user,token,secret,oauth_verifier)
33
+ def find_or_create_from_request_token(user,token,secret,oauth_verifier)
33
34
  request_token=OAuth::RequestToken.new consumer,token,secret
34
35
  options={}
35
36
  options[:oauth_verifier]=oauth_verifier if oauth_verifier
36
37
  access_token=request_token.get_access_token options
37
- create :user_id=>user.id,:token=>access_token.token,:secret=>access_token.secret
38
+ find_or_create_from_access_token user, access_token
38
39
  end
39
40
 
41
+ def find_or_create_from_access_token(user,access_token)
42
+ if user
43
+ user.consumer_tokens.first(:conditions=>{:type=>self.to_s,:token=>access_token.token}) ||
44
+ user.consumer_tokens.create!(:type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
45
+ else
46
+ ConsumerToken.first( :token=>access_token.token,:type=>self.to_s) ||
47
+ create(:type=>self.to_s,:token=>access_token.token, :secret=>access_token.secret)
48
+ end
49
+ end
50
+
51
+ def build_user_from_token
52
+ end
40
53
  protected
41
54
 
42
55
  def credentials
@@ -50,13 +63,25 @@ module Oauth
50
63
  # Main client for interfacing with remote service. Override this to use
51
64
  # preexisting library eg. Twitter gem.
52
65
  def client
53
- @client||=OAuth::AccessToken.new self.class.consumer,token,secret
66
+ @client||=OAuth::AccessToken.new slelf.class.consumer,token,secret
54
67
  end
55
68
 
56
69
  def simple_client
57
- @simple_client||=SimpleClient.new OAuth::AccessToken.new( self.class.consumer,token,secret)
70
+ @simple_client||=SimpleClient.new client
58
71
  end
59
72
 
73
+ # Override this to return user data from service
74
+ def params_for_user
75
+ {}
76
+ end
77
+
78
+ def create_user
79
+ self.user ||= begin
80
+ User.new params_for_user
81
+ user.save(:validate=>false)
82
+ end
83
+ end
84
+
60
85
  end
61
86
  end
62
87
  end
@@ -0,0 +1,50 @@
1
+ require "rack"
2
+ require "rack/request"
3
+ require "oauth/signature"
4
+ module OAuth
5
+ module Rack
6
+
7
+ # An OAuth 1.0a filter to be used together with the oauth-plugin for rails.T
8
+ # This is still experimental
9
+ #
10
+ # Add it as middleware to your config/application.rb:
11
+ #
12
+ # require 'oauth/rack/oauth_filter'
13
+ # config.middleware.use OAuth::Rack::OAuthFilter
14
+
15
+
16
+
17
+ class OAuthFilter
18
+ def initialize(app)
19
+ @app = app
20
+ end
21
+
22
+ def call(env)
23
+ request = ::Rack::Request.new(env)
24
+ env["oauth_plugin"]=true
25
+ if ClientApplication.verify_request(request) do |request_proxy|
26
+ client_application = ClientApplication.find_by_key(request_proxy.consumer_key)
27
+ env["oauth.client_application_candidate"] = client_application
28
+ # Store this temporarily in client_application object for use in request token generation
29
+ client_application.token_callback_url=request_proxy.oauth_callback if request_proxy.oauth_callback
30
+
31
+ oauth_token = client_application.tokens.first(:conditions=>{:token => request_proxy.token})
32
+ if oauth_token.respond_to?(:provided_oauth_verifier=)
33
+ oauth_token.provided_oauth_verifier=request_proxy.oauth_verifier
34
+ end
35
+ env["oauth.token_candidate"] = oauth_token
36
+ # return the token secret and the consumer secret
37
+ [(oauth_token.nil? ? nil : oauth_token.secret), (client_application.nil? ? nil : client_application.secret)]
38
+ end
39
+ env["oauth.token"] = env["oauth.token_candidate"]
40
+ env["oauth.client_application"] = env["oauth.client_application_candidate"]
41
+ # Rails.logger.info "oauth.token = #{env["oauth.token"].inspect}"
42
+ end
43
+ env["oauth.client_application_candidate"] = nil
44
+ env["oauth.token_candidate"] = nil
45
+ response = @app.call(env)
46
+ end
47
+ end
48
+
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ module Oauth
2
+ module Plugin
3
+ VERSION = "0.4.0.pre3"
4
+ end
5
+ end
data/lib/oauth-plugin.rb CHANGED
@@ -1 +1,22 @@
1
- # leaving this empty
1
+ require 'oauth'
2
+ require 'oauth/signature/hmac/sha1'
3
+ require 'oauth/request_proxy/rack_request'
4
+ require 'oauth/server'
5
+ require 'oauth/controllers/application_controller_methods'
6
+ if Rails.version =~ /^3\./
7
+ require 'oauth/request_proxy/rack_request'
8
+ else
9
+ require 'oauth/request_proxy/action_controller_request'
10
+ ActionController::Base.send :include, OAuth::Controllers::ApplicationControllerMethods
11
+ end
12
+
13
+
14
+ module OAuth
15
+ module Plugin
16
+ class OAuthRailtie < Rails::Railtie
17
+ initializer "oauth-plugin.configure_rails_initialization" do |app|
18
+ ActionController::Base.send :include, OAuth::Controllers::ApplicationControllerMethods
19
+ end
20
+ end
21
+ end
22
+ end
data/oauth-plugin.gemspec CHANGED
@@ -1,199 +1,31 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "oauth-plugin/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = %q{oauth-plugin}
8
- s.version = "0.4.0.pre2"
7
+ s.version = Oauth::Plugin::VERSION
9
8
 
10
9
  s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
10
  s.authors = ["Pelle Braendgaard"]
12
- s.date = %q{2010-12-06}
11
+ s.date = %q{2010-12-08}
13
12
  s.description = %q{Rails plugin for implementing an OAuth Provider or Consumer}
14
13
  s.email = %q{oauth-ruby@googlegroups.com}
15
14
  s.extra_rdoc_files = [
16
15
  "README.rdoc"
17
16
  ]
18
- s.files = [
19
- "CHANGELOG",
20
- "MIT-LICENSE",
21
- "README.rdoc",
22
- "Rakefile",
23
- "VERSION",
24
- "generators/oauth_consumer/USAGE",
25
- "generators/oauth_consumer/oauth_consumer_generator.rb",
26
- "generators/oauth_consumer/templates/consumer_token.rb",
27
- "generators/oauth_consumer/templates/controller.rb",
28
- "generators/oauth_consumer/templates/index.html.erb",
29
- "generators/oauth_consumer/templates/index.html.haml",
30
- "generators/oauth_consumer/templates/migration.rb",
31
- "generators/oauth_consumer/templates/oauth_config.rb",
32
- "generators/oauth_consumer/templates/show.html.erb",
33
- "generators/oauth_consumer/templates/show.html.haml",
34
- "generators/oauth_provider/USAGE",
35
- "generators/oauth_provider/lib/insert_routes.rb",
36
- "generators/oauth_provider/oauth_provider_generator.rb",
37
- "generators/oauth_provider/templates/_form.html.erb",
38
- "generators/oauth_provider/templates/_form.html.haml",
39
- "generators/oauth_provider/templates/access_token.rb",
40
- "generators/oauth_provider/templates/authorize.html.erb",
41
- "generators/oauth_provider/templates/authorize.html.haml",
42
- "generators/oauth_provider/templates/authorize_failure.html.erb",
43
- "generators/oauth_provider/templates/authorize_failure.html.haml",
44
- "generators/oauth_provider/templates/authorize_success.html.erb",
45
- "generators/oauth_provider/templates/authorize_success.html.haml",
46
- "generators/oauth_provider/templates/client_application.rb",
47
- "generators/oauth_provider/templates/client_application_spec.rb",
48
- "generators/oauth_provider/templates/client_application_test.rb",
49
- "generators/oauth_provider/templates/client_applications.yml",
50
- "generators/oauth_provider/templates/clients_controller.rb",
51
- "generators/oauth_provider/templates/clients_controller_spec.rb",
52
- "generators/oauth_provider/templates/clients_controller_test.rb",
53
- "generators/oauth_provider/templates/controller.rb",
54
- "generators/oauth_provider/templates/controller_spec.rb",
55
- "generators/oauth_provider/templates/controller_spec_helper.rb",
56
- "generators/oauth_provider/templates/controller_test.rb",
57
- "generators/oauth_provider/templates/controller_test_helper.rb",
58
- "generators/oauth_provider/templates/edit.html.erb",
59
- "generators/oauth_provider/templates/edit.html.haml",
60
- "generators/oauth_provider/templates/index.html.erb",
61
- "generators/oauth_provider/templates/index.html.haml",
62
- "generators/oauth_provider/templates/migration.rb",
63
- "generators/oauth_provider/templates/new.html.erb",
64
- "generators/oauth_provider/templates/new.html.haml",
65
- "generators/oauth_provider/templates/oauth2_authorize.html.erb",
66
- "generators/oauth_provider/templates/oauth2_authorize.html.haml",
67
- "generators/oauth_provider/templates/oauth2_token.rb",
68
- "generators/oauth_provider/templates/oauth2_token_spec.rb",
69
- "generators/oauth_provider/templates/oauth2_verifier.rb",
70
- "generators/oauth_provider/templates/oauth2_verifier_spec.rb",
71
- "generators/oauth_provider/templates/oauth_nonce.rb",
72
- "generators/oauth_provider/templates/oauth_nonce_spec.rb",
73
- "generators/oauth_provider/templates/oauth_nonce_test.rb",
74
- "generators/oauth_provider/templates/oauth_nonces.yml",
75
- "generators/oauth_provider/templates/oauth_token.rb",
76
- "generators/oauth_provider/templates/oauth_token_spec.rb",
77
- "generators/oauth_provider/templates/oauth_token_test.rb",
78
- "generators/oauth_provider/templates/oauth_tokens.yml",
79
- "generators/oauth_provider/templates/request_token.rb",
80
- "generators/oauth_provider/templates/show.html.erb",
81
- "generators/oauth_provider/templates/show.html.haml",
82
- "init.rb",
83
- "install.rb",
84
- "lib/generators/active_record/oauth_consumer_generator.rb",
85
- "lib/generators/active_record/oauth_consumer_templates/consumer_token.rb",
86
- "lib/generators/active_record/oauth_consumer_templates/migration.rb",
87
- "lib/generators/active_record/oauth_provider_generator.rb",
88
- "lib/generators/active_record/oauth_provider_templates/access_token.rb",
89
- "lib/generators/active_record/oauth_provider_templates/client_application.rb",
90
- "lib/generators/active_record/oauth_provider_templates/migration.rb",
91
- "lib/generators/active_record/oauth_provider_templates/oauth2_token.rb",
92
- "lib/generators/active_record/oauth_provider_templates/oauth2_verifier.rb",
93
- "lib/generators/active_record/oauth_provider_templates/oauth_nonce.rb",
94
- "lib/generators/active_record/oauth_provider_templates/oauth_token.rb",
95
- "lib/generators/active_record/oauth_provider_templates/request_token.rb",
96
- "lib/generators/erb/oauth_consumer_generator.rb",
97
- "lib/generators/erb/oauth_consumer_templates/index.html.erb",
98
- "lib/generators/erb/oauth_consumer_templates/show.html.erb",
99
- "lib/generators/erb/oauth_provider_generator.rb",
100
- "lib/generators/erb/oauth_provider_templates/_form.html.erb",
101
- "lib/generators/erb/oauth_provider_templates/authorize.html.erb",
102
- "lib/generators/erb/oauth_provider_templates/authorize_failure.html.erb",
103
- "lib/generators/erb/oauth_provider_templates/authorize_success.html.erb",
104
- "lib/generators/erb/oauth_provider_templates/edit.html.erb",
105
- "lib/generators/erb/oauth_provider_templates/index.html.erb",
106
- "lib/generators/erb/oauth_provider_templates/new.html.erb",
107
- "lib/generators/erb/oauth_provider_templates/oauth2_authorize.html.erb",
108
- "lib/generators/erb/oauth_provider_templates/show.html.erb",
109
- "lib/generators/haml/oauth_consumer_generator.rb",
110
- "lib/generators/haml/oauth_consumer_templates/index.html.haml",
111
- "lib/generators/haml/oauth_consumer_templates/show.html.haml",
112
- "lib/generators/haml/oauth_provider_generator.rb",
113
- "lib/generators/haml/oauth_provider_templates/_form.html.haml",
114
- "lib/generators/haml/oauth_provider_templates/authorize.html.haml",
115
- "lib/generators/haml/oauth_provider_templates/authorize_failure.html.haml",
116
- "lib/generators/haml/oauth_provider_templates/authorize_success.html.haml",
117
- "lib/generators/haml/oauth_provider_templates/edit.html.haml",
118
- "lib/generators/haml/oauth_provider_templates/index.html.haml",
119
- "lib/generators/haml/oauth_provider_templates/new.html.haml",
120
- "lib/generators/haml/oauth_provider_templates/oauth2_authorize.html.haml",
121
- "lib/generators/haml/oauth_provider_templates/show.html.haml",
122
- "lib/generators/mongoid/oauth_consumer_generator.rb",
123
- "lib/generators/mongoid/oauth_consumer_templates/consumer_token.rb",
124
- "lib/generators/mongoid/oauth_provider_generator.rb",
125
- "lib/generators/mongoid/oauth_provider_templates/access_token.rb",
126
- "lib/generators/mongoid/oauth_provider_templates/client_application.rb",
127
- "lib/generators/mongoid/oauth_provider_templates/oauth2_token.rb",
128
- "lib/generators/mongoid/oauth_provider_templates/oauth2_verifier.rb",
129
- "lib/generators/mongoid/oauth_provider_templates/oauth_nonce.rb",
130
- "lib/generators/mongoid/oauth_provider_templates/oauth_token.rb",
131
- "lib/generators/mongoid/oauth_provider_templates/request_token.rb",
132
- "lib/generators/oauth_consumer/USAGE",
133
- "lib/generators/oauth_consumer/oauth_consumer_generator.rb",
134
- "lib/generators/oauth_consumer/templates/controller.rb",
135
- "lib/generators/oauth_consumer/templates/oauth_config.rb",
136
- "lib/generators/oauth_inflections.rb",
137
- "lib/generators/oauth_plugin.rb",
138
- "lib/generators/oauth_provider/USAGE",
139
- "lib/generators/oauth_provider/oauth_provider_generator.rb",
140
- "lib/generators/oauth_provider/templates/clients_controller.rb",
141
- "lib/generators/oauth_provider/templates/controller.rb",
142
- "lib/generators/rspec/oauth_provider_generator.rb",
143
- "lib/generators/rspec/templates/client_application_spec.rb",
144
- "lib/generators/rspec/templates/client_applications.yml",
145
- "lib/generators/rspec/templates/clients_controller_spec.rb",
146
- "lib/generators/rspec/templates/controller_spec.rb",
147
- "lib/generators/rspec/templates/controller_spec_helper.rb",
148
- "lib/generators/rspec/templates/oauth2_token_spec.rb",
149
- "lib/generators/rspec/templates/oauth2_verifier_spec.rb",
150
- "lib/generators/rspec/templates/oauth_nonce_spec.rb",
151
- "lib/generators/rspec/templates/oauth_nonces.yml",
152
- "lib/generators/rspec/templates/oauth_token_spec.rb",
153
- "lib/generators/rspec/templates/oauth_tokens.yml",
154
- "lib/generators/test_unit/oauth_provider_generator.rb",
155
- "lib/generators/test_unit/templates/client_application_test.rb",
156
- "lib/generators/test_unit/templates/client_applications.yml",
157
- "lib/generators/test_unit/templates/clients_controller_test.rb",
158
- "lib/generators/test_unit/templates/controller_test.rb",
159
- "lib/generators/test_unit/templates/controller_test_helper.rb",
160
- "lib/generators/test_unit/templates/oauth_nonce_test.rb",
161
- "lib/generators/test_unit/templates/oauth_nonces.yml",
162
- "lib/generators/test_unit/templates/oauth_token_test.rb",
163
- "lib/generators/test_unit/templates/oauth_tokens.yml",
164
- "lib/oauth-plugin.rb",
165
- "lib/oauth/controllers/application_controller_methods.rb",
166
- "lib/oauth/controllers/consumer_controller.rb",
167
- "lib/oauth/controllers/provider_controller.rb",
168
- "lib/oauth/models/consumers/service_loader.rb",
169
- "lib/oauth/models/consumers/services/agree2_token.rb",
170
- "lib/oauth/models/consumers/services/fireeagle_token.rb",
171
- "lib/oauth/models/consumers/services/google_token.rb",
172
- "lib/oauth/models/consumers/services/twitter_token.rb",
173
- "lib/oauth/models/consumers/simple_client.rb",
174
- "lib/oauth/models/consumers/token.rb",
175
- "oauth-plugin.gemspec",
176
- "rails/init.rb",
177
- "tasks/oauth_tasks.rake",
178
- "uninstall.rb"
179
- ]
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+
180
21
  s.homepage = %q{http://github.com/pelle/oauth-plugin}
181
22
  s.require_paths = ["lib"]
182
23
  s.rubyforge_project = %q{oauth}
183
24
  s.rubygems_version = %q{1.3.7}
184
25
  s.summary = %q{Ruby on Rails Plugin for OAuth Provider and Consumer}
26
+ s.add_development_dependency "twitter"
27
+ s.add_development_dependency "opentransact"
185
28
 
186
- if s.respond_to? :specification_version then
187
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
188
- s.specification_version = 3
189
-
190
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
191
- s.add_runtime_dependency(%q<oauth>, [">= 0.4.4"])
192
- else
193
- s.add_dependency(%q<oauth>, [">= 0.4.4"])
194
- end
195
- else
196
- s.add_dependency(%q<oauth>, [">= 0.4.4"])
197
- end
29
+ s.add_dependency(%q<oauth>, [">= 0.4.4"])
198
30
  end
199
31
 
data/rails/init.rb CHANGED
@@ -1,11 +1 @@
1
- require 'oauth'
2
- require 'oauth/signature/hmac/sha1'
3
- if Rails.version =~ /^3\./
4
- require 'oauth/request_proxy/rack_request'
5
- else
6
- require 'oauth/request_proxy/action_controller_request'
7
- end
8
- require 'oauth/server'
9
- require 'oauth/controllers/application_controller_methods'
10
-
11
- ActionController::Base.send :include, OAuth::Controllers::ApplicationControllerMethods
1
+ require 'oauth-plugin'
metadata CHANGED
@@ -6,8 +6,8 @@ version: !ruby/object:Gem::Version
6
6
  - 0
7
7
  - 4
8
8
  - 0
9
- - pre2
10
- version: 0.4.0.pre2
9
+ - pre3
10
+ version: 0.4.0.pre3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pelle Braendgaard
@@ -15,13 +15,39 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-06 00:00:00 -05:00
18
+ date: 2010-12-08 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: oauth
22
+ name: twitter
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: opentransact
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 0
44
+ version: "0"
45
+ type: :development
46
+ version_requirements: *id002
47
+ - !ruby/object:Gem::Dependency
48
+ name: oauth
49
+ prerelease: false
50
+ requirement: &id003 !ruby/object:Gem::Requirement
25
51
  none: false
26
52
  requirements:
27
53
  - - ">="
@@ -32,7 +58,7 @@ dependencies:
32
58
  - 4
33
59
  version: 0.4.4
34
60
  type: :runtime
35
- version_requirements: *id001
61
+ version_requirements: *id003
36
62
  description: Rails plugin for implementing an OAuth Provider or Consumer
37
63
  email: oauth-ruby@googlegroups.com
38
64
  executables: []
@@ -42,10 +68,13 @@ extensions: []
42
68
  extra_rdoc_files:
43
69
  - README.rdoc
44
70
  files:
71
+ - .gitignore
45
72
  - CHANGELOG
73
+ - Gemfile
46
74
  - MIT-LICENSE
47
75
  - README.rdoc
48
76
  - Rakefile
77
+ - UPGRADE.rdoc
49
78
  - VERSION
50
79
  - generators/oauth_consumer/USAGE
51
80
  - generators/oauth_consumer/oauth_consumer_generator.rb
@@ -188,6 +217,7 @@ files:
188
217
  - lib/generators/test_unit/templates/oauth_token_test.rb
189
218
  - lib/generators/test_unit/templates/oauth_tokens.yml
190
219
  - lib/oauth-plugin.rb
220
+ - lib/oauth-plugin/version.rb
191
221
  - lib/oauth/controllers/application_controller_methods.rb
192
222
  - lib/oauth/controllers/consumer_controller.rb
193
223
  - lib/oauth/controllers/provider_controller.rb
@@ -195,9 +225,12 @@ files:
195
225
  - lib/oauth/models/consumers/services/agree2_token.rb
196
226
  - lib/oauth/models/consumers/services/fireeagle_token.rb
197
227
  - lib/oauth/models/consumers/services/google_token.rb
228
+ - lib/oauth/models/consumers/services/opentransact_token.rb
229
+ - lib/oauth/models/consumers/services/picomoney_token.rb
198
230
  - lib/oauth/models/consumers/services/twitter_token.rb
199
231
  - lib/oauth/models/consumers/simple_client.rb
200
232
  - lib/oauth/models/consumers/token.rb
233
+ - lib/oauth/rack/oauth_filter.rb
201
234
  - oauth-plugin.gemspec
202
235
  - rails/init.rb
203
236
  - tasks/oauth_tasks.rake