doorkeeper 3.0.0 → 4.0.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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +4 -0
  3. data/.travis.yml +9 -7
  4. data/CONTRIBUTING.md +2 -0
  5. data/Gemfile +10 -3
  6. data/NEWS.md +79 -2
  7. data/README.md +56 -51
  8. data/RELEASING.md +2 -2
  9. data/Rakefile +1 -1
  10. data/app/assets/stylesheets/doorkeeper/admin/application.css +1 -5
  11. data/app/controllers/doorkeeper/application_metal_controller.rb +1 -2
  12. data/app/controllers/doorkeeper/applications_controller.rb +2 -2
  13. data/app/controllers/doorkeeper/authorizations_controller.rb +1 -1
  14. data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
  15. data/app/controllers/doorkeeper/tokens_controller.rb +1 -1
  16. data/app/helpers/doorkeeper/dashboard_helper.rb +13 -11
  17. data/app/views/doorkeeper/applications/show.html.erb +1 -1
  18. data/app/views/doorkeeper/authorizations/new.html.erb +1 -1
  19. data/app/views/layouts/doorkeeper/admin.html.erb +5 -2
  20. data/config/locales/en.yml +1 -0
  21. data/doorkeeper.gemspec +7 -7
  22. data/lib/doorkeeper/config.rb +10 -15
  23. data/lib/doorkeeper/engine.rb +11 -7
  24. data/lib/doorkeeper/errors.rb +6 -0
  25. data/lib/doorkeeper/helpers/controller.rb +7 -1
  26. data/lib/doorkeeper/models/access_grant_mixin.rb +9 -5
  27. data/lib/doorkeeper/models/access_token_mixin.rb +28 -22
  28. data/lib/doorkeeper/models/application_mixin.rb +3 -7
  29. data/lib/doorkeeper/models/concerns/expirable.rb +2 -2
  30. data/lib/doorkeeper/models/concerns/ownership.rb +6 -1
  31. data/lib/doorkeeper/models/concerns/revocable.rb +19 -2
  32. data/lib/doorkeeper/oauth/authorization/uri_builder.rb +1 -1
  33. data/lib/doorkeeper/oauth/authorization_code_request.rb +10 -5
  34. data/lib/doorkeeper/oauth/client/credentials.rb +1 -1
  35. data/lib/doorkeeper/oauth/client_credentials/creator.rb +3 -4
  36. data/lib/doorkeeper/oauth/client_credentials/issuer.rb +2 -1
  37. data/lib/doorkeeper/oauth/client_credentials_request.rb +7 -4
  38. data/lib/doorkeeper/oauth/code_response.rb +13 -14
  39. data/lib/doorkeeper/oauth/error.rb +5 -1
  40. data/lib/doorkeeper/oauth/helpers/scope_checker.rb +1 -1
  41. data/lib/doorkeeper/oauth/helpers/uri_checker.rb +2 -1
  42. data/lib/doorkeeper/oauth/password_access_token_request.rb +6 -10
  43. data/lib/doorkeeper/oauth/refresh_token_request.rb +29 -12
  44. data/lib/doorkeeper/oauth/scopes.rb +2 -2
  45. data/lib/doorkeeper/oauth/token.rb +6 -5
  46. data/lib/doorkeeper/oauth/token_response.rb +1 -1
  47. data/lib/doorkeeper/orm/active_record/access_grant.rb +2 -2
  48. data/lib/doorkeeper/orm/active_record/access_token.rb +10 -2
  49. data/lib/doorkeeper/orm/active_record/application.rb +4 -9
  50. data/lib/doorkeeper/orm/active_record.rb +0 -15
  51. data/lib/doorkeeper/rails/helpers.rb +13 -3
  52. data/lib/doorkeeper/rails/routes/mapper.rb +1 -1
  53. data/lib/doorkeeper/rails/routes.rb +2 -1
  54. data/lib/doorkeeper/request/authorization_code.rb +10 -15
  55. data/lib/doorkeeper/request/client_credentials.rb +9 -15
  56. data/lib/doorkeeper/request/code.rb +7 -13
  57. data/lib/doorkeeper/request/password.rb +18 -13
  58. data/lib/doorkeeper/request/refresh_token.rb +11 -13
  59. data/lib/doorkeeper/request/strategy.rb +17 -0
  60. data/lib/doorkeeper/request/token.rb +7 -13
  61. data/lib/doorkeeper/request.rb +18 -8
  62. data/lib/doorkeeper/server.rb +2 -2
  63. data/lib/doorkeeper/version.rb +1 -1
  64. data/lib/doorkeeper.rb +1 -1
  65. data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +29 -0
  66. data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb +1 -1
  67. data/lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb +11 -0
  68. data/lib/generators/doorkeeper/templates/initializer.rb +2 -2
  69. data/lib/generators/doorkeeper/templates/migration.rb +23 -5
  70. data/spec/controllers/authorizations_controller_spec.rb +0 -14
  71. data/spec/controllers/protected_resources_controller_spec.rb +138 -15
  72. data/spec/controllers/tokens_controller_spec.rb +30 -0
  73. data/spec/dummy/app/controllers/full_protected_resources_controller.rb +4 -4
  74. data/spec/dummy/app/controllers/home_controller.rb +1 -1
  75. data/spec/dummy/app/controllers/metal_controller.rb +1 -1
  76. data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +3 -3
  77. data/spec/dummy/app/models/user.rb +0 -4
  78. data/spec/dummy/config/application.rb +2 -36
  79. data/spec/dummy/config/environment.rb +1 -1
  80. data/spec/dummy/config/environments/test.rb +4 -15
  81. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
  82. data/spec/dummy/config/initializers/doorkeeper.rb +2 -2
  83. data/spec/dummy/db/migrate/{20130902165751_create_doorkeeper_tables.rb → 20151223192035_create_doorkeeper_tables.rb} +24 -5
  84. data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +11 -0
  85. data/spec/dummy/db/schema.rb +23 -22
  86. data/spec/lib/config_spec.rb +2 -2
  87. data/spec/lib/models/revocable_spec.rb +27 -4
  88. data/spec/lib/oauth/authorization_code_request_spec.rb +1 -1
  89. data/spec/lib/oauth/client_credentials/creator_spec.rb +25 -1
  90. data/spec/lib/oauth/code_response_spec.rb +34 -0
  91. data/spec/lib/oauth/error_response_spec.rb +7 -7
  92. data/spec/lib/oauth/error_spec.rb +9 -5
  93. data/spec/lib/oauth/password_access_token_request_spec.rb +5 -5
  94. data/spec/lib/oauth/refresh_token_request_spec.rb +34 -3
  95. data/spec/lib/oauth/scopes_spec.rb +1 -2
  96. data/spec/lib/oauth/token_spec.rb +12 -5
  97. data/spec/lib/request/strategy_spec.rb +53 -0
  98. data/spec/lib/server_spec.rb +1 -1
  99. data/spec/models/doorkeeper/access_grant_spec.rb +5 -5
  100. data/spec/models/doorkeeper/access_token_spec.rb +49 -5
  101. data/spec/models/doorkeeper/application_spec.rb +2 -10
  102. data/spec/requests/flows/authorization_code_spec.rb +26 -0
  103. data/spec/requests/flows/password_spec.rb +26 -5
  104. data/spec/requests/flows/refresh_token_spec.rb +95 -17
  105. data/spec/spec_helper_integration.rb +10 -0
  106. data/spec/support/helpers/model_helper.rb +27 -5
  107. data/spec/support/http_method_shim.rb +24 -0
  108. data/spec/support/shared/controllers_shared_context.rb +13 -4
  109. data/spec/support/shared/models_shared_examples.rb +1 -1
  110. metadata +46 -38
  111. data/lib/generators/doorkeeper/application_scopes_generator.rb +0 -34
  112. data/lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb +0 -5
  113. data/spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb +0 -5
  114. /data/spec/dummy/db/migrate/{20130902175349_add_owner_to_application.rb → 20151223200000_add_owner_to_application.rb} +0 -0
@@ -24,14 +24,26 @@ describe 'Resource Owner Password Credentials Flow' do
24
24
  end
25
25
 
26
26
  context 'with valid user credentials' do
27
- it 'should issue new token' do
27
+ it 'should issue new token with confidential client' do
28
28
  expect do
29
29
  post password_token_endpoint_url(client: @client, resource_owner: @resource_owner)
30
30
  end.to change { Doorkeeper::AccessToken.count }.by(1)
31
31
 
32
32
  token = Doorkeeper::AccessToken.first
33
33
 
34
- should_have_json 'access_token', token.token
34
+ expect(token.application_id).to eq @client.id
35
+ should_have_json 'access_token', token.token
36
+ end
37
+
38
+ it 'should issue new token with public client (only client_id present)' do
39
+ expect do
40
+ post password_token_endpoint_url(client_id: @client.uid, resource_owner: @resource_owner)
41
+ end.to change { Doorkeeper::AccessToken.count }.by(1)
42
+
43
+ token = Doorkeeper::AccessToken.first
44
+
45
+ expect(token.application_id).to eq @client.id
46
+ should_have_json 'access_token', token.token
35
47
  end
36
48
 
37
49
  it 'should issue new token without client credentials' do
@@ -41,7 +53,8 @@ describe 'Resource Owner Password Credentials Flow' do
41
53
 
42
54
  token = Doorkeeper::AccessToken.first
43
55
 
44
- should_have_json 'access_token', token.token
56
+ expect(token.application_id).to be_nil
57
+ should_have_json 'access_token', token.token
45
58
  end
46
59
 
47
60
  it 'should issue a refresh token if enabled' do
@@ -51,7 +64,7 @@ describe 'Resource Owner Password Credentials Flow' do
51
64
 
52
65
  token = Doorkeeper::AccessToken.first
53
66
 
54
- should_have_json 'refresh_token', token.refresh_token
67
+ should_have_json 'refresh_token', token.refresh_token
55
68
  end
56
69
 
57
70
  it 'should return the same token if it is still accessible' do
@@ -82,7 +95,7 @@ describe 'Resource Owner Password Credentials Flow' do
82
95
  end
83
96
  end
84
97
 
85
- context 'with invalid client credentials' do
98
+ context 'with invalid confidential client credentials' do
86
99
  it 'should not issue new token with bad client credentials' do
87
100
  expect do
88
101
  post password_token_endpoint_url(client_id: @client.uid,
@@ -91,4 +104,12 @@ describe 'Resource Owner Password Credentials Flow' do
91
104
  end.to_not change { Doorkeeper::AccessToken.count }
92
105
  end
93
106
  end
107
+
108
+ context 'with invalid public client id' do
109
+ it 'should not issue new token with bad client id' do
110
+ expect do
111
+ post password_token_endpoint_url(client_id: 'bad_id', resource_owner: @resource_owner)
112
+ end.to_not change { Doorkeeper::AccessToken.count }
113
+ end
114
+ end
94
115
  end
@@ -37,20 +37,62 @@ describe 'Refresh Token Flow' do
37
37
 
38
38
  context 'refreshing the token' do
39
39
  before do
40
- @token = FactoryGirl.create(:access_token, application: @client, resource_owner_id: 1, use_refresh_token: true)
40
+ @token = FactoryGirl.create(
41
+ :access_token,
42
+ application: @client,
43
+ resource_owner_id: 1,
44
+ use_refresh_token: true
45
+ )
41
46
  end
42
47
 
43
- it 'client request a token with refresh token' do
44
- post refresh_token_endpoint_url(client: @client, refresh_token: @token.refresh_token)
45
- should_have_json 'refresh_token', Doorkeeper::AccessToken.last.refresh_token
46
- expect(@token.reload).to be_revoked
48
+ context "refresh_token revoked on use" do
49
+ it 'client request a token with refresh token' do
50
+ post refresh_token_endpoint_url(
51
+ client: @client, refresh_token: @token.refresh_token
52
+ )
53
+ should_have_json(
54
+ 'refresh_token', Doorkeeper::AccessToken.last.refresh_token
55
+ )
56
+ expect(@token.reload).not_to be_revoked
57
+ end
58
+
59
+ it 'client request a token with expired access token' do
60
+ @token.update_attribute :expires_in, -100
61
+ post refresh_token_endpoint_url(
62
+ client: @client, refresh_token: @token.refresh_token
63
+ )
64
+ should_have_json(
65
+ 'refresh_token', Doorkeeper::AccessToken.last.refresh_token
66
+ )
67
+ expect(@token.reload).not_to be_revoked
68
+ end
47
69
  end
48
70
 
49
- it 'client request a token with expired access token' do
50
- @token.update_attribute :expires_in, -100
51
- post refresh_token_endpoint_url(client: @client, refresh_token: @token.refresh_token)
52
- should_have_json 'refresh_token', Doorkeeper::AccessToken.last.refresh_token
53
- expect(@token.reload).to be_revoked
71
+ context "refresh_token revoked on refresh_token request" do
72
+ before do
73
+ allow(Doorkeeper::AccessToken).to receive(:refresh_token_revoked_on_use?).and_return(false)
74
+ end
75
+
76
+ it 'client request a token with refresh token' do
77
+ post refresh_token_endpoint_url(
78
+ client: @client, refresh_token: @token.refresh_token
79
+ )
80
+ should_have_json(
81
+ 'refresh_token', Doorkeeper::AccessToken.last.refresh_token
82
+ )
83
+ expect(@token.reload).to be_revoked
84
+ end
85
+
86
+ it 'client request a token with expired access token' do
87
+ @token.update_attribute :expires_in, -100
88
+ post refresh_token_endpoint_url(
89
+ client: @client, refresh_token: @token.refresh_token
90
+ )
91
+ should_have_json(
92
+ 'refresh_token', Doorkeeper::AccessToken.last.refresh_token
93
+ )
94
+ expect(@token.reload).to be_revoked
95
+ end
54
96
  end
55
97
 
56
98
  it 'client gets an error for invalid refresh token' do
@@ -65,26 +107,62 @@ describe 'Refresh Token Flow' do
65
107
  should_not_have_json 'refresh_token'
66
108
  should_have_json 'error', 'invalid_grant'
67
109
  end
110
+
111
+ it 'second of simultaneous client requests get an error for revoked acccess token' do
112
+ allow_any_instance_of(Doorkeeper::AccessToken).to receive(:revoked?).and_return(false, true)
113
+ post refresh_token_endpoint_url(client: @client, refresh_token: @token.refresh_token)
114
+
115
+ should_not_have_json 'refresh_token'
116
+ should_have_json 'error', 'invalid_request'
117
+ end
68
118
  end
69
119
 
70
120
  context 'refreshing the token with multiple sessions (devices)' do
71
121
  before do
72
122
  # enable password auth to simulate other devices
73
123
  config_is_set(:grant_flows, ["password"])
74
- config_is_set(:resource_owner_from_credentials) { User.authenticate! params[:username], params[:password] }
124
+ config_is_set(:resource_owner_from_credentials) do
125
+ User.authenticate! params[:username], params[:password]
126
+ end
75
127
  create_resource_owner
76
- _another_token = post password_token_endpoint_url(client: @client, resource_owner: @resource_owner)
128
+ _another_token = post password_token_endpoint_url(
129
+ client: @client, resource_owner: @resource_owner
130
+ )
77
131
  last_token.update_attribute :created_at, 5.seconds.ago
78
132
 
79
- @token = FactoryGirl.create(:access_token, application: @client, resource_owner_id: @resource_owner.id, use_refresh_token: true)
133
+ @token = FactoryGirl.create(
134
+ :access_token,
135
+ application: @client,
136
+ resource_owner_id: @resource_owner.id,
137
+ use_refresh_token: true
138
+ )
80
139
  @token.update_attribute :expires_in, -100
81
140
  end
82
141
 
83
- it 'client request a token after creating another token with the same user' do
84
- post refresh_token_endpoint_url(client: @client, refresh_token: @token.refresh_token)
142
+ context "refresh_token revoked on use" do
143
+ it 'client request a token after creating another token with the same user' do
144
+ post refresh_token_endpoint_url(
145
+ client: @client, refresh_token: @token.refresh_token
146
+ )
147
+
148
+ should_have_json 'refresh_token', last_token.refresh_token
149
+ expect(@token.reload).not_to be_revoked
150
+ end
151
+ end
152
+
153
+ context "refresh_token revoked on refresh_token request" do
154
+ before do
155
+ allow(Doorkeeper::AccessToken).to receive(:refresh_token_revoked_on_use?).and_return(false)
156
+ end
157
+
158
+ it 'client request a token after creating another token with the same user' do
159
+ post refresh_token_endpoint_url(
160
+ client: @client, refresh_token: @token.refresh_token
161
+ )
85
162
 
86
- should_have_json 'refresh_token', last_token.refresh_token
87
- expect(@token.reload).to be_revoked
163
+ should_have_json 'refresh_token', last_token.refresh_token
164
+ expect(@token.reload).to be_revoked
165
+ end
88
166
  end
89
167
 
90
168
  def last_token
@@ -14,6 +14,13 @@ require 'generator_spec/test_case'
14
14
  require 'timecop'
15
15
  require 'database_cleaner'
16
16
 
17
+ # Load JRuby SQLite3 if in that platform
18
+ begin
19
+ require 'jdbc/sqlite3'
20
+ Jdbc::SQLite3.load_driver
21
+ rescue LoadError
22
+ end
23
+
17
24
  Rails.logger.info "====> Doorkeeper.orm = #{Doorkeeper.configuration.orm.inspect}"
18
25
  if Doorkeeper.configuration.orm == :active_record
19
26
  Rails.logger.info "======> active_record.table_name_prefix = #{Rails.configuration.active_record.table_name_prefix.inspect}"
@@ -28,6 +35,9 @@ ENGINE_RAILS_ROOT = File.join(File.dirname(__FILE__), '../')
28
35
 
29
36
  Dir["#{File.dirname(__FILE__)}/support/{dependencies,helpers,shared}/*.rb"].each { |f| require f }
30
37
 
38
+ # Remove after dropping support of Rails 4.2
39
+ require "#{File.dirname(__FILE__)}/support/http_method_shim.rb"
40
+
31
41
  RSpec.configure do |config|
32
42
  config.infer_spec_type_from_file_location!
33
43
  config.mock_with :rspec
@@ -13,14 +13,20 @@ module ModelHelper
13
13
 
14
14
  def access_grant_should_exist_for(client, resource_owner)
15
15
  grant = Doorkeeper::AccessGrant.first
16
- expect(grant.application).to eq(client)
17
- grant.resource_owner_id == resource_owner.id
16
+
17
+ expect(grant.application).to have_attributes(id: client.id).
18
+ and(be_instance_of(Doorkeeper::Application))
19
+
20
+ expect(grant.resource_owner_id).to eq(resource_owner.id)
18
21
  end
19
22
 
20
23
  def access_token_should_exist_for(client, resource_owner)
21
- grant = Doorkeeper::AccessToken.first
22
- expect(grant.application).to eq(client)
23
- grant.resource_owner_id == resource_owner.id
24
+ token = Doorkeeper::AccessToken.first
25
+
26
+ expect(token.application).to have_attributes(id: client.id).
27
+ and(be_instance_of(Doorkeeper::Application))
28
+
29
+ expect(token.resource_owner_id).to eq(resource_owner.id)
24
30
  end
25
31
 
26
32
  def access_grant_should_not_exist
@@ -40,6 +46,22 @@ module ModelHelper
40
46
  grant = Doorkeeper::AccessToken.last
41
47
  expect(grant.scopes).to eq(Doorkeeper::OAuth::Scopes.from_array(args))
42
48
  end
49
+
50
+ def uniqueness_error
51
+ case DOORKEEPER_ORM
52
+ when :active_record
53
+ ActiveRecord::RecordNotUnique
54
+ when :sequel
55
+ error_classes = [Sequel::UniqueConstraintViolation, Sequel::ValidationFailed]
56
+ proc { |error| expect(error.class).to be_in(error_classes) }
57
+ when :mongo_mapper
58
+ MongoMapper::DocumentNotValid
59
+ when /mongoid/
60
+ Mongoid::Errors::Validations
61
+ else
62
+ raise "'#{DOORKEEPER_ORM}' ORM is not supported!"
63
+ end
64
+ end
43
65
  end
44
66
 
45
67
  RSpec.configuration.send :include, ModelHelper
@@ -0,0 +1,24 @@
1
+ # Rails 5 deprecates calling HTTP action methods with positional arguments
2
+ # in favor of keyword arguments. However, the keyword argument form is only
3
+ # supported in Rails 5+. Since we support back to 4, we need some sort of shim
4
+ # to avoid super noisy deprecations when running tests.
5
+ module HTTPMethodShim
6
+ def get(path, params = nil, headers = nil)
7
+ super(path, params: params, headers: headers)
8
+ end
9
+
10
+ def post(path, params = nil, headers = nil)
11
+ super(path, params: params, headers: headers)
12
+ end
13
+
14
+ def put(path, params = nil, headers = nil)
15
+ super(path, params: params, headers: headers)
16
+ end
17
+ end
18
+
19
+ if ::Rails::VERSION::MAJOR >= 5
20
+ RSpec.configure do |config|
21
+ config.include HTTPMethodShim, type: :controller
22
+ config.include HTTPMethodShim, type: :request
23
+ end
24
+ end
@@ -4,11 +4,15 @@ shared_context 'valid token', token: :valid do
4
4
  end
5
5
 
6
6
  let :token do
7
- double(Doorkeeper::AccessToken, accessible?: true, includes_scope?: true, acceptable?: true)
7
+ double(Doorkeeper::AccessToken,
8
+ accessible?: true, includes_scope?: true, acceptable?: true,
9
+ previous_refresh_token: "", revoke_previous_refresh_token!: true)
8
10
  end
9
11
 
10
12
  before :each do
11
- allow(Doorkeeper::AccessToken).to receive(:by_token).with(token_string).and_return(token)
13
+ allow(
14
+ Doorkeeper::AccessToken
15
+ ).to receive(:by_token).with(token_string).and_return(token)
12
16
  end
13
17
  end
14
18
 
@@ -18,11 +22,16 @@ shared_context 'invalid token', token: :invalid do
18
22
  end
19
23
 
20
24
  let :token do
21
- double(Doorkeeper::AccessToken, accessible?: false, revoked?: false, expired?: false, includes_scope?: false, acceptable?: false)
25
+ double(Doorkeeper::AccessToken,
26
+ accessible?: false, revoked?: false, expired?: false,
27
+ includes_scope?: false, acceptable?: false,
28
+ previous_refresh_token: "", revoke_previous_refresh_token!: true)
22
29
  end
23
30
 
24
31
  before :each do
25
- allow(Doorkeeper::AccessToken).to receive(:by_token).with(token_string).and_return(token)
32
+ allow(
33
+ Doorkeeper::AccessToken
34
+ ).to receive(:by_token).with(token_string).and_return(token)
26
35
  end
27
36
  end
28
37
 
@@ -46,7 +46,7 @@ shared_examples 'a unique token' do
46
46
  token2.token = token1.token
47
47
  expect do
48
48
  token2.save!(validate: false)
49
- end.to raise_error
49
+ end.to raise_error(uniqueness_error)
50
50
  end
51
51
  end
52
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felipe Elias Philipp
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-30 00:00:00.000000000 Z
12
+ date: 2016-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -17,56 +17,56 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3.2'
20
+ version: '4.2'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '3.2'
27
+ version: '4.2'
28
28
  - !ruby/object:Gem::Dependency
29
- name: sqlite3
29
+ name: capybara
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 1.3.5
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: 1.3.5
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rspec-rails
43
+ name: database_cleaner
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 3.2.0
48
+ version: 1.3.0
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
- version: 3.2.0
55
+ version: 1.3.0
56
56
  - !ruby/object:Gem::Dependency
57
- name: capybara
57
+ name: factory_girl
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: 2.3.0
62
+ version: 4.5.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: 2.3.0
69
+ version: 4.5.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: generator_spec
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -82,47 +82,47 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: 0.9.0
84
84
  - !ruby/object:Gem::Dependency
85
- name: factory_girl
85
+ name: rake
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ">"
89
89
  - !ruby/object:Gem::Version
90
- version: 4.5.0
90
+ version: 10.5.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ">"
96
96
  - !ruby/object:Gem::Version
97
- version: 4.5.0
97
+ version: 10.5.0
98
98
  - !ruby/object:Gem::Dependency
99
- name: timecop
99
+ name: rspec-rails
100
100
  requirement: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - "~>"
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: 0.7.0
104
+ version: '0'
105
105
  type: :development
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
- - - "~>"
109
+ - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 0.7.0
111
+ version: '0'
112
112
  - !ruby/object:Gem::Dependency
113
- name: database_cleaner
113
+ name: timecop
114
114
  requirement: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: 1.3.0
118
+ version: 0.7.0
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: 1.3.0
125
+ version: 0.7.0
126
126
  description: Doorkeeper is an OAuth 2 provider for Rails and Grape.
127
127
  email:
128
128
  - tutecosta@gmail.com
@@ -224,17 +224,18 @@ files:
224
224
  - lib/doorkeeper/request/code.rb
225
225
  - lib/doorkeeper/request/password.rb
226
226
  - lib/doorkeeper/request/refresh_token.rb
227
+ - lib/doorkeeper/request/strategy.rb
227
228
  - lib/doorkeeper/request/token.rb
228
229
  - lib/doorkeeper/server.rb
229
230
  - lib/doorkeeper/validations.rb
230
231
  - lib/doorkeeper/version.rb
231
232
  - lib/generators/doorkeeper/application_owner_generator.rb
232
- - lib/generators/doorkeeper/application_scopes_generator.rb
233
233
  - lib/generators/doorkeeper/install_generator.rb
234
234
  - lib/generators/doorkeeper/migration_generator.rb
235
+ - lib/generators/doorkeeper/previous_refresh_token_generator.rb
235
236
  - lib/generators/doorkeeper/templates/README
236
237
  - lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb
237
- - lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb
238
+ - lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb
238
239
  - lib/generators/doorkeeper/templates/initializer.rb
239
240
  - lib/generators/doorkeeper/templates/migration.rb
240
241
  - lib/generators/doorkeeper/views_generator.rb
@@ -262,6 +263,7 @@ files:
262
263
  - spec/dummy/config/environments/development.rb
263
264
  - spec/dummy/config/environments/production.rb
264
265
  - spec/dummy/config/environments/test.rb
266
+ - spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb
265
267
  - spec/dummy/config/initializers/backtrace_silencers.rb
266
268
  - spec/dummy/config/initializers/doorkeeper.rb
267
269
  - spec/dummy/config/initializers/secret_token.rb
@@ -271,9 +273,9 @@ files:
271
273
  - spec/dummy/config/routes.rb
272
274
  - spec/dummy/db/migrate/20111122132257_create_users.rb
273
275
  - spec/dummy/db/migrate/20120312140401_add_password_to_users.rb
274
- - spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb
275
- - spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb
276
- - spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb
276
+ - spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb
277
+ - spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb
278
+ - spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb
277
279
  - spec/dummy/db/schema.rb
278
280
  - spec/dummy/public/404.html
279
281
  - spec/dummy/public/422.html
@@ -303,6 +305,7 @@ files:
303
305
  - spec/lib/oauth/client_credentials_request_spec.rb
304
306
  - spec/lib/oauth/client_spec.rb
305
307
  - spec/lib/oauth/code_request_spec.rb
308
+ - spec/lib/oauth/code_response_spec.rb
306
309
  - spec/lib/oauth/error_response_spec.rb
307
310
  - spec/lib/oauth/error_spec.rb
308
311
  - spec/lib/oauth/forbidden_token_response_spec.rb
@@ -317,6 +320,7 @@ files:
317
320
  - spec/lib/oauth/token_request_spec.rb
318
321
  - spec/lib/oauth/token_response_spec.rb
319
322
  - spec/lib/oauth/token_spec.rb
323
+ - spec/lib/request/strategy_spec.rb
320
324
  - spec/lib/server_spec.rb
321
325
  - spec/models/doorkeeper/access_grant_spec.rb
322
326
  - spec/models/doorkeeper/access_token_spec.rb
@@ -348,6 +352,7 @@ files:
348
352
  - spec/support/helpers/model_helper.rb
349
353
  - spec/support/helpers/request_spec_helper.rb
350
354
  - spec/support/helpers/url_helper.rb
355
+ - spec/support/http_method_shim.rb
351
356
  - spec/support/orm/active_record.rb
352
357
  - spec/support/shared/controllers_shared_context.rb
353
358
  - spec/support/shared/models_shared_examples.rb
@@ -373,7 +378,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
373
378
  version: '0'
374
379
  requirements: []
375
380
  rubyforge_project:
376
- rubygems_version: 2.4.5
381
+ rubygems_version: 2.6.2
377
382
  signing_key:
378
383
  specification_version: 4
379
384
  summary: OAuth 2 provider for Rails and Grape
@@ -402,6 +407,7 @@ test_files:
402
407
  - spec/dummy/config/environments/development.rb
403
408
  - spec/dummy/config/environments/production.rb
404
409
  - spec/dummy/config/environments/test.rb
410
+ - spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb
405
411
  - spec/dummy/config/initializers/backtrace_silencers.rb
406
412
  - spec/dummy/config/initializers/doorkeeper.rb
407
413
  - spec/dummy/config/initializers/secret_token.rb
@@ -411,9 +417,9 @@ test_files:
411
417
  - spec/dummy/config/routes.rb
412
418
  - spec/dummy/db/migrate/20111122132257_create_users.rb
413
419
  - spec/dummy/db/migrate/20120312140401_add_password_to_users.rb
414
- - spec/dummy/db/migrate/20130902165751_create_doorkeeper_tables.rb
415
- - spec/dummy/db/migrate/20130902175349_add_owner_to_application.rb
416
- - spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb
420
+ - spec/dummy/db/migrate/20151223192035_create_doorkeeper_tables.rb
421
+ - spec/dummy/db/migrate/20151223200000_add_owner_to_application.rb
422
+ - spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb
417
423
  - spec/dummy/db/schema.rb
418
424
  - spec/dummy/public/404.html
419
425
  - spec/dummy/public/422.html
@@ -443,6 +449,7 @@ test_files:
443
449
  - spec/lib/oauth/client_credentials_request_spec.rb
444
450
  - spec/lib/oauth/client_spec.rb
445
451
  - spec/lib/oauth/code_request_spec.rb
452
+ - spec/lib/oauth/code_response_spec.rb
446
453
  - spec/lib/oauth/error_response_spec.rb
447
454
  - spec/lib/oauth/error_spec.rb
448
455
  - spec/lib/oauth/forbidden_token_response_spec.rb
@@ -457,6 +464,7 @@ test_files:
457
464
  - spec/lib/oauth/token_request_spec.rb
458
465
  - spec/lib/oauth/token_response_spec.rb
459
466
  - spec/lib/oauth/token_spec.rb
467
+ - spec/lib/request/strategy_spec.rb
460
468
  - spec/lib/server_spec.rb
461
469
  - spec/models/doorkeeper/access_grant_spec.rb
462
470
  - spec/models/doorkeeper/access_token_spec.rb
@@ -488,8 +496,8 @@ test_files:
488
496
  - spec/support/helpers/model_helper.rb
489
497
  - spec/support/helpers/request_spec_helper.rb
490
498
  - spec/support/helpers/url_helper.rb
499
+ - spec/support/http_method_shim.rb
491
500
  - spec/support/orm/active_record.rb
492
501
  - spec/support/shared/controllers_shared_context.rb
493
502
  - spec/support/shared/models_shared_examples.rb
494
503
  - spec/validators/redirect_uri_validator_spec.rb
495
- has_rdoc:
@@ -1,34 +0,0 @@
1
- require 'rails/generators/active_record'
2
-
3
- class Doorkeeper::ApplicationScopesGenerator < Rails::Generators::Base
4
- include Rails::Generators::Migration
5
- source_root File.expand_path('../templates', __FILE__)
6
- desc 'Copies ActiveRecord migrations to handle upgrade to doorkeeper 2'
7
-
8
- def self.next_migration_number(path)
9
- ActiveRecord::Generators::Base.next_migration_number(path)
10
- end
11
-
12
- def application_scopes
13
- if oauth_applications_exists? && !scopes_column_exists?
14
- migration_template(
15
- 'add_scopes_to_oauth_applications.rb',
16
- 'db/migrate/add_scopes_to_oauth_applications.rb'
17
- )
18
- end
19
- end
20
-
21
- private
22
-
23
- def scopes_column_exists?
24
- ActiveRecord::Base.connection.column_exists?(
25
- :oauth_applications,
26
- :scopes
27
- )
28
- end
29
-
30
- # Might be running this before install
31
- def oauth_applications_exists?
32
- ActiveRecord::Base.connection.table_exists? :oauth_applications
33
- end
34
- end
@@ -1,5 +0,0 @@
1
- class AddScopesToOauthApplications < ActiveRecord::Migration
2
- def change
3
- add_column :oauth_applications, :scopes, :string, null: false, default: ''
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddScopesToOauthApplications < ActiveRecord::Migration
2
- def change
3
- add_column :oauth_applications, :scopes, :string, null: false, default: ''
4
- end
5
- end