scimitar 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7723c0e58ed5580a8e1940d49cda020543ea5a3d1412b2c217a9ad614aeec309
4
- data.tar.gz: d920fd2f994fb85a830f615fad2a58057a2de29d284cbc8139565150c336ff69
3
+ metadata.gz: 8a60a7aa88fe30a83bdf337787203b276a39e456c9818653fd30cdc256102318
4
+ data.tar.gz: 3d092d6ff249121c2414686f215c6530f0e4fc24addf921953f6d6010ead6d13
5
5
  SHA512:
6
- metadata.gz: 5c495cc86a7a53baa21297d6d7e3945a8b9d0ce0e57b1d035e2fe972c9c4434f07f47358fd95003c4d59bb4252fd27b7cfee20fec9ed3ee6cd8b087dcf5a2532
7
- data.tar.gz: '09048b4b209857aeeb55cf64306a95c3968e24d8bea88c7d245cfaa38b745c2170f8ee29b236168099b3afc546320be3e911f8871b042b8920dda371a00ef431'
6
+ metadata.gz: 85ad5d6b4b1613eab67380772389e5789478d64adcca7116a054c71c879c0ada502312982027cbf3dbfa2c833aec5cfd12eae3d4946fd30289678909b2e2d87b
7
+ data.tar.gz: dfd9259e908867af51bd751d559cc9a323861dad2b5313e295e92d7b527356fee39c6accaca3c26d88bed4fca006e98f01bc7954ae91ab8626316270c3c8c507
@@ -82,12 +82,17 @@ module Scimitar
82
82
  # request and subclass processing.
83
83
  #
84
84
  def require_scim
85
- if request.content_type&.downcase == Mime::Type.lookup_by_extension(:scim).to_s
85
+ scim_mime_type = Mime::Type.lookup_by_extension(:scim).to_s
86
+
87
+ if request.content_type.nil?
88
+ request.format = :scim
89
+ request.headers['CONTENT_TYPE'] = scim_mime_type
90
+ elsif request.content_type&.downcase == scim_mime_type
86
91
  request.format = :scim
87
92
  elsif request.format == :scim
88
- request.headers['CONTENT_TYPE'] = Mime::Type.lookup_by_extension(:scim).to_s
93
+ request.headers['CONTENT_TYPE'] = scim_mime_type
89
94
  else
90
- handle_scim_error(ErrorResponse.new(status: 406, detail: "Only #{Mime::Type.lookup_by_extension(:scim)} type is accepted."))
95
+ handle_scim_error(ErrorResponse.new(status: 406, detail: "Only #{scim_mime_type} type is accepted."))
91
96
  end
92
97
  end
93
98
 
@@ -3,11 +3,11 @@ module Scimitar
3
3
  # Gem version. If this changes, be sure to re-run "bundle install" or
4
4
  # "bundle update".
5
5
  #
6
- VERSION = '2.0.1'
6
+ VERSION = '2.0.2'
7
7
 
8
8
  # Date for VERSION. If this changes, be sure to re-run "bundle install"
9
9
  # or "bundle update".
10
10
  #
11
- DATE = '2022-04-20'
11
+ DATE = '2022-06-15'
12
12
 
13
13
  end
@@ -11,11 +11,14 @@ RSpec.describe Scimitar::ApplicationController do
11
11
  end
12
12
 
13
13
  context 'format handling' do
14
- it 'renders "not acceptable" if the request does not use SCIM type' do
14
+ it 'renders "OK" if the request does not provide any Content-Type value' do
15
15
  get '/CustomRequestVerifiers', params: { format: :html }
16
16
 
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.')
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
19
22
  end
20
23
 
21
24
  it 'renders 400 if given bad JSON' do
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: 2.0.1
4
+ version: 2.0.2
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: 2022-04-20 00:00:00.000000000 Z
12
+ date: 2022-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -45,28 +45,28 @@ dependencies:
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.2'
48
+ version: '1.3'
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: '1.2'
55
+ version: '1.3'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: simplecov-rcov
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '0.2'
62
+ version: '0.3'
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: '0.2'
69
+ version: '0.3'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rdoc
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -87,14 +87,14 @@ dependencies:
87
87
  requirements:
88
88
  - - "~>"
89
89
  - !ruby/object:Gem::Version
90
- version: '5.0'
90
+ version: '5.1'
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: '5.0'
97
+ version: '5.1'
98
98
  - !ruby/object:Gem::Dependency
99
99
  name: byebug
100
100
  requirement: !ruby/object:Gem::Requirement