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.
- checksums.yaml +4 -4
- data/.hound.yml +4 -0
- data/.travis.yml +9 -7
- data/CONTRIBUTING.md +2 -0
- data/Gemfile +10 -3
- data/NEWS.md +79 -2
- data/README.md +56 -51
- data/RELEASING.md +2 -2
- data/Rakefile +1 -1
- data/app/assets/stylesheets/doorkeeper/admin/application.css +1 -5
- data/app/controllers/doorkeeper/application_metal_controller.rb +1 -2
- data/app/controllers/doorkeeper/applications_controller.rb +2 -2
- data/app/controllers/doorkeeper/authorizations_controller.rb +1 -1
- data/app/controllers/doorkeeper/authorized_applications_controller.rb +1 -1
- data/app/controllers/doorkeeper/tokens_controller.rb +1 -1
- data/app/helpers/doorkeeper/dashboard_helper.rb +13 -11
- data/app/views/doorkeeper/applications/show.html.erb +1 -1
- data/app/views/doorkeeper/authorizations/new.html.erb +1 -1
- data/app/views/layouts/doorkeeper/admin.html.erb +5 -2
- data/config/locales/en.yml +1 -0
- data/doorkeeper.gemspec +7 -7
- data/lib/doorkeeper/config.rb +10 -15
- data/lib/doorkeeper/engine.rb +11 -7
- data/lib/doorkeeper/errors.rb +6 -0
- data/lib/doorkeeper/helpers/controller.rb +7 -1
- data/lib/doorkeeper/models/access_grant_mixin.rb +9 -5
- data/lib/doorkeeper/models/access_token_mixin.rb +28 -22
- data/lib/doorkeeper/models/application_mixin.rb +3 -7
- data/lib/doorkeeper/models/concerns/expirable.rb +2 -2
- data/lib/doorkeeper/models/concerns/ownership.rb +6 -1
- data/lib/doorkeeper/models/concerns/revocable.rb +19 -2
- data/lib/doorkeeper/oauth/authorization/uri_builder.rb +1 -1
- data/lib/doorkeeper/oauth/authorization_code_request.rb +10 -5
- data/lib/doorkeeper/oauth/client/credentials.rb +1 -1
- data/lib/doorkeeper/oauth/client_credentials/creator.rb +3 -4
- data/lib/doorkeeper/oauth/client_credentials/issuer.rb +2 -1
- data/lib/doorkeeper/oauth/client_credentials_request.rb +7 -4
- data/lib/doorkeeper/oauth/code_response.rb +13 -14
- data/lib/doorkeeper/oauth/error.rb +5 -1
- data/lib/doorkeeper/oauth/helpers/scope_checker.rb +1 -1
- data/lib/doorkeeper/oauth/helpers/uri_checker.rb +2 -1
- data/lib/doorkeeper/oauth/password_access_token_request.rb +6 -10
- data/lib/doorkeeper/oauth/refresh_token_request.rb +29 -12
- data/lib/doorkeeper/oauth/scopes.rb +2 -2
- data/lib/doorkeeper/oauth/token.rb +6 -5
- data/lib/doorkeeper/oauth/token_response.rb +1 -1
- data/lib/doorkeeper/orm/active_record/access_grant.rb +2 -2
- data/lib/doorkeeper/orm/active_record/access_token.rb +10 -2
- data/lib/doorkeeper/orm/active_record/application.rb +4 -9
- data/lib/doorkeeper/orm/active_record.rb +0 -15
- data/lib/doorkeeper/rails/helpers.rb +13 -3
- data/lib/doorkeeper/rails/routes/mapper.rb +1 -1
- data/lib/doorkeeper/rails/routes.rb +2 -1
- data/lib/doorkeeper/request/authorization_code.rb +10 -15
- data/lib/doorkeeper/request/client_credentials.rb +9 -15
- data/lib/doorkeeper/request/code.rb +7 -13
- data/lib/doorkeeper/request/password.rb +18 -13
- data/lib/doorkeeper/request/refresh_token.rb +11 -13
- data/lib/doorkeeper/request/strategy.rb +17 -0
- data/lib/doorkeeper/request/token.rb +7 -13
- data/lib/doorkeeper/request.rb +18 -8
- data/lib/doorkeeper/server.rb +2 -2
- data/lib/doorkeeper/version.rb +1 -1
- data/lib/doorkeeper.rb +1 -1
- data/lib/generators/doorkeeper/previous_refresh_token_generator.rb +29 -0
- data/lib/generators/doorkeeper/templates/add_owner_to_application_migration.rb +1 -1
- data/lib/generators/doorkeeper/templates/add_previous_refresh_token_to_access_tokens.rb +11 -0
- data/lib/generators/doorkeeper/templates/initializer.rb +2 -2
- data/lib/generators/doorkeeper/templates/migration.rb +23 -5
- data/spec/controllers/authorizations_controller_spec.rb +0 -14
- data/spec/controllers/protected_resources_controller_spec.rb +138 -15
- data/spec/controllers/tokens_controller_spec.rb +30 -0
- data/spec/dummy/app/controllers/full_protected_resources_controller.rb +4 -4
- data/spec/dummy/app/controllers/home_controller.rb +1 -1
- data/spec/dummy/app/controllers/metal_controller.rb +1 -1
- data/spec/dummy/app/controllers/semi_protected_resources_controller.rb +3 -3
- data/spec/dummy/app/models/user.rb +0 -4
- data/spec/dummy/config/application.rb +2 -36
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/test.rb +4 -15
- data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
- data/spec/dummy/config/initializers/doorkeeper.rb +2 -2
- data/spec/dummy/db/migrate/{20130902165751_create_doorkeeper_tables.rb → 20151223192035_create_doorkeeper_tables.rb} +24 -5
- data/spec/dummy/db/migrate/20160320211015_add_previous_refresh_token_to_access_tokens.rb +11 -0
- data/spec/dummy/db/schema.rb +23 -22
- data/spec/lib/config_spec.rb +2 -2
- data/spec/lib/models/revocable_spec.rb +27 -4
- data/spec/lib/oauth/authorization_code_request_spec.rb +1 -1
- data/spec/lib/oauth/client_credentials/creator_spec.rb +25 -1
- data/spec/lib/oauth/code_response_spec.rb +34 -0
- data/spec/lib/oauth/error_response_spec.rb +7 -7
- data/spec/lib/oauth/error_spec.rb +9 -5
- data/spec/lib/oauth/password_access_token_request_spec.rb +5 -5
- data/spec/lib/oauth/refresh_token_request_spec.rb +34 -3
- data/spec/lib/oauth/scopes_spec.rb +1 -2
- data/spec/lib/oauth/token_spec.rb +12 -5
- data/spec/lib/request/strategy_spec.rb +53 -0
- data/spec/lib/server_spec.rb +1 -1
- data/spec/models/doorkeeper/access_grant_spec.rb +5 -5
- data/spec/models/doorkeeper/access_token_spec.rb +49 -5
- data/spec/models/doorkeeper/application_spec.rb +2 -10
- data/spec/requests/flows/authorization_code_spec.rb +26 -0
- data/spec/requests/flows/password_spec.rb +26 -5
- data/spec/requests/flows/refresh_token_spec.rb +95 -17
- data/spec/spec_helper_integration.rb +10 -0
- data/spec/support/helpers/model_helper.rb +27 -5
- data/spec/support/http_method_shim.rb +24 -0
- data/spec/support/shared/controllers_shared_context.rb +13 -4
- data/spec/support/shared/models_shared_examples.rb +1 -1
- metadata +46 -38
- data/lib/generators/doorkeeper/application_scopes_generator.rb +0 -34
- data/lib/generators/doorkeeper/templates/add_scopes_to_oauth_applications.rb +0 -5
- data/spec/dummy/db/migrate/20141209001746_add_scopes_to_oauth_applications.rb +0 -5
- /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
|
-
|
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
|
-
|
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',
|
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(
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
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)
|
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(
|
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(
|
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
|
-
|
84
|
-
|
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
|
-
|
87
|
-
|
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
|
-
|
17
|
-
grant.
|
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
|
-
|
22
|
-
|
23
|
-
|
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,
|
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(
|
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,
|
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(
|
32
|
+
allow(
|
33
|
+
Doorkeeper::AccessToken
|
34
|
+
).to receive(:by_token).with(token_string).and_return(token)
|
26
35
|
end
|
27
36
|
end
|
28
37
|
|
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:
|
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:
|
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: '
|
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: '
|
27
|
+
version: '4.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: capybara
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- - "
|
32
|
+
- - ">="
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
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:
|
41
|
+
version: '0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
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.
|
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.
|
55
|
+
version: 1.3.0
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
57
|
+
name: factory_girl
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
60
|
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
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:
|
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:
|
85
|
+
name: rake
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - ">"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version:
|
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:
|
97
|
+
version: 10.5.0
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
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
|
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
|
111
|
+
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
113
|
+
name: timecop
|
114
114
|
requirement: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - "~>"
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
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:
|
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/
|
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/
|
275
|
-
- spec/dummy/db/migrate/
|
276
|
-
- spec/dummy/db/migrate/
|
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.
|
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/
|
415
|
-
- spec/dummy/db/migrate/
|
416
|
-
- spec/dummy/db/migrate/
|
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
|