scimitar 2.4.1 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7db2b533d9bc2fe1e359a12ad51fea89bdd5498589451b16b99987ca0cd99f09
4
- data.tar.gz: 7b30102df8ee36d8bac2698ef150a3537c7b40f6193a64e3baed7e8d6c8386d4
3
+ metadata.gz: 243c45d533641c64634fc4c1aac05455c27e92aff2169ed313ba07aacc803bb2
4
+ data.tar.gz: b9930256cc4681b7025e2c1a6791588ae4a5cef7f574e6ed311f1cf0cdae6791
5
5
  SHA512:
6
- metadata.gz: 238c6bdebc57c0d8c186ad77d8222a79c7f9fad98b86a1d564c2c27d62a58dd809c1a4b2a7a9c57af535728f6a23d36821c12e74be81e8191d96960cdd1d1db9
7
- data.tar.gz: 684c778f5e3d03719b3df872ca8efcb29a18cd802360964282e38ed914b095676aeec4556a625c99f2a3de86f898cae1dd989be67614711194fd176a1c5895c1
6
+ metadata.gz: bffee2a6076dac93761cbd10e6f72d2fddd6f1504c6d305869d260df964175ae960a900bbb19d081f88962235885cd47953f04348f749860d028ccdcfe67e74c
7
+ data.tar.gz: 3f85427568803c6e5f4ebf00bf5759acf85be72b8e38eb26010e93a54afd48879f7dd106e11683c05ddcdb9d89411d674a55ca581be8a91dca6a7c882629a937
@@ -98,10 +98,10 @@ module Scimitar
98
98
  def require_scim
99
99
  scim_mime_type = Mime::Type.lookup_by_extension(:scim).to_s
100
100
 
101
- if request.content_type.nil?
101
+ if request.media_type.nil? || request.media_type.empty?
102
102
  request.format = :scim
103
103
  request.headers['CONTENT_TYPE'] = scim_mime_type
104
- elsif request.content_type&.downcase == scim_mime_type
104
+ elsif request.media_type.downcase == scim_mime_type
105
105
  request.format = :scim
106
106
  elsif request.format == :scim
107
107
  request.headers['CONTENT_TYPE'] = scim_mime_type
@@ -7,13 +7,17 @@ module Scimitar
7
7
  class EngineConfiguration
8
8
  include ActiveModel::Model
9
9
 
10
- attr_accessor :basic_authenticator,
11
- :token_authenticator,
12
- :application_controller_mixin,
13
- :exception_reporter,
14
- :optional_value_fields_required
10
+ attr_accessor(
11
+ :uses_defaults,
12
+ :basic_authenticator,
13
+ :token_authenticator,
14
+ :application_controller_mixin,
15
+ :exception_reporter,
16
+ :optional_value_fields_required,
17
+ )
15
18
 
16
19
  def initialize(attributes = {})
20
+ @uses_defaults = attributes.empty?
17
21
 
18
22
  # Set defaults that may be overridden by the initializer.
19
23
  #
@@ -9,11 +9,22 @@ module Scimitar
9
9
  class ServiceProviderConfiguration
10
10
  include ActiveModel::Model
11
11
 
12
- attr_accessor :patch, :bulk, :filter, :changePassword,
13
- :sort, :etag, :authenticationSchemes,
14
- :schemas, :meta
12
+ attr_accessor(
13
+ :uses_defaults,
14
+ :patch,
15
+ :bulk,
16
+ :filter,
17
+ :changePassword,
18
+ :sort,
19
+ :etag,
20
+ :authenticationSchemes,
21
+ :schemas,
22
+ :meta,
23
+ )
15
24
 
16
25
  def initialize(attributes = {})
26
+ @uses_defaults = attributes.empty?
27
+
17
28
  defaults = {
18
29
  bulk: Supportable.unsupported,
19
30
  changePassword: Supportable.unsupported,
@@ -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.4.1'
6
+ VERSION = '2.4.3'
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 = '2023-03-02'
11
+ DATE = '2023-09-16'
12
12
 
13
13
  end
data/lib/scimitar.rb CHANGED
@@ -4,7 +4,9 @@ require 'scimitar/engine'
4
4
 
5
5
  module Scimitar
6
6
  def self.service_provider_configuration=(custom_configuration)
7
- @service_provider_configuration = custom_configuration
7
+ if @service_provider_configuration.nil? || ! custom_configuration.uses_defaults
8
+ @service_provider_configuration = custom_configuration
9
+ end
8
10
  end
9
11
 
10
12
  def self.service_provider_configuration(location:)
@@ -14,7 +16,9 @@ module Scimitar
14
16
  end
15
17
 
16
18
  def self.engine_configuration=(custom_configuration)
17
- @engine_configuration = custom_configuration
19
+ if @engine_configuration.nil? || ! custom_configuration.uses_defaults
20
+ @engine_configuration = custom_configuration
21
+ end
18
22
  end
19
23
 
20
24
  def self.engine_configuration
@@ -38,6 +38,16 @@ RSpec.describe Scimitar::ApplicationController do
38
38
  expect(parsed_body['request']['content_type']).to eql('application/scim+json')
39
39
  end
40
40
 
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
+
41
51
  it 'translates Rails request format to header' do
42
52
  get '/CustomRequestVerifiers', params: { format: :scim }
43
53
 
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.4.1
4
+ version: 2.4.3
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-03-02 00:00:00.000000000 Z
12
+ date: 2023-09-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails