devise-doorkeeper 1.0.0

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.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +69 -0
  7. data/Rakefile +18 -0
  8. data/devise-doorkeeper.gemspec +35 -0
  9. data/lib/devise/doorkeeper.rb +24 -0
  10. data/lib/devise/doorkeeper/version.rb +5 -0
  11. data/lib/devise/strategies/doorkeeper.rb +53 -0
  12. data/spec/dummy/.rspec +2 -0
  13. data/spec/dummy/README.rdoc +28 -0
  14. data/spec/dummy/Rakefile +6 -0
  15. data/spec/dummy/app/assets/images/.keep +0 -0
  16. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  17. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  18. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  19. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  20. data/spec/dummy/app/controllers/example_controller.rb +7 -0
  21. data/spec/dummy/app/controllers/welcome_controller.rb +2 -0
  22. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  23. data/spec/dummy/app/mailers/.keep +0 -0
  24. data/spec/dummy/app/models/.keep +0 -0
  25. data/spec/dummy/app/models/concerns/.keep +0 -0
  26. data/spec/dummy/app/models/user.rb +7 -0
  27. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  28. data/spec/dummy/app/views/welcome/index.html.erb +0 -0
  29. data/spec/dummy/bin/bundle +3 -0
  30. data/spec/dummy/bin/rails +4 -0
  31. data/spec/dummy/bin/rake +4 -0
  32. data/spec/dummy/config.ru +4 -0
  33. data/spec/dummy/config/application.rb +28 -0
  34. data/spec/dummy/config/boot.rb +5 -0
  35. data/spec/dummy/config/database.yml +25 -0
  36. data/spec/dummy/config/environment.rb +5 -0
  37. data/spec/dummy/config/environments/development.rb +37 -0
  38. data/spec/dummy/config/environments/production.rb +78 -0
  39. data/spec/dummy/config/environments/test.rb +39 -0
  40. data/spec/dummy/config/initializers/assets.rb +8 -0
  41. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  42. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  43. data/spec/dummy/config/initializers/devise.rb +259 -0
  44. data/spec/dummy/config/initializers/doorkeeper.rb +108 -0
  45. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  46. data/spec/dummy/config/initializers/inflections.rb +16 -0
  47. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  48. data/spec/dummy/config/initializers/session_store.rb +3 -0
  49. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  50. data/spec/dummy/config/locales/devise.en.yml +60 -0
  51. data/spec/dummy/config/locales/doorkeeper.en.yml +151 -0
  52. data/spec/dummy/config/locales/en.yml +23 -0
  53. data/spec/dummy/config/routes.rb +5 -0
  54. data/spec/dummy/config/secrets.yml +22 -0
  55. data/spec/dummy/db/migrate/20150120154622_create_users.rb +8 -0
  56. data/spec/dummy/db/migrate/20150120154657_create_doorkeeper_tables.rb +42 -0
  57. data/spec/dummy/db/migrate/20150120162830_add_devise_to_users.rb +49 -0
  58. data/spec/dummy/db/schema.rb +80 -0
  59. data/spec/dummy/lib/assets/.keep +0 -0
  60. data/spec/dummy/log/.keep +0 -0
  61. data/spec/dummy/public/404.html +67 -0
  62. data/spec/dummy/public/422.html +67 -0
  63. data/spec/dummy/public/500.html +66 -0
  64. data/spec/dummy/public/favicon.ico +0 -0
  65. data/spec/factories/access_tokens.rb +6 -0
  66. data/spec/factories/applications.rb +8 -0
  67. data/spec/factories/users.rb +8 -0
  68. data/spec/rails_helper.rb +50 -0
  69. data/spec/requests/oauth/bearer_tokens_spec.rb +57 -0
  70. data/spec/requests/oauth/password_grant_spec.rb +68 -0
  71. data/spec/spec_helper.rb +81 -0
  72. data/spec/support/factory_girl.rb +6 -0
  73. data/spec/support/json_spec.rb +4 -0
  74. data/spec/support/pry.rb +1 -0
  75. metadata +365 -0
@@ -0,0 +1,108 @@
1
+ Doorkeeper.configure do
2
+ Devise::Doorkeeper.configure(self)
3
+
4
+ # Change the ORM that doorkeeper will use.
5
+ # Currently supported options are :active_record, :mongoid2, :mongoid3,
6
+ # :mongoid4, :mongo_mapper
7
+ orm :active_record
8
+
9
+ # This block will be called to check whether the resource owner is authenticated or not.
10
+ resource_owner_authenticator do
11
+ fail "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
12
+ # Put your resource owner authentication logic here.
13
+ # Example implementation:
14
+ # User.find_by_id(session[:user_id]) || redirect_to(new_user_session_url)
15
+ end
16
+
17
+ # If you want to restrict access to the web interface for adding oauth authorized applications, you need to declare the block below.
18
+ # admin_authenticator do
19
+ # # Put your admin authentication logic here.
20
+ # # Example implementation:
21
+ # Admin.find_by_id(session[:admin_id]) || redirect_to(new_admin_session_url)
22
+ # end
23
+
24
+ # Authorization Code expiration time (default 10 minutes).
25
+ # authorization_code_expires_in 10.minutes
26
+
27
+ # Access token expiration time (default 2 hours).
28
+ # If you want to disable expiration, set this to nil.
29
+ # access_token_expires_in 2.hours
30
+
31
+ # Reuse access token for the same resource owner within an application (disabled by default)
32
+ # Rationale: https://github.com/doorkeeper-gem/doorkeeper/issues/383
33
+ # reuse_access_token
34
+
35
+ # Issue access tokens with refresh token (disabled by default)
36
+ # use_refresh_token
37
+
38
+ # Provide support for an owner to be assigned to each registered application (disabled by default)
39
+ # Optional parameter :confirmation => true (default false) if you want to enforce ownership of
40
+ # a registered application
41
+ # Note: you must also run the rails g doorkeeper:application_owner generator to provide the necessary support
42
+ # enable_application_owner :confirmation => false
43
+
44
+ # Define access token scopes for your provider
45
+ # For more information go to
46
+ # https://github.com/doorkeeper-gem/doorkeeper/wiki/Using-Scopes
47
+ # default_scopes :public
48
+ # optional_scopes :write, :update
49
+
50
+ # Change the way client credentials are retrieved from the request object.
51
+ # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
52
+ # falls back to the `:client_id` and `:client_secret` params from the `params` object.
53
+ # Check out the wiki for more information on customization
54
+ # client_credentials :from_basic, :from_params
55
+
56
+ # Change the way access token is authenticated from the request object.
57
+ # By default it retrieves first from the `HTTP_AUTHORIZATION` header, then
58
+ # falls back to the `:access_token` or `:bearer_token` params from the `params` object.
59
+ # Check out the wiki for more information on customization
60
+ # access_token_methods :from_bearer_authorization, :from_access_token_param, :from_bearer_param
61
+
62
+ # Change the native redirect uri for client apps
63
+ # 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
64
+ # The value can be any string. Use nil to disable this feature. When disabled, clients must provide a valid URL
65
+ # (Similar behaviour: https://developers.google.com/accounts/docs/OAuth2InstalledApp#choosingredirecturi)
66
+ #
67
+ # native_redirect_uri 'urn:ietf:wg:oauth:2.0:oob'
68
+
69
+ # Forces the usage of the HTTPS protocol in non-native redirect uris (enabled
70
+ # by default in non-development environments). OAuth2 delegates security in
71
+ # communication to the HTTPS protocol so it is wise to keep this enabled.
72
+ #
73
+ # force_ssl_in_redirect_uri !Rails.env.development?
74
+
75
+ # Specify what grant flows are enabled in array of Strings. The valid
76
+ # strings and the flows they enable are:
77
+ #
78
+ # "authorization_code" => Authorization Code Grant Flow
79
+ # "implicit" => Implicit Grant Flow
80
+ # "password" => Resource Owner Password Credentials Grant Flow
81
+ # "client_credentials" => Client Credentials Grant Flow
82
+ #
83
+ # If not specified, Doorkeeper enables authorization_code and
84
+ # client_credentials.
85
+ #
86
+ # implicit and password grant flows have risks that you should understand
87
+ # before enabling:
88
+ # http://tools.ietf.org/html/rfc6819#section-4.4.2
89
+ # http://tools.ietf.org/html/rfc6819#section-4.4.3
90
+ #
91
+ # grant_flows %w(authorization_code client_credentials)
92
+ grant_flows %w( password )
93
+
94
+ # Under some circumstances you might want to have applications auto-approved,
95
+ # so that the user skips the authorization step.
96
+ # For example if dealing with trusted a application.
97
+ # skip_authorization do |resource_owner, client|
98
+ # client.superapp? or resource_owner.admin?
99
+ # end
100
+
101
+ # WWW-Authenticate Realm (default "Doorkeeper").
102
+ # realm "Doorkeeper"
103
+
104
+ # Allow dynamic query parameters (disabled by default)
105
+ # Some applications require dynamic query parameters on their request_uri
106
+ # set to true if you want this to be allowed
107
+ # wildcard_redirect_uri false
108
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,60 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password has been changed successfully. You are now signed in."
34
+ updated_not_active: "Your password has been changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
42
+ updated: "Your account has been updated successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ already_signed_out: "Signed out successfully."
47
+ unlocks:
48
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
+ errors:
52
+ messages:
53
+ already_confirmed: "was already confirmed, please try signing in"
54
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55
+ expired: "has expired, please request a new one"
56
+ not_found: "not found"
57
+ not_locked: "was not locked"
58
+ not_saved:
59
+ one: "1 error prohibited this %{resource} from being saved:"
60
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,151 @@
1
+ en:
2
+ activerecord:
3
+ attributes:
4
+ doorkeeper/application:
5
+ name: 'Name'
6
+ redirect_uri: 'Redirect URI'
7
+ errors:
8
+ models:
9
+ doorkeeper/application:
10
+ attributes:
11
+ redirect_uri:
12
+ fragment_present: 'cannot contain a fragment.'
13
+ invalid_uri: 'must be a valid URI.'
14
+ relative_uri: 'must be an absolute URI.'
15
+ secured_uri: 'must be an HTTPS/SSL URI.'
16
+
17
+ mongoid:
18
+ attributes:
19
+ doorkeeper/application:
20
+ name: 'Name'
21
+ redirect_uri: 'Redirect URI'
22
+ errors:
23
+ models:
24
+ doorkeeper/application:
25
+ attributes:
26
+ redirect_uri:
27
+ fragment_present: 'cannot contain a fragment.'
28
+ invalid_uri: 'must be a valid URI.'
29
+ relative_uri: 'must be an absolute URI.'
30
+ secured_uri: 'must be an HTTPS/SSL URI.'
31
+
32
+ mongo_mapper:
33
+ attributes:
34
+ doorkeeper/application:
35
+ name: 'Name'
36
+ redirect_uri: 'Redirect URI'
37
+ errors:
38
+ models:
39
+ doorkeeper/application:
40
+ attributes:
41
+ redirect_uri:
42
+ fragment_present: 'cannot contain a fragment.'
43
+ invalid_uri: 'must be a valid URI.'
44
+ relative_uri: 'must be an absolute URI.'
45
+ secured_uri: 'must be an HTTPS/SSL URI.'
46
+
47
+ doorkeeper:
48
+ applications:
49
+ confirmations:
50
+ destroy: 'Are you sure?'
51
+ buttons:
52
+ edit: 'Edit'
53
+ destroy: 'Destroy'
54
+ submit: 'Submit'
55
+ cancel: 'Cancel'
56
+ authorize: 'Authorize'
57
+ form:
58
+ error: 'Whoops! Check your form for possible errors'
59
+ help:
60
+ redirect_uri: 'Use one line per URI'
61
+ native_redirect_uri: 'Use %{native_redirect_uri} for local tests'
62
+ edit:
63
+ title: 'Edit application'
64
+ index:
65
+ title: 'Your applications'
66
+ new: 'New Application'
67
+ name: 'Name'
68
+ callback_url: 'Callback URL'
69
+ new:
70
+ title: 'New Application'
71
+ show:
72
+ title: 'Application: %{name}'
73
+ application_id: 'Application Id'
74
+ secret: 'Secret'
75
+ callback_urls: 'Callback urls'
76
+ actions: 'Actions'
77
+
78
+ authorizations:
79
+ buttons:
80
+ authorize: 'Authorize'
81
+ deny: 'Deny'
82
+ error:
83
+ title: 'An error has occurred'
84
+ new:
85
+ title: 'Authorize required'
86
+ prompt: 'Authorize %{client_name} to use your account?'
87
+ able_to: 'This application will be able to'
88
+ show:
89
+ title: 'Authorization code'
90
+
91
+ authorized_applications:
92
+ confirmations:
93
+ revoke: 'Are you sure?'
94
+ buttons:
95
+ revoke: 'Revoke'
96
+ index:
97
+ title: 'Your authorized applications'
98
+ application: 'Application'
99
+ created_at: 'Created At'
100
+ date_format: '%Y-%m-%d %H:%M:%S'
101
+
102
+ errors:
103
+ messages:
104
+ # Common error messages
105
+ invalid_request: 'The request is missing a required parameter, includes an unsupported parameter value, or is otherwise malformed.'
106
+ invalid_redirect_uri: 'The redirect uri included is not valid.'
107
+ unauthorized_client: 'The client is not authorized to perform this request using this method.'
108
+ access_denied: 'The resource owner or authorization server denied the request.'
109
+ invalid_scope: 'The requested scope is invalid, unknown, or malformed.'
110
+ server_error: 'The authorization server encountered an unexpected condition which prevented it from fulfilling the request.'
111
+ temporarily_unavailable: 'The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server.'
112
+
113
+ #configuration error messages
114
+ credential_flow_not_configured: 'Resource Owner Password Credentials flow failed due to Doorkeeper.configure.resource_owner_from_credentials being unconfigured.'
115
+ resource_owner_authenticator_not_configured: 'Resource Owner find failed due to Doorkeeper.configure.resource_owner_authenticator being unconfiged.'
116
+
117
+ # Access grant errors
118
+ unsupported_response_type: 'The authorization server does not support this response type.'
119
+
120
+ # Access token errors
121
+ invalid_client: 'Client authentication failed due to unknown client, no client authentication included, or unsupported authentication method.'
122
+ invalid_grant: 'The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.'
123
+ unsupported_grant_type: 'The authorization grant type is not supported by the authorization server.'
124
+
125
+ # Password Access token errors
126
+ invalid_resource_owner: 'The provided resource owner credentials are not valid, or resource owner cannot be found'
127
+
128
+ invalid_token:
129
+ revoked: "The access token was revoked"
130
+ expired: "The access token expired"
131
+ unknown: "The access token is invalid"
132
+
133
+ flash:
134
+ applications:
135
+ create:
136
+ notice: 'Application created.'
137
+ destroy:
138
+ notice: 'Application deleted.'
139
+ update:
140
+ notice: 'Application updated.'
141
+ authorized_applications:
142
+ destroy:
143
+ notice: 'Application revoked.'
144
+
145
+ layouts:
146
+ admin:
147
+ nav:
148
+ oauth2_provider: 'OAuth2 Provider'
149
+ applications: 'Applications'
150
+ application:
151
+ title: 'OAuth authorize required'
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ devise_for :users
3
+ use_doorkeeper
4
+ get 'example', to: 'example#index'
5
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: 20abea895fc60ab194c02c06668071f11562a9186fcf72433b07d67e40b7ad36173f44071f8e11b1d1fd681b8ae888fbe24017d5a7470b506a606e601d18dc3f
15
+
16
+ test:
17
+ secret_key_base: 987dc19825ddc0fceef9f8732b4d9300686978b34db957b80fc48e28e2308cb201e7b74c76f005b6c304b97e323d232a64317e3766a46cf84777d2e94b384c81
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,8 @@
1
+ class CreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table :users do |t|
4
+
5
+ t.timestamps null: false
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,42 @@
1
+ class CreateDoorkeeperTables < ActiveRecord::Migration
2
+ def change
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.text :redirect_uri, null: false
8
+ t.string :scopes, null: false, default: ''
9
+ t.timestamps
10
+ end
11
+
12
+ add_index :oauth_applications, :uid, unique: true
13
+
14
+ create_table :oauth_access_grants do |t|
15
+ t.integer :resource_owner_id, null: false
16
+ t.integer :application_id, null: false
17
+ t.string :token, null: false
18
+ t.integer :expires_in, null: false
19
+ t.text :redirect_uri, null: false
20
+ t.datetime :created_at, null: false
21
+ t.datetime :revoked_at
22
+ t.string :scopes
23
+ end
24
+
25
+ add_index :oauth_access_grants, :token, unique: true
26
+
27
+ create_table :oauth_access_tokens do |t|
28
+ t.integer :resource_owner_id
29
+ t.integer :application_id
30
+ t.string :token, null: false
31
+ t.string :refresh_token
32
+ t.integer :expires_in
33
+ t.datetime :revoked_at
34
+ t.datetime :created_at, null: false
35
+ t.string :scopes
36
+ end
37
+
38
+ add_index :oauth_access_tokens, :token, unique: true
39
+ add_index :oauth_access_tokens, :resource_owner_id
40
+ add_index :oauth_access_tokens, :refresh_token, unique: true
41
+ end
42
+ end