scimitar 1.7.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scimitar/active_record_backed_resources_controller.rb +10 -49
  3. data/app/controllers/scimitar/application_controller.rb +11 -35
  4. data/app/controllers/scimitar/schemas_controller.rb +0 -5
  5. data/app/models/scimitar/engine_configuration.rb +5 -13
  6. data/app/models/scimitar/error_response.rb +0 -12
  7. data/app/models/scimitar/lists/query_parser.rb +10 -25
  8. data/app/models/scimitar/resources/base.rb +4 -14
  9. data/app/models/scimitar/resources/mixin.rb +13 -137
  10. data/app/models/scimitar/schema/address.rb +0 -1
  11. data/app/models/scimitar/schema/attribute.rb +5 -14
  12. data/app/models/scimitar/schema/base.rb +1 -1
  13. data/app/models/scimitar/schema/vdtp.rb +1 -1
  14. data/app/models/scimitar/service_provider_configuration.rb +3 -14
  15. data/config/initializers/scimitar.rb +3 -28
  16. data/lib/scimitar/version.rb +2 -2
  17. data/lib/scimitar.rb +2 -6
  18. data/spec/apps/dummy/app/controllers/mock_groups_controller.rb +1 -1
  19. data/spec/apps/dummy/app/models/mock_group.rb +1 -1
  20. data/spec/apps/dummy/app/models/mock_user.rb +8 -36
  21. data/spec/apps/dummy/config/application.rb +1 -0
  22. data/spec/apps/dummy/config/environments/test.rb +28 -5
  23. data/spec/apps/dummy/config/initializers/scimitar.rb +10 -61
  24. data/spec/apps/dummy/config/routes.rb +6 -15
  25. data/spec/apps/dummy/db/migrate/20210304014602_create_mock_users.rb +1 -10
  26. data/spec/apps/dummy/db/migrate/20210308044214_create_join_table_mock_groups_mock_users.rb +3 -8
  27. data/spec/apps/dummy/db/schema.rb +4 -11
  28. data/spec/controllers/scimitar/application_controller_spec.rb +3 -72
  29. data/spec/controllers/scimitar/resource_types_controller_spec.rb +2 -2
  30. data/spec/controllers/scimitar/schemas_controller_spec.rb +2 -10
  31. data/spec/models/scimitar/complex_types/email_spec.rb +2 -0
  32. data/spec/models/scimitar/lists/query_parser_spec.rb +9 -76
  33. data/spec/models/scimitar/resources/base_spec.rb +70 -208
  34. data/spec/models/scimitar/resources/base_validation_spec.rb +2 -27
  35. data/spec/models/scimitar/resources/mixin_spec.rb +43 -768
  36. data/spec/models/scimitar/schema/attribute_spec.rb +3 -22
  37. data/spec/models/scimitar/schema/base_spec.rb +1 -1
  38. data/spec/models/scimitar/schema/user_spec.rb +0 -10
  39. data/spec/requests/active_record_backed_resources_controller_spec.rb +64 -423
  40. data/spec/requests/application_controller_spec.rb +3 -16
  41. metadata +7 -11
  42. data/LICENSE.txt +0 -21
  43. data/README.md +0 -671
  44. data/spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb +0 -24
@@ -11,14 +11,11 @@ RSpec.describe Scimitar::ApplicationController do
11
11
  end
12
12
 
13
13
  context 'format handling' do
14
- it 'renders "OK" if the request does not provide any Content-Type value' do
14
+ it 'renders "not acceptable" if the request does not use SCIM type' do
15
15
  get '/CustomRequestVerifiers', params: { format: :html }
16
16
 
17
- expect(response).to have_http_status(:ok)
18
- parsed_body = JSON.parse(response.body)
19
- expect(parsed_body['request']['is_scim' ]).to eql(true)
20
- expect(parsed_body['request']['format' ]).to eql('application/scim+json')
21
- expect(parsed_body['request']['content_type']).to eql('application/scim+json') # Filled in by ApplicationController#require_scim
17
+ expect(response).to have_http_status(:not_acceptable)
18
+ expect(JSON.parse(response.body)['detail']).to eql('Only application/scim+json type is accepted.')
22
19
  end
23
20
 
24
21
  it 'renders 400 if given bad JSON' do
@@ -38,16 +35,6 @@ RSpec.describe Scimitar::ApplicationController do
38
35
  expect(parsed_body['request']['content_type']).to eql('application/scim+json')
39
36
  end
40
37
 
41
- it 'translates Content-Type with charset to Rails request format' do
42
- get '/CustomRequestVerifiers', headers: { 'CONTENT_TYPE' => 'application/scim+json; charset=utf-8' }
43
-
44
- expect(response).to have_http_status(:ok)
45
- parsed_body = JSON.parse(response.body)
46
- expect(parsed_body['request']['is_scim' ]).to eql(true)
47
- expect(parsed_body['request']['format' ]).to eql('application/scim+json')
48
- expect(parsed_body['request']['content_type']).to eql('application/scim+json; charset=utf-8')
49
- end
50
-
51
38
  it 'translates Rails request format to header' do
52
39
  get '/CustomRequestVerifiers', params: { format: :scim }
53
40
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scimitar
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - RIPA Global
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-11-15 00:00:00.000000000 Z
12
+ date: 2022-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '6.0'
20
+ version: '7.0'
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: '6.0'
27
+ version: '7.0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -73,14 +73,14 @@ dependencies:
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '6.3'
76
+ version: '6.4'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '6.3'
83
+ version: '6.4'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: rspec-rails
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -130,8 +130,6 @@ executables: []
130
130
  extensions: []
131
131
  extra_rdoc_files: []
132
132
  files:
133
- - LICENSE.txt
134
- - README.md
135
133
  - Rakefile
136
134
  - app/controllers/scimitar/active_record_backed_resources_controller.rb
137
135
  - app/controllers/scimitar/application_controller.rb
@@ -198,7 +196,6 @@ files:
198
196
  - lib/scimitar/version.rb
199
197
  - spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb
200
198
  - spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb
201
- - spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb
202
199
  - spec/apps/dummy/app/controllers/mock_groups_controller.rb
203
200
  - spec/apps/dummy/app/controllers/mock_users_controller.rb
204
201
  - spec/apps/dummy/app/models/mock_group.rb
@@ -263,14 +260,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
263
260
  - !ruby/object:Gem::Version
264
261
  version: '0'
265
262
  requirements: []
266
- rubygems_version: 3.4.10
263
+ rubygems_version: 3.3.3
267
264
  signing_key:
268
265
  specification_version: 4
269
266
  summary: SCIM v2 for Rails
270
267
  test_files:
271
268
  - spec/apps/dummy/app/controllers/custom_destroy_mock_users_controller.rb
272
269
  - spec/apps/dummy/app/controllers/custom_request_verifiers_controller.rb
273
- - spec/apps/dummy/app/controllers/custom_save_mock_users_controller.rb
274
270
  - spec/apps/dummy/app/controllers/mock_groups_controller.rb
275
271
  - spec/apps/dummy/app/controllers/mock_users_controller.rb
276
272
  - spec/apps/dummy/app/models/mock_group.rb
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2021 RIPA Global
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.