doorkeeper 0.5.0 → 0.6.0.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of doorkeeper might be problematic. Click here for more details.

Files changed (105) hide show
  1. data/.travis.yml +15 -6
  2. data/CHANGELOG.md +19 -1
  3. data/Gemfile +23 -7
  4. data/README.md +62 -27
  5. data/app/controllers/doorkeeper/application_controller.rb +1 -1
  6. data/app/controllers/doorkeeper/authorizations_controller.rb +45 -35
  7. data/app/controllers/doorkeeper/token_info_controller.rb +10 -9
  8. data/app/controllers/doorkeeper/tokens_controller.rb +13 -32
  9. data/app/validators/redirect_uri_validator.rb +11 -0
  10. data/app/views/doorkeeper/applications/_form.html.erb +6 -1
  11. data/app/views/doorkeeper/applications/edit.html.erb +2 -2
  12. data/app/views/doorkeeper/applications/new.html.erb +2 -2
  13. data/app/views/doorkeeper/applications/show.html.erb +4 -1
  14. data/app/views/doorkeeper/authorizations/error.html.erb +1 -1
  15. data/app/views/doorkeeper/authorizations/new.html.erb +17 -17
  16. data/app/views/doorkeeper/authorizations/show.html.erb +4 -0
  17. data/config/locales/en.yml +10 -0
  18. data/doorkeeper.gemspec +3 -3
  19. data/lib/doorkeeper.rb +11 -2
  20. data/lib/doorkeeper/config.rb +6 -1
  21. data/lib/doorkeeper/errors.rb +15 -0
  22. data/lib/doorkeeper/helpers/controller.rb +24 -0
  23. data/lib/doorkeeper/models/access_grant.rb +1 -1
  24. data/lib/doorkeeper/models/access_token.rb +2 -3
  25. data/lib/doorkeeper/models/active_record/access_token.rb +6 -0
  26. data/lib/doorkeeper/models/mongo_mapper/access_grant.rb +28 -0
  27. data/lib/doorkeeper/models/mongo_mapper/access_token.rb +51 -0
  28. data/lib/doorkeeper/models/mongo_mapper/application.rb +30 -0
  29. data/lib/doorkeeper/models/mongo_mapper/revocable.rb +15 -0
  30. data/lib/doorkeeper/models/{mongoid → mongoid2}/access_grant.rb +1 -1
  31. data/lib/doorkeeper/models/{mongoid → mongoid2}/access_token.rb +6 -0
  32. data/lib/doorkeeper/models/{mongoid → mongoid2}/application.rb +2 -2
  33. data/lib/doorkeeper/models/mongoid3/access_grant.rb +22 -0
  34. data/lib/doorkeeper/models/mongoid3/access_token.rb +41 -0
  35. data/lib/doorkeeper/models/mongoid3/application.rb +22 -0
  36. data/lib/doorkeeper/oauth/authorization/code.rb +9 -17
  37. data/lib/doorkeeper/oauth/authorization/token.rb +8 -18
  38. data/lib/doorkeeper/oauth/authorization/uri_builder.rb +2 -0
  39. data/lib/doorkeeper/oauth/authorization_code_request.rb +82 -0
  40. data/lib/doorkeeper/oauth/client_credentials_request.rb +2 -4
  41. data/lib/doorkeeper/oauth/code_request.rb +28 -0
  42. data/lib/doorkeeper/oauth/code_response.rb +37 -0
  43. data/lib/doorkeeper/oauth/error_response.rb +23 -9
  44. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +4 -0
  45. data/lib/doorkeeper/oauth/password_access_token_request.rb +21 -65
  46. data/lib/doorkeeper/oauth/pre_authorization.rb +62 -0
  47. data/lib/doorkeeper/oauth/refresh_token_request.rb +58 -0
  48. data/lib/doorkeeper/oauth/token_request.rb +28 -0
  49. data/lib/doorkeeper/oauth/token_response.rb +29 -0
  50. data/lib/doorkeeper/rails/routes.rb +4 -3
  51. data/lib/doorkeeper/request.rb +33 -0
  52. data/lib/doorkeeper/request/authorization_code.rb +23 -0
  53. data/lib/doorkeeper/request/client_credentials.rb +23 -0
  54. data/lib/doorkeeper/request/code.rb +24 -0
  55. data/lib/doorkeeper/request/password.rb +23 -0
  56. data/lib/doorkeeper/request/refresh_token.rb +23 -0
  57. data/lib/doorkeeper/request/token.rb +24 -0
  58. data/lib/doorkeeper/server.rb +54 -0
  59. data/lib/doorkeeper/validations.rb +1 -0
  60. data/lib/doorkeeper/version.rb +1 -1
  61. data/lib/generators/doorkeeper/mongo_mapper/indexes_generator.rb +12 -0
  62. data/lib/generators/doorkeeper/templates/README +15 -1
  63. data/lib/generators/doorkeeper/templates/indexes.rb +3 -0
  64. data/lib/generators/doorkeeper/templates/initializer.rb +8 -1
  65. data/script/run_all +9 -9
  66. data/spec/controllers/authorizations_controller_spec.rb +8 -19
  67. data/spec/controllers/token_info_controller_spec.rb +9 -9
  68. data/spec/controllers/tokens_controller_spec.rb +2 -1
  69. data/spec/dummy/app/models/user.rb +11 -4
  70. data/spec/dummy/config/application.rb +8 -1
  71. data/spec/dummy/config/boot.rb +1 -1
  72. data/spec/dummy/config/initializers/doorkeeper.rb +9 -1
  73. data/spec/dummy/config/mongo.yml +11 -0
  74. data/spec/dummy/config/{mongoid.yml → mongoid2.yml} +3 -1
  75. data/spec/dummy/config/mongoid3.yml +18 -0
  76. data/spec/generators/install_generator_spec.rb +1 -0
  77. data/spec/lib/oauth/authorization_code_request_spec.rb +80 -0
  78. data/spec/lib/oauth/client_credentials_request_spec.rb +1 -3
  79. data/spec/lib/oauth/code_request_spec.rb +44 -0
  80. data/spec/lib/oauth/error_response_spec.rb +7 -7
  81. data/spec/lib/oauth/password_access_token_request_spec.rb +30 -143
  82. data/spec/lib/oauth/pre_authorization_spec.rb +80 -0
  83. data/spec/lib/oauth/refresh_token_request_spec.rb +56 -0
  84. data/spec/lib/oauth/token_request_spec.rb +46 -0
  85. data/spec/lib/oauth/{client_credentials/response_spec.rb → token_response_spec.rb} +13 -19
  86. data/spec/lib/server_spec.rb +24 -0
  87. data/spec/requests/endpoints/authorization_spec.rb +11 -27
  88. data/spec/requests/endpoints/token_spec.rb +17 -0
  89. data/spec/requests/flows/authorization_code_errors_spec.rb +0 -45
  90. data/spec/requests/flows/authorization_code_spec.rb +12 -2
  91. data/spec/requests/flows/client_credentials_spec.rb +1 -1
  92. data/spec/requests/flows/password_spec.rb +1 -0
  93. data/spec/requests/flows/refresh_token_spec.rb +6 -4
  94. data/spec/spec_helper_integration.rb +4 -2
  95. data/spec/support/orm/mongo_mapper.rb +26 -0
  96. data/spec/support/orm/mongoid.rb +7 -2
  97. data/spec/validators/redirect_uri_validator_spec.rb +11 -4
  98. metadata +67 -42
  99. data/gemfiles/gemfile.rails-3.1.x +0 -17
  100. data/gemfiles/gemfile.rails-3.2.x +0 -17
  101. data/lib/doorkeeper/oauth/access_token_request.rb +0 -139
  102. data/lib/doorkeeper/oauth/authorization_request.rb +0 -114
  103. data/lib/doorkeeper/oauth/client_credentials/response.rb +0 -42
  104. data/spec/lib/oauth/access_token_request_spec.rb +0 -246
  105. data/spec/lib/oauth/authorization_request_spec.rb +0 -287
@@ -2,11 +2,11 @@
2
2
  <header class="page-header"><h2>Edit application</h2></header>
3
3
  </div>
4
4
 
5
- <div class="span10">
5
+ <div class="span12">
6
6
  <%= render 'form', :application => @application %>
7
7
  </div>
8
8
 
9
- <div class="span6">
9
+ <div class="span4">
10
10
  <h3>Actions</h3>
11
11
  <p><%= link_to 'Back to application list', oauth_applications_path %></p>
12
12
  </div>
@@ -2,11 +2,11 @@
2
2
  <header class="page-header"><h2>New application</h2></header>
3
3
  </div>
4
4
 
5
- <div class="span10">
5
+ <div class="span12">
6
6
  <%= render 'form', :application => @application %>
7
7
  </div>
8
8
 
9
- <div class="span6">
9
+ <div class="span4">
10
10
  <h3>Actions</h3>
11
11
  <p><%= link_to 'Back to application list', oauth_applications_path %></p>
12
12
  </div>
@@ -6,13 +6,16 @@
6
6
 
7
7
  <div class="span10">
8
8
  <h4>Callback url:</h4>
9
- <p><%= @application.redirect_uri %></p>
9
+ <p><code><%= @application.redirect_uri %></code></p>
10
10
 
11
11
  <h4>Application Id:</h4>
12
12
  <p><code><%= @application.uid %></code></p>
13
13
 
14
14
  <h4>Secret:</h4>
15
15
  <p><code><%= @application.secret %></code></p>
16
+
17
+ <h4>Link to authorization code:</h4>
18
+ <p><%= link_to 'Authorize', oauth_authorization_path(:client_id => @application.uid, :redirect_uri => @application.redirect_uri, :response_type => 'code' ) %></p>
16
19
  </div>
17
20
 
18
21
  <div class="span6">
@@ -1,6 +1,6 @@
1
1
  <div class="span16">
2
2
  <h2>An error has occurred</h2>
3
3
  <p>
4
- <pre><%= @error.description %></pre>
4
+ <pre><%= @pre_auth.error_response.body[:error_description] %></pre>
5
5
  </p>
6
6
  </div>
@@ -1,37 +1,37 @@
1
1
  <div class="span16">
2
- <h2>Authorize <%= @authorization.client.name %> to use your account?</h2>
2
+ <h2>Authorize <%= @pre_auth.client.name %> to use your account?</h2>
3
3
  </div>
4
4
 
5
5
  <div class="span16">
6
- <% if @authorization.scopes %>
6
+ <% if @pre_auth.scopes %>
7
7
  <p>
8
8
  This application will be able to:
9
9
  </p>
10
10
  <ul>
11
- <% @authorization.scopes.each do |scope| %>
11
+ <% @pre_auth.scopes.each do |scope| %>
12
12
  <li><%= t scope, :scope => [:doorkeeper, :scopes] %></li>
13
13
  <% end %>
14
14
  </ul>
15
15
  <% end %>
16
16
 
17
17
  <div class="inline_block">
18
- <%= form_for @authorization, :as => :authorization, :url => oauth_authorization_path, :method => :post do |f| %>
19
- <%= f.hidden_field :client_id %>
20
- <%= f.hidden_field :redirect_uri %>
21
- <%= f.hidden_field :state %>
22
- <%= f.hidden_field :response_type %>
23
- <%= f.hidden_field :scope %>
24
- <%= f.submit "Authorize", :class => "btn success" %> or
18
+ <%= form_tag oauth_authorization_path, :method => :post do %>
19
+ <%= hidden_field_tag :client_id, @pre_auth.client.uid %>
20
+ <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
21
+ <%= hidden_field_tag :state, @pre_auth.state %>
22
+ <%= hidden_field_tag :response_type, @pre_auth.response_type %>
23
+ <%= hidden_field_tag :scope, @pre_auth.scope %>
24
+ <%= submit_tag "Authorize", :class => "btn success" %> or
25
25
  <% end %>
26
26
  </div>
27
27
  <div class="inline_block">
28
- <%= form_for @authorization, :as => :authorization, :url => oauth_authorization_path, :method => :delete do |f| %>
29
- <%= f.hidden_field :client_id %>
30
- <%= f.hidden_field :redirect_uri %>
31
- <%= f.hidden_field :state %>
32
- <%= f.hidden_field :response_type %>
33
- <%= f.hidden_field :scope %>
34
- <%= f.submit "Deny", :class => "btn" %>
28
+ <%= form_tag oauth_authorization_path, :method => :delete do %>
29
+ <%= hidden_field_tag :client_id, @pre_auth.client.uid %>
30
+ <%= hidden_field_tag :redirect_uri, @pre_auth.redirect_uri %>
31
+ <%= hidden_field_tag :state, @pre_auth.state %>
32
+ <%= hidden_field_tag :response_type, @pre_auth.response_type %>
33
+ <%= hidden_field_tag :scope, @pre_auth.scope %>
34
+ <%= submit_tag "Deny", :class => "btn" %>
35
35
  <% end %>
36
36
  </div>
37
37
  </div>
@@ -0,0 +1,4 @@
1
+ <div class="span16">
2
+ <h3>Authorization code:</h3>
3
+ <code><%= params[:code] %></code>
4
+ </div>
@@ -19,6 +19,16 @@ en:
19
19
  has_query_parameter: 'cannot contain a query parameter.'
20
20
  invalid_uri: 'must be a valid URI.'
21
21
  relative_uri: 'must be an absolute URI.'
22
+ mongo_mapper:
23
+ errors:
24
+ models:
25
+ application:
26
+ attributes:
27
+ redirect_uri:
28
+ fragment_present: 'cannot contain a fragment.'
29
+ has_query_parameter: 'cannot contain a query parameter.'
30
+ invalid_uri: 'must be a valid URI.'
31
+ relative_uri: 'must be an absolute URI.'
22
32
  doorkeeper:
23
33
  errors:
24
34
  messages:
data/doorkeeper.gemspec CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |s|
18
18
  s.add_dependency "railties", "~> 3.1"
19
19
 
20
20
  s.add_development_dependency "sqlite3", "~> 1.3.5"
21
- s.add_development_dependency "rspec-rails", "~> 2.11.0"
21
+ s.add_development_dependency "rspec-rails", "~> 2.11.4"
22
22
  s.add_development_dependency "capybara", "~> 1.1.2"
23
23
  s.add_development_dependency "generator_spec", "~> 0.8.5"
24
24
  s.add_development_dependency "factory_girl", "~> 2.6.4"
25
- s.add_development_dependency "timecop", "~> 0.4.3"
26
- s.add_development_dependency "database_cleaner", "~> 0.8"
25
+ s.add_development_dependency "timecop", "~> 0.5.2"
26
+ s.add_development_dependency "database_cleaner", "~> 0.9.1"
27
27
  s.add_development_dependency "bcrypt-ruby", "~> 3.0.1"
28
28
  end
data/lib/doorkeeper.rb CHANGED
@@ -3,18 +3,27 @@ require "doorkeeper/engine"
3
3
  require "doorkeeper/config"
4
4
  require "doorkeeper/doorkeeper_for"
5
5
 
6
+ require 'doorkeeper/errors'
7
+ require 'doorkeeper/server'
8
+ require 'doorkeeper/request'
9
+
6
10
  module Doorkeeper
7
11
  autoload :Validations, "doorkeeper/validations"
8
12
 
9
13
  module OAuth
10
14
  autoload :Scopes, "doorkeeper/oauth/scopes"
11
15
  autoload :Error, "doorkeeper/oauth/error"
16
+ autoload :CodeResponse, "doorkeeper/oauth/code_response"
17
+ autoload :TokenResponse, "doorkeeper/oauth/token_response"
12
18
  autoload :ErrorResponse, "doorkeeper/oauth/error_response"
13
- autoload :AuthorizationRequest, "doorkeeper/oauth/authorization_request"
14
- autoload :AccessTokenRequest, "doorkeeper/oauth/access_token_request"
19
+ autoload :PreAuthorization, "doorkeeper/oauth/pre_authorization"
20
+ autoload :AuthorizationCodeRequest, "doorkeeper/oauth/authorization_code_request"
21
+ autoload :RefreshTokenRequest, "doorkeeper/oauth/refresh_token_request"
15
22
  autoload :PasswordAccessTokenRequest, "doorkeeper/oauth/password_access_token_request"
16
23
  autoload :ClientCredentialsRequest, "doorkeeper/oauth/client_credentials_request"
17
24
  autoload :Authorization, "doorkeeper/oauth/authorization"
25
+ autoload :CodeRequest, "doorkeeper/oauth/code_request"
26
+ autoload :TokenRequest, "doorkeeper/oauth/token_request"
18
27
  autoload :Client, "doorkeeper/oauth/client"
19
28
  autoload :Token, "doorkeeper/oauth/token"
20
29
 
@@ -139,12 +139,13 @@ module Doorkeeper
139
139
  :default => lambda{|routes| }
140
140
  option :resource_owner_from_credentials,
141
141
  :default => lambda{|routes|
142
- logger.warn(I18n.translate('doorkeeper.errors.messages.credential_flow_not_configured'))
142
+ warn(I18n.translate('doorkeeper.errors.messages.credential_flow_not_configured'))
143
143
  nil
144
144
  }
145
145
  option :access_token_expires_in, :default => 7200
146
146
  option :authorization_code_expires_in,:default => 600
147
147
  option :orm, :default => :active_record
148
+ option :test_redirect_uri, :default => 'urn:ietf:wg:oauth:2.0:oob'
148
149
 
149
150
  def refresh_token_enabled?
150
151
  !!@refresh_token_enabled
@@ -170,6 +171,10 @@ module Doorkeeper
170
171
  @scopes ||= default_scopes + optional_scopes
171
172
  end
172
173
 
174
+ def orm_name
175
+ [:mongoid2, :mongoid3].include?(orm) ? :mongoid : orm
176
+ end
177
+
173
178
  def client_credentials_methods
174
179
  @client_credentials ||= [:from_basic, :from_params]
175
180
  end
@@ -0,0 +1,15 @@
1
+ module Doorkeeper
2
+ module Errors
3
+ class DoorkeeperError < StandardError
4
+ end
5
+
6
+ class InvalidAuthorizationStrategy < DoorkeeperError
7
+ end
8
+
9
+ class InvalidTokenStrategy < DoorkeeperError
10
+ end
11
+
12
+ class MissingRequestStrategy < DoorkeeperError
13
+ end
14
+ end
15
+ end
@@ -24,6 +24,30 @@ module Doorkeeper
24
24
  def authenticate_admin!
25
25
  instance_eval &Doorkeeper.configuration.authenticate_admin
26
26
  end
27
+
28
+ def server
29
+ @server ||= Server.new(self)
30
+ end
31
+
32
+ def get_error_response_from_exception(exception)
33
+ error_name = case exception
34
+ when Errors::InvalidTokenStrategy
35
+ :unsupported_grant_type
36
+ when Errors::InvalidAuthorizationStrategy
37
+ :unsupported_response_type
38
+ when Errors::MissingRequestStrategy
39
+ :invalid_request
40
+ end
41
+
42
+ OAuth::ErrorResponse.new :name => error_name, :state => params[:state]
43
+ end
44
+
45
+ def handle_token_exception(exception)
46
+ error = get_error_response_from_exception exception
47
+ self.headers.merge! error.headers
48
+ self.response_body = error.body.to_json
49
+ self.status = error.status
50
+ end
27
51
  end
28
52
  end
29
53
  end
@@ -6,7 +6,7 @@ module Doorkeeper
6
6
  include Doorkeeper::Models::Accessible
7
7
  include Doorkeeper::Models::Scopes
8
8
 
9
- belongs_to :application, :class_name => "Doorkeeper::Application"
9
+ belongs_to :application, :class_name => "Doorkeeper::Application", :inverse_of => :access_grants
10
10
 
11
11
  attr_accessible :resource_owner_id, :application_id, :expires_in, :redirect_uri, :scopes
12
12
 
@@ -6,7 +6,7 @@ module Doorkeeper
6
6
  include Doorkeeper::Models::Accessible
7
7
  include Doorkeeper::Models::Scopes
8
8
 
9
- belongs_to :application, :class_name => "Doorkeeper::Application"
9
+ belongs_to :application, :class_name => "Doorkeeper::Application", :inverse_of => :access_tokens
10
10
 
11
11
  validates :application_id, :token, :presence => true
12
12
  validates :token, :uniqueness => true
@@ -27,8 +27,7 @@ module Doorkeeper
27
27
  end
28
28
 
29
29
  def self.revoke_all_for(application_id, resource_owner)
30
- where(:application_id => application_id,
31
- :resource_owner_id => resource_owner.id).delete_all
30
+ delete_all_for(application_id, resource_owner)
32
31
  end
33
32
 
34
33
  def self.matching_token_for(application, resource_owner_or_id, scopes)
@@ -2,6 +2,12 @@ module Doorkeeper
2
2
  class AccessToken < ActiveRecord::Base
3
3
  self.table_name = :oauth_access_tokens
4
4
 
5
+ def self.delete_all_for(application_id, resource_owner)
6
+ where(:application_id => application_id,
7
+ :resource_owner_id => resource_owner.id).delete_all
8
+ end
9
+ private_class_method :delete_all_for
10
+
5
11
  def self.last_authorized_token_for(application, resource_owner_id)
6
12
  where(:application_id => application.id,
7
13
  :resource_owner_id => resource_owner_id,
@@ -0,0 +1,28 @@
1
+ require 'doorkeeper/models/mongo_mapper/revocable'
2
+
3
+ module Doorkeeper
4
+ class AccessGrant
5
+ include MongoMapper::Document
6
+ include Doorkeeper::Models::MongoMapper::Revocable
7
+ safe
8
+ timestamps!
9
+
10
+ set_collection_name "oauth_access_grants"
11
+
12
+ key :resource_owner_id, ObjectId
13
+ key :application_id, ObjectId
14
+ key :token, String
15
+ key :expires_in, Integer
16
+ key :redirect_uri, String
17
+ key :revoked_at, DateTime
18
+ key :scopes, String
19
+
20
+ def scopes=(value)
21
+ write_attribute :scopes, value if value.present?
22
+ end
23
+
24
+ def self.create_indexes
25
+ ensure_index :token, :unique => true
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,51 @@
1
+ require 'doorkeeper/models/mongo_mapper/revocable'
2
+
3
+ module Doorkeeper
4
+ class AccessToken
5
+ include MongoMapper::Document
6
+ include Doorkeeper::Models::MongoMapper::Revocable
7
+ safe
8
+ timestamps!
9
+
10
+ set_collection_name "oauth_access_tokens"
11
+
12
+ key :resource_owner_id, ObjectId
13
+ key :token, String
14
+ key :expires_in, Integer
15
+ key :revoked_at, DateTime
16
+ key :scopes, String
17
+
18
+ def scopes=(value)
19
+ write_attribute :scopes, value if value.present?
20
+ end
21
+
22
+ def self.last
23
+ self.sort(:created_at).last
24
+ end
25
+
26
+ def self.delete_all_for(application_id, resource_owner)
27
+ delete_all(:application_id => application_id,
28
+ :resource_owner_id => resource_owner.id)
29
+ end
30
+ private_class_method :delete_all_for
31
+
32
+ def self.last_authorized_token_for(application, resource_owner_id)
33
+ where(:application_id => application.id,
34
+ :resource_owner_id => resource_owner_id,
35
+ :revoked_at => nil).
36
+ sort(:created_at.desc).
37
+ limit(1).
38
+ first
39
+ end
40
+ private_class_method :last_authorized_token_for
41
+
42
+ def refresh_token
43
+ self[:refresh_token]
44
+ end
45
+
46
+ def self.create_indexes
47
+ ensure_index :token, :unique => true
48
+ ensure_index [[:refresh_token, 1]], :unique => true, :sparse => true
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,30 @@
1
+ module Doorkeeper
2
+ class Application
3
+ include MongoMapper::Document
4
+ safe
5
+ timestamps!
6
+
7
+ set_collection_name "oauth_applications"
8
+
9
+ many :authorized_tokens, :class_name => "Doorkeeper::AccessToken"
10
+
11
+ key :name, String
12
+ key :uid, String
13
+ key :secret, String
14
+ key :redirect_uri, String
15
+ key :scopes, String
16
+
17
+ def scopes=(value)
18
+ write_attribute :scopes, value if value.present?
19
+ end
20
+
21
+ def self.authorized_for(resource_owner)
22
+ ids = AccessToken.where(:resource_owner_id => resource_owner.id, :revoked_at => nil).map(&:application_id)
23
+ find(ids)
24
+ end
25
+
26
+ def self.create_indexes
27
+ ensure_index :uid, :unique => true
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ module Doorkeeper
2
+ module Models
3
+ module MongoMapper
4
+ module Revocable
5
+ def self.included(base)
6
+ base.class_eval do
7
+ def update_column(attr, val)
8
+ update_attribute attr, val
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -10,7 +10,7 @@ module Doorkeeper
10
10
 
11
11
  self.store_in :oauth_access_grants
12
12
 
13
- field :resource_owner_id, :type => Hash
13
+ field :resource_owner_id, :type => Integer
14
14
  field :application_id, :type => Hash
15
15
  field :token, :type => String
16
16
  field :expires_in, :type => Integer