doorkeeper 1.1.0 → 1.2.0

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 (161) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/CHANGELOG.md +14 -2
  4. data/README.md +93 -42
  5. data/app/controllers/doorkeeper/application_controller.rb +1 -1
  6. data/app/controllers/doorkeeper/applications_controller.rb +4 -4
  7. data/app/controllers/doorkeeper/authorizations_controller.rb +3 -3
  8. data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
  9. data/app/controllers/doorkeeper/token_info_controller.rb +3 -3
  10. data/app/controllers/doorkeeper/tokens_controller.rb +29 -2
  11. data/app/helpers/doorkeeper/form_errors_helper.rb +2 -2
  12. data/app/validators/redirect_uri_validator.rb +1 -1
  13. data/app/views/doorkeeper/applications/_form.html.erb +3 -3
  14. data/app/views/doorkeeper/applications/edit.html.erb +1 -1
  15. data/app/views/doorkeeper/applications/new.html.erb +1 -1
  16. data/app/views/doorkeeper/applications/show.html.erb +1 -1
  17. data/app/views/doorkeeper/authorizations/new.html.erb +5 -5
  18. data/doorkeeper.gemspec +1 -1
  19. data/lib/doorkeeper.rb +31 -31
  20. data/lib/doorkeeper/config.rb +66 -37
  21. data/lib/doorkeeper/doorkeeper_for.rb +6 -3
  22. data/lib/doorkeeper/engine.rb +2 -2
  23. data/lib/doorkeeper/helpers/controller.rb +9 -9
  24. data/lib/doorkeeper/helpers/filter.rb +1 -1
  25. data/lib/doorkeeper/models/access_grant.rb +5 -5
  26. data/lib/doorkeeper/models/access_token.rb +22 -18
  27. data/lib/doorkeeper/models/active_record/access_token.rb +8 -8
  28. data/lib/doorkeeper/models/active_record/application.rb +5 -5
  29. data/lib/doorkeeper/models/application.rb +8 -9
  30. data/lib/doorkeeper/models/expirable.rb +1 -1
  31. data/lib/doorkeeper/models/mongo_mapper/access_grant.rb +2 -2
  32. data/lib/doorkeeper/models/mongo_mapper/access_token.rb +11 -11
  33. data/lib/doorkeeper/models/mongo_mapper/application.rb +4 -4
  34. data/lib/doorkeeper/models/mongoid/version.rb +2 -2
  35. data/lib/doorkeeper/models/mongoid2/access_grant.rb +7 -7
  36. data/lib/doorkeeper/models/mongoid2/access_token.rb +14 -14
  37. data/lib/doorkeeper/models/mongoid2/application.rb +7 -7
  38. data/lib/doorkeeper/models/mongoid3_4/access_grant.rb +7 -7
  39. data/lib/doorkeeper/models/mongoid3_4/access_token.rb +13 -13
  40. data/lib/doorkeeper/models/mongoid3_4/application.rb +6 -6
  41. data/lib/doorkeeper/models/ownership.rb +5 -5
  42. data/lib/doorkeeper/oauth/authorization/code.rb +5 -5
  43. data/lib/doorkeeper/oauth/authorization/token.rb +7 -7
  44. data/lib/doorkeeper/oauth/authorization_code_request.rb +18 -19
  45. data/lib/doorkeeper/oauth/client.rb +1 -1
  46. data/lib/doorkeeper/oauth/client_credentials/creator.rb +4 -4
  47. data/lib/doorkeeper/oauth/client_credentials/issuer.rb +6 -4
  48. data/lib/doorkeeper/oauth/client_credentials/validation.rb +2 -2
  49. data/lib/doorkeeper/oauth/client_credentials_request.rb +11 -15
  50. data/lib/doorkeeper/oauth/code_request.rb +5 -4
  51. data/lib/doorkeeper/oauth/code_response.rb +8 -7
  52. data/lib/doorkeeper/oauth/error.rb +1 -1
  53. data/lib/doorkeeper/oauth/error_response.rb +5 -5
  54. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +1 -1
  55. data/lib/doorkeeper/oauth/invalid_token_response.rb +10 -10
  56. data/lib/doorkeeper/oauth/password_access_token_request.rb +57 -54
  57. data/lib/doorkeeper/oauth/pre_authorization.rb +7 -7
  58. data/lib/doorkeeper/oauth/refresh_token_request.rb +27 -24
  59. data/lib/doorkeeper/oauth/scopes.rb +3 -3
  60. data/lib/doorkeeper/oauth/token.rb +27 -1
  61. data/lib/doorkeeper/oauth/token_request.rb +14 -4
  62. data/lib/doorkeeper/rails/routes.rb +31 -22
  63. data/lib/doorkeeper/rails/routes/mapping.rb +11 -12
  64. data/lib/doorkeeper/request.rb +5 -5
  65. data/lib/doorkeeper/version.rb +1 -1
  66. data/lib/generators/doorkeeper/application_owner_generator.rb +1 -1
  67. data/lib/generators/doorkeeper/install_generator.rb +5 -5
  68. data/lib/generators/doorkeeper/migration_generator.rb +1 -1
  69. data/lib/generators/doorkeeper/mongo_mapper/indexes_generator.rb +2 -2
  70. data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb +2 -2
  71. data/lib/generators/doorkeeper/templates/initializer.rb +16 -3
  72. data/lib/generators/doorkeeper/templates/migration.rb +16 -17
  73. data/lib/generators/doorkeeper/views_generator.rb +1 -1
  74. data/spec/controllers/applications_controller_spec.rb +7 -7
  75. data/spec/controllers/authorizations_controller_spec.rb +48 -48
  76. data/spec/controllers/protected_resources_controller_spec.rb +108 -107
  77. data/spec/controllers/token_info_controller_spec.rb +11 -11
  78. data/spec/controllers/tokens_controller_spec.rb +8 -8
  79. data/spec/dummy/app/controllers/custom_authorizations_controller.rb +2 -2
  80. data/spec/dummy/app/controllers/full_protected_resources_controller.rb +3 -3
  81. data/spec/dummy/app/controllers/home_controller.rb +5 -5
  82. data/spec/dummy/app/controllers/metal_controller.rb +1 -1
  83. data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +2 -2
  84. data/spec/dummy/app/models/user.rb +3 -3
  85. data/spec/dummy/config/application.rb +8 -9
  86. data/spec/dummy/config/boot.rb +1 -1
  87. data/spec/dummy/config/environments/test.rb +1 -1
  88. data/spec/dummy/config/initializers/doorkeeper.rb +5 -5
  89. data/spec/dummy/config/initializers/session_store.rb +1 -1
  90. data/spec/dummy/config/initializers/wrap_parameters.rb +1 -1
  91. data/spec/dummy/config/routes.rb +27 -27
  92. data/spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb +16 -17
  93. data/spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb +3 -3
  94. data/spec/dummy/db/schema.rb +39 -39
  95. data/spec/factories/access_grant.rb +3 -3
  96. data/spec/factories/access_token.rb +1 -1
  97. data/spec/factories/application.rb +3 -3
  98. data/spec/generators/application_owner_generator_spec.rb +6 -7
  99. data/spec/generators/install_generator_spec.rb +9 -9
  100. data/spec/generators/migration_generator_spec.rb +4 -4
  101. data/spec/lib/config_spec.rb +136 -44
  102. data/spec/lib/models/expirable_spec.rb +9 -9
  103. data/spec/lib/models/revocable_spec.rb +4 -4
  104. data/spec/lib/oauth/authorization/uri_builder_spec.rb +4 -4
  105. data/spec/lib/oauth/authorization_code_request_spec.rb +2 -2
  106. data/spec/lib/oauth/client/credentials_spec.rb +4 -4
  107. data/spec/lib/oauth/client/methods_spec.rb +10 -10
  108. data/spec/lib/oauth/client_credentials/issuer_spec.rb +9 -7
  109. data/spec/lib/oauth/client_credentials/validation_spec.rb +2 -2
  110. data/spec/lib/oauth/client_credentials_request_spec.rb +6 -6
  111. data/spec/lib/oauth/client_spec.rb +4 -4
  112. data/spec/lib/oauth/code_request_spec.rb +10 -9
  113. data/spec/lib/oauth/error_response_spec.rb +8 -8
  114. data/spec/lib/oauth/error_spec.rb +1 -1
  115. data/spec/lib/oauth/helpers/scope_checker_spec.rb +17 -17
  116. data/spec/lib/oauth/helpers/unique_token_spec.rb +7 -7
  117. data/spec/lib/oauth/helpers/uri_checker_spec.rb +33 -33
  118. data/spec/lib/oauth/invalid_token_response_spec.rb +4 -4
  119. data/spec/lib/oauth/password_access_token_request_spec.rb +13 -13
  120. data/spec/lib/oauth/pre_authorization_spec.rb +47 -7
  121. data/spec/lib/oauth/refresh_token_request_spec.rb +11 -21
  122. data/spec/lib/oauth/scopes_spec.rb +32 -32
  123. data/spec/lib/oauth/token_request_spec.rb +10 -9
  124. data/spec/lib/oauth/token_response_spec.rb +13 -15
  125. data/spec/lib/oauth/token_spec.rb +24 -10
  126. data/spec/lib/server_spec.rb +24 -2
  127. data/spec/models/doorkeeper/access_grant_spec.rb +8 -8
  128. data/spec/models/doorkeeper/access_token_spec.rb +79 -33
  129. data/spec/models/doorkeeper/application_spec.rb +29 -29
  130. data/spec/requests/applications/applications_request_spec.rb +15 -15
  131. data/spec/requests/applications/authorized_applications_spec.rb +7 -7
  132. data/spec/requests/endpoints/authorization_spec.rb +19 -12
  133. data/spec/requests/endpoints/token_spec.rb +26 -8
  134. data/spec/requests/flows/authorization_code_errors_spec.rb +17 -17
  135. data/spec/requests/flows/authorization_code_spec.rb +28 -28
  136. data/spec/requests/flows/client_credentials_spec.rb +3 -3
  137. data/spec/requests/flows/implicit_grant_errors_spec.rb +5 -5
  138. data/spec/requests/flows/implicit_grant_spec.rb +2 -2
  139. data/spec/requests/flows/password_spec.rb +32 -32
  140. data/spec/requests/flows/refresh_token_spec.rb +23 -23
  141. data/spec/requests/flows/revoke_token_spec.rb +165 -0
  142. data/spec/requests/flows/skip_authorization_spec.rb +10 -10
  143. data/spec/requests/protected_resources/metal_spec.rb +1 -1
  144. data/spec/requests/protected_resources/private_api_spec.rb +5 -5
  145. data/spec/routing/custom_controller_routes_spec.rb +4 -0
  146. data/spec/routing/default_routes_spec.rb +5 -1
  147. data/spec/spec_helper.rb +2 -2
  148. data/spec/spec_helper_integration.rb +8 -10
  149. data/spec/support/helpers/access_token_request_helper.rb +3 -3
  150. data/spec/support/helpers/authorization_request_helper.rb +3 -3
  151. data/spec/support/helpers/config_helper.rb +1 -1
  152. data/spec/support/helpers/model_helper.rb +2 -2
  153. data/spec/support/helpers/request_spec_helper.rb +3 -3
  154. data/spec/support/helpers/url_helper.rb +25 -21
  155. data/spec/support/orm/active_record.rb +4 -4
  156. data/spec/support/orm/mongo_mapper.rb +2 -3
  157. data/spec/support/orm/mongoid.rb +5 -6
  158. data/spec/support/shared/controllers_shared_context.rb +15 -15
  159. data/spec/support/shared/models_shared_examples.rb +13 -13
  160. data/spec/validators/redirect_uri_validator_spec.rb +9 -9
  161. metadata +5 -4
@@ -1,37 +1,37 @@
1
1
  require 'spec_helper_integration'
2
2
 
3
3
  describe Doorkeeper::TokensController do
4
- describe "when authorization has succeeded" do
4
+ describe 'when authorization has succeeded' do
5
5
  let :token do
6
- double(:token, :authorize => true)
6
+ double(:token, authorize: true)
7
7
  end
8
8
 
9
9
  before do
10
10
  allow(controller).to receive(:token) { token }
11
11
  end
12
12
 
13
- it "returns the authorization" do
13
+ it 'returns the authorization' do
14
14
  pending 'verify need of these specs'
15
15
  expect(token).to receive(:authorization)
16
16
  post :create
17
17
  end
18
18
  end
19
19
 
20
- describe "when authorization has failed" do
20
+ describe 'when authorization has failed' do
21
21
  let :token do
22
- double(:token, :authorize => false)
22
+ double(:token, authorize: false)
23
23
  end
24
24
 
25
25
  before do
26
26
  allow(controller).to receive(:token) { token }
27
27
  end
28
28
 
29
- it "returns the error response" do
29
+ it 'returns the error response' do
30
30
  pending 'verify need of these specs'
31
- allow(token).to receive(:error_response).and_return(double(:to_json => [], :status => :unauthorized))
31
+ allow(token).to receive(:error_response).and_return(double(to_json: [], status: :unauthorized))
32
32
  post :create
33
33
  expect(response.status).to eq 401
34
- expect(response.headers["WWW-Authenticate"]).to match(/Bearer/)
34
+ expect(response.headers['WWW-Authenticate']).to match(/Bearer/)
35
35
  end
36
36
  end
37
37
  end
@@ -1,7 +1,7 @@
1
1
  class CustomAuthorizationsController < ::ApplicationController
2
- %w[index show new create edit update destroy].each do |action|
2
+ %w(index show new create edit update destroy).each do |action|
3
3
  define_method action do
4
- render :nothing => true
4
+ render nothing: true
5
5
  end
6
6
  end
7
7
  end
@@ -1,12 +1,12 @@
1
1
  class FullProtectedResourcesController < ApplicationController
2
2
  doorkeeper_for :index
3
- doorkeeper_for :show, :scopes => [:admin]
3
+ doorkeeper_for :show, scopes: [:admin]
4
4
 
5
5
  def index
6
- render :text => "index"
6
+ render text: 'index'
7
7
  end
8
8
 
9
9
  def show
10
- render :text => "show"
10
+ render text: 'show'
11
11
  end
12
12
  end
@@ -4,14 +4,14 @@ class HomeController < ApplicationController
4
4
 
5
5
  def sign_in
6
6
  session[:user_id] = if Rails.env.development?
7
- User.first || User.create!(:name => "Joe", :password => "sekret")
8
- else
9
- User.first
10
- end
7
+ User.first || User.create!(name: 'Joe', password: 'sekret')
8
+ else
9
+ User.first
10
+ end
11
11
  redirect_to '/'
12
12
  end
13
13
 
14
14
  def callback
15
- render :text => "ok"
15
+ render text: 'ok'
16
16
  end
17
17
  end
@@ -6,6 +6,6 @@ class MetalController < ActionController::Metal
6
6
  doorkeeper_for :all
7
7
 
8
8
  def index
9
- self.response_body = { :ok => true }.to_json
9
+ self.response_body = { ok: true }.to_json
10
10
  end
11
11
  end
@@ -2,10 +2,10 @@ class SemiProtectedResourcesController < ApplicationController
2
2
  doorkeeper_for :index
3
3
 
4
4
  def index
5
- render :text => "protected index"
5
+ render text: 'protected index'
6
6
  end
7
7
 
8
8
  def show
9
- render :text => "protected show"
9
+ render text: 'protected show'
10
10
  end
11
11
  end
@@ -7,8 +7,8 @@ when :mongoid2, :mongoid3, :mongoid4
7
7
  include Mongoid::Document
8
8
  include Mongoid::Timestamps
9
9
 
10
- field :name, :type => String
11
- field :password, :type => String
10
+ field :name, type: String
11
+ field :password, type: String
12
12
  end
13
13
  when :mongo_mapper
14
14
  class User
@@ -26,6 +26,6 @@ class User
26
26
  end
27
27
 
28
28
  def self.authenticate!(name, password)
29
- User.where(:name => name, :password => password).first
29
+ User.where(name: name, password: password).first
30
30
  end
31
31
  end
@@ -1,16 +1,16 @@
1
1
  require File.expand_path('../boot', __FILE__)
2
2
 
3
- require "action_controller/railtie"
4
- require "sprockets/railtie"
3
+ require 'action_controller/railtie'
4
+ require 'sprockets/railtie'
5
5
 
6
6
  Bundler.require :default
7
7
 
8
8
  orm = if [:mongoid2, :mongoid3, :mongoid4].include?(DOORKEEPER_ORM)
9
- Mongoid.load!(File.join(File.dirname(File.expand_path(__FILE__)), "#{DOORKEEPER_ORM}.yml"))
10
- :mongoid
11
- else
12
- DOORKEEPER_ORM
13
- end
9
+ Mongoid.load!(File.join(File.dirname(File.expand_path(__FILE__)), "#{DOORKEEPER_ORM}.yml"))
10
+ :mongoid
11
+ else
12
+ DOORKEEPER_ORM
13
+ end
14
14
 
15
15
  require "#{orm}/railtie"
16
16
 
@@ -40,7 +40,7 @@ module Dummy
40
40
  # config.i18n.default_locale = :en
41
41
 
42
42
  # Configure the default encoding used in templates for Ruby 1.9.
43
- config.encoding = "utf-8"
43
+ config.encoding = 'utf-8'
44
44
 
45
45
  # Configure sensitive parameters which will be filtered from the log file.
46
46
  config.filter_parameters += [:password]
@@ -52,4 +52,3 @@ module Dummy
52
52
  config.assets.version = '1.0'
53
53
  end
54
54
  end
55
-
@@ -3,4 +3,4 @@ require 'bundler/setup'
3
3
 
4
4
  DOORKEEPER_ORM = (ENV['orm'] || :active_record).to_sym unless defined?(DOORKEEPER_ORM)
5
5
 
6
- $:.unshift File.expand_path('../../../../lib', __FILE__)
6
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -9,7 +9,7 @@ Dummy::Application.configure do
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
11
11
  config.serve_static_assets = true
12
- config.static_cache_control = "public, max-age=3600"
12
+ config.static_cache_control = 'public, max-age=3600'
13
13
 
14
14
  if Rails.version.to_i < 4
15
15
  # Log error messages when you accidentally call methods on nil
@@ -8,7 +8,7 @@ Doorkeeper.configure do
8
8
  resource_owner_authenticator do
9
9
  # Put your resource owner authentication logic here.
10
10
  # e.g. User.find_by_id(session[:user_id]) || redirect_to(new_user_session_url)
11
- User.find_by_id(session[:user_id]) || redirect_to(root_url, :alert => "Needs sign in.")
11
+ User.find_by_id(session[:user_id]) || redirect_to(root_url, alert: 'Needs sign in.')
12
12
  end
13
13
 
14
14
  # If you want to restrict the access to the web interface for
@@ -30,7 +30,8 @@ Doorkeeper.configure do
30
30
  use_refresh_token
31
31
 
32
32
  # Define access token scopes for your provider
33
- # For more information go to https://github.com/applicake/doorkeeper/wiki/Using-Scopes
33
+ # For more information go to
34
+ # https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
34
35
  default_scopes :public
35
36
  optional_scopes :write, :update
36
37
 
@@ -46,7 +47,6 @@ Doorkeeper.configure do
46
47
  # Check out the wiki for mor information on customization
47
48
  # access_token_methods :from_bearer_authorization, :from_access_token_param, :from_bearer_param
48
49
 
49
-
50
50
  # Change the test redirect uri for client apps
51
51
  # When clients register with the following redirect uri, they won't be redirected to any server and the authorization code will be displayed within the provider
52
52
  # The value can be any string. Use nil to disable this feature. When disabled, clients must provide a valid URL
@@ -54,6 +54,6 @@ Doorkeeper.configure do
54
54
  #
55
55
  # test_redirect_uri 'urn:ietf:wg:oauth:2.0:oob'
56
56
 
57
- # WWW-Authenticate Realm (default "Doorkeeper").
58
- realm "Doorkeeper"
57
+ # WWW-Authenticate Realm (default 'Doorkeeper').
58
+ realm 'Doorkeeper'
59
59
  end
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
4
 
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
@@ -5,7 +5,7 @@
5
5
 
6
6
  # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
7
  ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters :format => [:json]
8
+ wrap_parameters format: [:json]
9
9
  end
10
10
 
11
11
  # Disable root element in JSON by default.
@@ -1,42 +1,42 @@
1
1
  Rails.application.routes.draw do
2
2
  use_doorkeeper
3
- use_doorkeeper :scope => 'scope'
3
+ use_doorkeeper scope: 'scope'
4
4
 
5
5
  scope 'inner_space' do
6
- use_doorkeeper :scope => 'scope' do
7
- controllers :authorizations => 'custom_authorizations',
8
- :tokens => 'custom_authorizations',
9
- :applications => 'custom_authorizations',
10
- :token_info => 'custom_authorizations'
11
-
12
- as :authorizations => 'custom_auth',
13
- :tokens => 'custom_token',
14
- :token_info => 'custom_token_info'
6
+ use_doorkeeper scope: 'scope' do
7
+ controllers authorizations: 'custom_authorizations',
8
+ tokens: 'custom_authorizations',
9
+ applications: 'custom_authorizations',
10
+ token_info: 'custom_authorizations'
11
+
12
+ as authorizations: 'custom_auth',
13
+ tokens: 'custom_token',
14
+ token_info: 'custom_token_info'
15
15
  end
16
16
  end
17
17
 
18
18
  scope 'space' do
19
19
  use_doorkeeper do
20
- controllers :authorizations => 'custom_authorizations',
21
- :tokens => 'custom_authorizations',
22
- :applications => 'custom_authorizations',
23
- :token_info => 'custom_authorizations'
24
-
25
- as :authorizations => 'custom_auth',
26
- :tokens => 'custom_token',
27
- :token_info => 'custom_token_info'
20
+ controllers authorizations: 'custom_authorizations',
21
+ tokens: 'custom_authorizations',
22
+ applications: 'custom_authorizations',
23
+ token_info: 'custom_authorizations'
24
+
25
+ as authorizations: 'custom_auth',
26
+ tokens: 'custom_token',
27
+ token_info: 'custom_token_info'
28
28
  end
29
29
  end
30
30
 
31
31
  scope 'outer_space' do
32
32
  use_doorkeeper do
33
- controllers :authorizations => 'custom_authorizations',
34
- :tokens => 'custom_authorizations',
35
- :token_info => 'custom_authorizations'
33
+ controllers authorizations: 'custom_authorizations',
34
+ tokens: 'custom_authorizations',
35
+ token_info: 'custom_authorizations'
36
36
 
37
- as :authorizations => 'custom_auth',
38
- :tokens => 'custom_token',
39
- :token_info => 'custom_token_info'
37
+ as authorizations: 'custom_auth',
38
+ tokens: 'custom_token',
39
+ token_info: 'custom_token_info'
40
40
 
41
41
  skip_controllers :tokens, :applications, :token_info
42
42
  end
@@ -44,9 +44,9 @@ Rails.application.routes.draw do
44
44
 
45
45
  get 'metal.json' => 'metal#index'
46
46
 
47
- get '/callback', :to => "home#callback"
48
- get '/sign_in', :to => "home#sign_in"
47
+ get '/callback', to: 'home#callback'
48
+ get '/sign_in', to: 'home#sign_in'
49
49
  resources :semi_protected_resources
50
50
  resources :full_protected_resources
51
- root :to => "home#index"
51
+ root to: 'home#index'
52
52
  end
@@ -1,42 +1,41 @@
1
1
  class CreateDoorkeeperTables < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :oauth_applications do |t|
4
- t.string :name, :null => false
5
- t.string :uid, :null => false
6
- t.string :secret, :null => false
7
- t.string :redirect_uri, :null => false, :limit => 2048
4
+ t.string :name, null: false
5
+ t.string :uid, null: false
6
+ t.string :secret, null: false
7
+ t.string :redirect_uri, null: false, limit: 2048
8
8
  t.timestamps
9
9
  end
10
10
 
11
- add_index :oauth_applications, :uid, :unique => true
11
+ add_index :oauth_applications, :uid, unique: true
12
12
 
13
13
  create_table :oauth_access_grants do |t|
14
- t.integer :resource_owner_id, :null => false
15
- t.integer :application_id, :null => false
16
- t.string :token, :null => false
17
- t.integer :expires_in, :null => false
18
- t.string :redirect_uri, :null => false, :limit => 2048
19
- t.datetime :created_at, :null => false
14
+ t.integer :resource_owner_id, null: false
15
+ t.integer :application_id, null: false
16
+ t.string :token, null: false
17
+ t.integer :expires_in, null: false
18
+ t.string :redirect_uri, null: false, limit: 2048
19
+ t.datetime :created_at, null: false
20
20
  t.datetime :revoked_at
21
21
  t.string :scopes
22
22
  end
23
23
 
24
- add_index :oauth_access_grants, :token, :unique => true
24
+ add_index :oauth_access_grants, :token, unique: true
25
25
 
26
26
  create_table :oauth_access_tokens do |t|
27
27
  t.integer :resource_owner_id
28
28
  t.integer :application_id
29
- t.string :token, :null => false
29
+ t.string :token, null: false
30
30
  t.string :refresh_token
31
31
  t.integer :expires_in
32
32
  t.datetime :revoked_at
33
- t.datetime :created_at, :null => false
33
+ t.datetime :created_at, null: false
34
34
  t.string :scopes
35
35
  end
36
36
 
37
- add_index :oauth_access_tokens, :token, :unique => true
37
+ add_index :oauth_access_tokens, :token, unique: true
38
38
  add_index :oauth_access_tokens, :resource_owner_id
39
- add_index :oauth_access_tokens, :refresh_token, :unique => true
40
-
39
+ add_index :oauth_access_tokens, :refresh_token, unique: true
41
40
  end
42
41
  end
@@ -1,7 +1,7 @@
1
1
  class AddOwnerToApplication < ActiveRecord::Migration
2
2
  def change
3
- add_column :oauth_applications, :owner_id, :integer, :null => true
4
- add_column :oauth_applications, :owner_type, :string, :null => true
3
+ add_column :oauth_applications, :owner_id, :integer, null: true
4
+ add_column :oauth_applications, :owner_type, :string, null: true
5
5
  add_index :oauth_applications, [:owner_id, :owner_type]
6
6
  end
7
- end
7
+ end
@@ -11,55 +11,55 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130902175349) do
14
+ ActiveRecord::Schema.define(version: 20130902175349) do
15
15
 
16
- create_table "oauth_access_grants", :force => true do |t|
17
- t.integer "resource_owner_id", :null => false
18
- t.integer "application_id", :null => false
19
- t.string "token", :null => false
20
- t.integer "expires_in", :null => false
21
- t.text "redirect_uri", :null => false
22
- t.datetime "created_at", :null => false
23
- t.datetime "revoked_at"
24
- t.string "scopes"
16
+ create_table 'oauth_access_grants', force: true do |t|
17
+ t.integer 'resource_owner_id', null: false
18
+ t.integer 'application_id', null: false
19
+ t.string 'token', null: false
20
+ t.integer 'expires_in', null: false
21
+ t.text 'redirect_uri', null: false
22
+ t.datetime 'created_at', null: false
23
+ t.datetime 'revoked_at'
24
+ t.string 'scopes'
25
25
  end
26
26
 
27
- add_index "oauth_access_grants", ["token"], :name => "index_oauth_access_grants_on_token", :unique => true
27
+ add_index 'oauth_access_grants', ['token'], name: 'index_oauth_access_grants_on_token', unique: true
28
28
 
29
- create_table "oauth_access_tokens", :force => true do |t|
30
- t.integer "resource_owner_id"
31
- t.integer "application_id"
32
- t.string "token", :null => false
33
- t.string "refresh_token"
34
- t.integer "expires_in"
35
- t.datetime "revoked_at"
36
- t.datetime "created_at", :null => false
37
- t.string "scopes"
29
+ create_table 'oauth_access_tokens', force: true do |t|
30
+ t.integer 'resource_owner_id'
31
+ t.integer 'application_id'
32
+ t.string 'token', null: false
33
+ t.string 'refresh_token'
34
+ t.integer 'expires_in'
35
+ t.datetime 'revoked_at'
36
+ t.datetime 'created_at', null: false
37
+ t.string 'scopes'
38
38
  end
39
39
 
40
- add_index "oauth_access_tokens", ["refresh_token"], :name => "index_oauth_access_tokens_on_refresh_token", :unique => true
41
- add_index "oauth_access_tokens", ["resource_owner_id"], :name => "index_oauth_access_tokens_on_resource_owner_id"
42
- add_index "oauth_access_tokens", ["token"], :name => "index_oauth_access_tokens_on_token", :unique => true
40
+ add_index 'oauth_access_tokens', ['refresh_token'], name: 'index_oauth_access_tokens_on_refresh_token', unique: true
41
+ add_index 'oauth_access_tokens', ['resource_owner_id'], name: 'index_oauth_access_tokens_on_resource_owner_id'
42
+ add_index 'oauth_access_tokens', ['token'], name: 'index_oauth_access_tokens_on_token', unique: true
43
43
 
44
- create_table "oauth_applications", :force => true do |t|
45
- t.string "name", :null => false
46
- t.string "uid", :null => false
47
- t.string "secret", :null => false
48
- t.text "redirect_uri", :null => false
49
- t.datetime "created_at", :null => false
50
- t.datetime "updated_at", :null => false
51
- t.integer "owner_id"
52
- t.string "owner_type"
44
+ create_table 'oauth_applications', force: true do |t|
45
+ t.string 'name', null: false
46
+ t.string 'uid', null: false
47
+ t.string 'secret', null: false
48
+ t.text 'redirect_uri', null: false
49
+ t.datetime 'created_at', null: false
50
+ t.datetime 'updated_at', null: false
51
+ t.integer 'owner_id'
52
+ t.string 'owner_type'
53
53
  end
54
54
 
55
- add_index "oauth_applications", ["owner_id", "owner_type"], :name => "index_oauth_applications_on_owner_id_and_owner_type"
56
- add_index "oauth_applications", ["uid"], :name => "index_oauth_applications_on_uid", :unique => true
55
+ add_index 'oauth_applications', %w(owner_id owner_type), name: 'index_oauth_applications_on_owner_id_and_owner_type'
56
+ add_index 'oauth_applications', ['uid'], name: 'index_oauth_applications_on_uid', unique: true
57
57
 
58
- create_table "users", :force => true do |t|
59
- t.string "name"
60
- t.datetime "created_at", :null => false
61
- t.datetime "updated_at", :null => false
62
- t.string "password"
58
+ create_table 'users', force: true do |t|
59
+ t.string 'name'
60
+ t.datetime 'created_at', null: false
61
+ t.datetime 'updated_at', null: false
62
+ t.string 'password'
63
63
  end
64
64
 
65
65
  end