scim-kit 0.1.0 → 0.2.0
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 +4 -4
- data/lib/scim/kit.rb +5 -0
- data/lib/scim/kit/dynamic_attributes.rb +18 -0
- data/lib/scim/kit/templatable.rb +1 -1
- data/lib/scim/kit/v2/authentication_scheme.rb +49 -0
- data/lib/scim/kit/v2/meta.rb +22 -0
- data/lib/scim/kit/v2/resource_type.rb +3 -2
- data/lib/scim/kit/v2/schema.rb +6 -3
- data/lib/scim/kit/v2/service_provider_configuration.rb +34 -0
- data/lib/scim/kit/v2/supportable.rb +22 -0
- data/lib/scim/kit/v2/templates/authentication_scheme.json.jbuilder +9 -0
- data/lib/scim/kit/v2/templates/meta.json.jbuilder +8 -0
- data/lib/scim/kit/v2/templates/nil_class.json.jbuilder +0 -0
- data/lib/scim/kit/v2/templates/resource_type.json.jbuilder +1 -2
- data/lib/scim/kit/v2/templates/service_provider_configuration.json.jbuilder +29 -0
- data/lib/scim/kit/v2/templates/supportable.json.jbuilder +7 -0
- data/lib/scim/kit/version.rb +1 -1
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c615da7460744208a93f82d9731fcb99fd00dd9f6b9e841d54b96394e0b24d49
|
4
|
+
data.tar.gz: ea7cb0fb6aa0b69e781728c5677e9fdf119553ef1b7c2828187d62a56ca500db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ef6cb2e6c3b791b837c4cb6158bf9e1b80d074acc40a75d4ea4b194b93a0b6101c827b1a9f5376ed98395fdf0bd690c2692f83177d0d1ed0af36da748eb84bd
|
7
|
+
data.tar.gz: 67a78548780b91ca3d671fcbbbf52eb99c320b04b51255e202b15a97a5ee19ee83eec3b5b023df4ad269f787dd6ad3e42f1cddda367408f2069638d3ebfbae57
|
data/lib/scim/kit.rb
CHANGED
@@ -3,15 +3,20 @@
|
|
3
3
|
require 'tilt'
|
4
4
|
require 'tilt/jbuilder'
|
5
5
|
|
6
|
+
require 'scim/kit/dynamic_attributes'
|
6
7
|
require 'scim/kit/templatable'
|
7
8
|
require 'scim/kit/template'
|
8
9
|
require 'scim/kit/version'
|
9
10
|
|
10
11
|
require 'scim/kit/v2/attribute_type'
|
12
|
+
require 'scim/kit/v2/authentication_scheme'
|
13
|
+
require 'scim/kit/v2/meta'
|
11
14
|
require 'scim/kit/v2/mutability'
|
12
15
|
require 'scim/kit/v2/resource_type'
|
13
16
|
require 'scim/kit/v2/returned'
|
14
17
|
require 'scim/kit/v2/schema'
|
18
|
+
require 'scim/kit/v2/service_provider_configuration'
|
19
|
+
require 'scim/kit/v2/supportable'
|
15
20
|
require 'scim/kit/v2/uniqueness'
|
16
21
|
|
17
22
|
module Scim
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
# Allows dynamic assignment of attributes.
|
6
|
+
module DynamicAttributes
|
7
|
+
def method_missing(method, *args)
|
8
|
+
return super unless respond_to_missing?(method)
|
9
|
+
|
10
|
+
@dynamic_attributes[method] = args[0]
|
11
|
+
end
|
12
|
+
|
13
|
+
def respond_to_missing?(method, _include_private = false)
|
14
|
+
@dynamic_attributes.key?(method) || super
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/scim/kit/templatable.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents the available Authentication Schemes.
|
7
|
+
class AuthenticationScheme
|
8
|
+
DEFAULTS = {
|
9
|
+
httpbasic: {
|
10
|
+
description: 'Authentication scheme using the HTTP Basic Standard',
|
11
|
+
documentation_uri: 'http://example.com/help/httpBasic.html',
|
12
|
+
name: 'HTTP Basic',
|
13
|
+
spec_uri: 'http://www.rfc-editor.org/info/rfc2617'
|
14
|
+
},
|
15
|
+
oauthbearertoken: {
|
16
|
+
description:
|
17
|
+
'Authentication scheme using the OAuth Bearer Token Standard',
|
18
|
+
documentation_uri: 'http://example.com/help/oauth.html',
|
19
|
+
name: 'OAuth Bearer Token',
|
20
|
+
spec_uri: 'http://www.rfc-editor.org/info/rfc6750'
|
21
|
+
}
|
22
|
+
}.freeze
|
23
|
+
include Templatable
|
24
|
+
attr_accessor :name
|
25
|
+
attr_accessor :description
|
26
|
+
attr_accessor :documentation_uri
|
27
|
+
attr_accessor :spec_uri
|
28
|
+
attr_accessor :type
|
29
|
+
attr_accessor :primary
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
yield self if block_given?
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.build_for(type, primary: nil)
|
36
|
+
defaults = DEFAULTS[type.to_sym] || {}
|
37
|
+
new do |x|
|
38
|
+
x.type = type
|
39
|
+
x.primary = primary
|
40
|
+
x.description = defaults[:description]
|
41
|
+
x.documentation_uri = defaults[:documentation_uri]
|
42
|
+
x.name = defaults[:name]
|
43
|
+
x.spec_uri = defaults[:spec_uri]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents a meta section
|
7
|
+
class Meta
|
8
|
+
include Templatable
|
9
|
+
|
10
|
+
attr_accessor :created, :last_modified, :version
|
11
|
+
attr_reader :location
|
12
|
+
attr_reader :resource_type
|
13
|
+
|
14
|
+
def initialize(resource_type, location)
|
15
|
+
@resource_type = resource_type
|
16
|
+
@location = location
|
17
|
+
@version = @created = @last_modified = Time.now
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -12,10 +12,11 @@ module Scim
|
|
12
12
|
attr_accessor :description
|
13
13
|
attr_accessor :endpoint
|
14
14
|
attr_accessor :schema
|
15
|
-
attr_reader :
|
15
|
+
attr_reader :meta
|
16
16
|
|
17
17
|
def initialize(location:)
|
18
|
-
@
|
18
|
+
@meta = Meta.new('ResourceType', location)
|
19
|
+
@meta.version = @meta.created = @meta.last_modified = nil
|
19
20
|
end
|
20
21
|
|
21
22
|
def self.build(*args)
|
data/lib/scim/kit/v2/schema.rb
CHANGED
@@ -6,10 +6,13 @@ module Scim
|
|
6
6
|
# Represents a SCIM Schema
|
7
7
|
class Schema
|
8
8
|
include Templatable
|
9
|
+
|
10
|
+
CORE = 'urn:ietf:params:scim:schemas:core:2.0'
|
9
11
|
ERROR = 'urn:ietf:params:scim:api:messages:2.0:Error'
|
10
|
-
GROUP =
|
11
|
-
RESOURCE_TYPE =
|
12
|
-
|
12
|
+
GROUP = "#{CORE}:Group"
|
13
|
+
RESOURCE_TYPE = "#{CORE}:ResourceType"
|
14
|
+
SERVICE_PROVIDER_CONFIGURATION = "#{CORE}:ServiceProviderConfig"
|
15
|
+
USER = "#{CORE}:User"
|
13
16
|
|
14
17
|
attr_reader :id, :name, :location, :attributes
|
15
18
|
attr_accessor :description
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents a scim Service Provider Configuration
|
7
|
+
class ServiceProviderConfiguration
|
8
|
+
include Templatable
|
9
|
+
attr_reader :location
|
10
|
+
attr_accessor :documentation_uri
|
11
|
+
attr_reader :authentication_schemes
|
12
|
+
attr_reader :etag, :sort, :change_password, :patch
|
13
|
+
attr_reader :bulk, :filter, :meta
|
14
|
+
|
15
|
+
def initialize(location:)
|
16
|
+
@meta = Meta.new('ServiceProviderConfig', location)
|
17
|
+
@authentication_schemes = []
|
18
|
+
@etag = Supportable.new
|
19
|
+
@sort = Supportable.new
|
20
|
+
@change_password = Supportable.new
|
21
|
+
@patch = Supportable.new
|
22
|
+
@bulk = Supportable.new(:max_operations, :max_payload_size)
|
23
|
+
@filter = Supportable.new(:max_results)
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_authentication(type, primary: nil)
|
27
|
+
scheme = AuthenticationScheme.build_for(type, primary: primary)
|
28
|
+
yield scheme if block_given?
|
29
|
+
@authentication_schemes << scheme
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Scim
|
4
|
+
module Kit
|
5
|
+
module V2
|
6
|
+
# Represents a Feature
|
7
|
+
class Supportable
|
8
|
+
include Templatable
|
9
|
+
include DynamicAttributes
|
10
|
+
|
11
|
+
attr_accessor :supported
|
12
|
+
|
13
|
+
def initialize(*dynamic_attributes)
|
14
|
+
@dynamic_attributes = Hash[
|
15
|
+
dynamic_attributes.map { |x| ["#{x}=".to_sym, nil] }
|
16
|
+
]
|
17
|
+
@supported = false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
json.key_format! camelize: :lower
|
4
|
+
json.location location
|
5
|
+
json.resource_type resource_type
|
6
|
+
json.created created.iso8601 if created
|
7
|
+
json.last_modified last_modified.iso8601 if last_modified
|
8
|
+
json.version version.to_i if version
|
File without changes
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
json.key_format! camelize: :lower
|
4
|
+
json.schemas [Scim::Kit::V2::Schema::SERVICE_PROVIDER_CONFIGURATION]
|
5
|
+
json.documentation_uri documentation_uri
|
6
|
+
json.patch do
|
7
|
+
render patch, json: json
|
8
|
+
end
|
9
|
+
json.bulk do
|
10
|
+
render bulk, json: json
|
11
|
+
end
|
12
|
+
json.filter do
|
13
|
+
render filter, json: json
|
14
|
+
end
|
15
|
+
json.change_password do
|
16
|
+
render change_password, json: json
|
17
|
+
end
|
18
|
+
json.sort do
|
19
|
+
render sort, json: json
|
20
|
+
end
|
21
|
+
json.etag do
|
22
|
+
render etag, json: json
|
23
|
+
end
|
24
|
+
json.authentication_schemes authentication_schemes do |authentication_scheme|
|
25
|
+
render authentication_scheme, json: json
|
26
|
+
end
|
27
|
+
json.meta do
|
28
|
+
render meta, json: json
|
29
|
+
end
|
data/lib/scim/kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scim-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|
@@ -174,16 +174,26 @@ files:
|
|
174
174
|
- exe/scim-kit
|
175
175
|
- lib/scim-kit.rb
|
176
176
|
- lib/scim/kit.rb
|
177
|
+
- lib/scim/kit/dynamic_attributes.rb
|
177
178
|
- lib/scim/kit/templatable.rb
|
178
179
|
- lib/scim/kit/template.rb
|
179
180
|
- lib/scim/kit/v2/attribute_type.rb
|
181
|
+
- lib/scim/kit/v2/authentication_scheme.rb
|
182
|
+
- lib/scim/kit/v2/meta.rb
|
180
183
|
- lib/scim/kit/v2/mutability.rb
|
181
184
|
- lib/scim/kit/v2/resource_type.rb
|
182
185
|
- lib/scim/kit/v2/returned.rb
|
183
186
|
- lib/scim/kit/v2/schema.rb
|
187
|
+
- lib/scim/kit/v2/service_provider_configuration.rb
|
188
|
+
- lib/scim/kit/v2/supportable.rb
|
184
189
|
- lib/scim/kit/v2/templates/attribute_type.json.jbuilder
|
190
|
+
- lib/scim/kit/v2/templates/authentication_scheme.json.jbuilder
|
191
|
+
- lib/scim/kit/v2/templates/meta.json.jbuilder
|
192
|
+
- lib/scim/kit/v2/templates/nil_class.json.jbuilder
|
185
193
|
- lib/scim/kit/v2/templates/resource_type.json.jbuilder
|
186
194
|
- lib/scim/kit/v2/templates/schema.json.jbuilder
|
195
|
+
- lib/scim/kit/v2/templates/service_provider_configuration.json.jbuilder
|
196
|
+
- lib/scim/kit/v2/templates/supportable.json.jbuilder
|
187
197
|
- lib/scim/kit/v2/uniqueness.rb
|
188
198
|
- lib/scim/kit/version.rb
|
189
199
|
- scim-kit.gemspec
|
@@ -206,7 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
216
|
- !ruby/object:Gem::Version
|
207
217
|
version: '0'
|
208
218
|
requirements: []
|
209
|
-
rubygems_version: 3.0.
|
219
|
+
rubygems_version: 3.0.2
|
210
220
|
signing_key:
|
211
221
|
specification_version: 4
|
212
222
|
summary: A SCIM library.
|