doorkeeper 2.1.4 → 2.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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -430
  3. data/Gemfile +1 -8
  4. data/NEWS.md +449 -0
  5. data/README.md +46 -3
  6. data/doorkeeper.gemspec +1 -1
  7. data/gemfiles/Gemfile.common.rb +0 -7
  8. data/gemfiles/Gemfile.mongo_mapper.rb +2 -2
  9. data/gemfiles/Gemfile.mongoid2.rb +1 -1
  10. data/gemfiles/Gemfile.mongoid4.rb +0 -1
  11. data/lib/doorkeeper/config.rb +7 -0
  12. data/lib/doorkeeper/engine.rb +4 -0
  13. data/lib/doorkeeper/errors.rb +6 -0
  14. data/lib/doorkeeper/models/access_token_mixin.rb +6 -1
  15. data/lib/doorkeeper/rails/helpers.rb +1 -1
  16. data/lib/doorkeeper/version.rb +1 -1
  17. data/lib/generators/doorkeeper/templates/initializer.rb +4 -0
  18. data/spec/controllers/applications_controller_spec.rb +0 -1
  19. data/spec/controllers/token_info_controller_spec.rb +0 -4
  20. data/spec/controllers/tokens_controller_spec.rb +4 -3
  21. data/spec/dummy/config/application.rb +2 -0
  22. data/spec/lib/config_spec.rb +18 -2
  23. data/spec/lib/oauth/authorization_code_request_spec.rb +1 -1
  24. data/spec/lib/oauth/client/credentials_spec.rb +2 -2
  25. data/spec/lib/oauth/password_access_token_request_spec.rb +1 -1
  26. data/spec/lib/oauth/pre_authorization_spec.rb +9 -10
  27. data/spec/lib/oauth/refresh_token_request_spec.rb +0 -1
  28. data/spec/lib/oauth/token_request_spec.rb +3 -3
  29. data/spec/lib/server_spec.rb +3 -1
  30. data/spec/models/doorkeeper/access_token_spec.rb +48 -0
  31. data/spec/requests/applications/applications_request_spec.rb +1 -1
  32. data/spec/requests/endpoints/authorization_spec.rb +2 -1
  33. data/spec/requests/endpoints/token_spec.rb +9 -9
  34. data/spec/requests/flows/authorization_code_errors_spec.rb +4 -4
  35. data/spec/requests/flows/authorization_code_spec.rb +10 -2
  36. data/spec/requests/flows/implicit_grant_spec.rb +14 -5
  37. data/spec/requests/flows/password_spec.rb +14 -20
  38. data/spec/requests/flows/refresh_token_spec.rb +7 -7
  39. data/spec/requests/flows/revoke_token_spec.rb +9 -31
  40. data/spec/requests/protected_resources/metal_spec.rb +3 -3
  41. data/spec/requests/protected_resources/private_api_spec.rb +11 -0
  42. data/spec/routing/custom_controller_routes_spec.rb +1 -2
  43. data/spec/routing/default_routes_spec.rb +1 -2
  44. data/spec/routing/scoped_routes_spec.rb +0 -1
  45. data/spec/spec_helper_integration.rb +3 -1
  46. data/spec/support/helpers/access_token_request_helper.rb +1 -1
  47. data/spec/support/helpers/authorization_request_helper.rb +1 -1
  48. data/spec/support/helpers/config_helper.rb +1 -1
  49. data/spec/support/helpers/model_helper.rb +1 -1
  50. data/spec/support/helpers/request_spec_helper.rb +1 -1
  51. data/spec/support/helpers/url_helper.rb +1 -1
  52. metadata +5 -4
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper_integration'
2
2
 
3
- feature 'ActionController::Metal API' do
4
- background do
3
+ describe 'ActionController::Metal API' do
4
+ before do
5
5
  @client = FactoryGirl.create(:application)
6
6
  @resource = User.create!(name: 'Joe', password: 'sekret')
7
7
  @token = client_is_authorized(@client, @resource)
8
8
  end
9
9
 
10
- scenario 'client requests protected resource with valid token' do
10
+ it 'client requests protected resource with valid token' do
11
11
  get "/metal.json?access_token=#{@token.token}"
12
12
  should_have_json 'ok', true
13
13
  end
@@ -40,6 +40,17 @@ feature 'Private API' do
40
40
  expect(page.body).to have_content('index')
41
41
  end
42
42
 
43
+ scenario 'access token with no default scopes' do
44
+ Doorkeeper.configuration.instance_eval {
45
+ @default_scopes = Doorkeeper::OAuth::Scopes.from_array([:public])
46
+ @scopes = default_scopes + optional_scopes
47
+ }
48
+ @token.update_attribute :scopes, 'dummy'
49
+ with_access_token_header @token.token
50
+ visit '/full_protected_resources'
51
+ response_status_should_be 403
52
+ end
53
+
43
54
  scenario 'access token with no allowed scopes' do
44
55
  @token.update_attribute :scopes, nil
45
56
  with_access_token_header @token.token
@@ -42,7 +42,7 @@ describe 'Custom controller for routes' do
42
42
  end
43
43
 
44
44
  it 'POST /space/oauth/revoke routes to tokens controller' do
45
- post('/space/oauth/revoke').should route_to('custom_authorizations#revoke')
45
+ expect(post('/space/oauth/revoke')).to route_to('custom_authorizations#revoke')
46
46
  end
47
47
 
48
48
  it 'GET /space/oauth/applications routes to applications controller' do
@@ -68,5 +68,4 @@ describe 'Custom controller for routes' do
68
68
  it 'GET /outer_space/oauth/token_info is not routable' do
69
69
  expect(get('/outer_space/oauth/token/info')).not_to be_routable
70
70
  end
71
-
72
71
  end
@@ -18,7 +18,7 @@ describe 'Default routes' do
18
18
  end
19
19
 
20
20
  it 'POST /oauth/revoke routes to tokens controller' do
21
- post('/oauth/revoke').should route_to('doorkeeper/tokens#revoke')
21
+ expect(post('/oauth/revoke')).to route_to('doorkeeper/tokens#revoke')
22
22
  end
23
23
 
24
24
  it 'GET /oauth/applications routes to applications controller' do
@@ -32,5 +32,4 @@ describe 'Default routes' do
32
32
  it 'GET /oauth/token/info route to authorzed tokeninfo controller' do
33
33
  expect(get('/oauth/token/info')).to route_to('doorkeeper/token_info#show')
34
34
  end
35
-
36
35
  end
@@ -28,5 +28,4 @@ describe 'Scoped routes' do
28
28
  it 'GET /scope/token/info route to authorzed tokeninfo controller' do
29
29
  expect(get('/scope/token/info')).to route_to('doorkeeper/token_info#show')
30
30
  end
31
-
32
31
  end
@@ -11,10 +11,10 @@ require 'capybara/rspec'
11
11
  require 'rspec/active_model/mocks'
12
12
  require 'dummy/config/environment'
13
13
  require 'rspec/rails'
14
- require 'rspec/autorun'
15
14
  require 'generator_spec/test_case'
16
15
  require 'timecop'
17
16
  require 'database_cleaner'
17
+ require 'pry'
18
18
 
19
19
  Rails.logger.info "====> Doorkeeper.orm = #{Doorkeeper.configuration.orm.inspect}"
20
20
  if Doorkeeper.configuration.orm == :active_record
@@ -40,6 +40,8 @@ RSpec.configure do |config|
40
40
 
41
41
  config.infer_base_class_for_anonymous_controllers = false
42
42
 
43
+ config.include RSpec::Rails::RequestExampleGroup, type: :request
44
+
43
45
  config.before do
44
46
  DatabaseCleaner.start
45
47
  Doorkeeper.configure { orm DOORKEEPER_ORM }
@@ -8,4 +8,4 @@ module AccessTokenRequestHelper
8
8
  end
9
9
  end
10
10
 
11
- RSpec.configuration.send :include, AccessTokenRequestHelper, type: :request
11
+ RSpec.configuration.send :include, AccessTokenRequestHelper
@@ -38,4 +38,4 @@ module AuthorizationRequestHelper
38
38
  end
39
39
  end
40
40
 
41
- RSpec.configuration.send :include, AuthorizationRequestHelper, type: :request
41
+ RSpec.configuration.send :include, AuthorizationRequestHelper
@@ -6,4 +6,4 @@ module ConfigHelper
6
6
  end
7
7
  end
8
8
 
9
- RSpec.configuration.send :include, ConfigHelper, type: :request
9
+ RSpec.configuration.send :include, ConfigHelper
@@ -42,4 +42,4 @@ module ModelHelper
42
42
  end
43
43
  end
44
44
 
45
- RSpec.configuration.send :include, ModelHelper, type: :request
45
+ RSpec.configuration.send :include, ModelHelper
@@ -73,4 +73,4 @@ module RequestSpecHelper
73
73
  end
74
74
  end
75
75
 
76
- RSpec.configuration.send :include, RequestSpecHelper, type: :request
76
+ RSpec.configuration.send :include, RequestSpecHelper
@@ -52,4 +52,4 @@ module UrlHelper
52
52
  end
53
53
  end
54
54
 
55
- RSpec.configuration.send :include, UrlHelper, type: :request
55
+ RSpec.configuration.send :include, UrlHelper
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: 2.1.4
4
+ version: 2.2.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-03-27 00:00:00.000000000 Z
12
+ date: 2015-04-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -45,14 +45,14 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: 2.99.0
48
+ version: 3.1.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: 2.99.0
55
+ version: 3.1.0
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: capybara
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -180,6 +180,7 @@ files:
180
180
  - CONTRIBUTING.md
181
181
  - Gemfile
182
182
  - MIT-LICENSE
183
+ - NEWS.md
183
184
  - README.md
184
185
  - RELEASING.md
185
186
  - Rakefile