main
1ActiveSupport::Notifications.subscribe 'proof.routes_loaded' do
2 url_helpers = Rails.application.routes.url_helpers
3
4 Scim::Kit::V2.configure do |config|
5 config.service_provider_configuration(location: url_helpers.scim_v2_ServiceProviderConfig_url) do |x|
6 x.documentation_uri = url_helpers.documentation_url
7 x.add_authentication(:oauthbearertoken, primary: true)
8 end
9 config.resource_type(id: 'User', location: url_helpers.scim_v2_resource_type_url(id: 'User')) do |x|
10 x.name = 'User'
11 x.schema = Scim::Kit::V2::Schemas::USER
12 x.endpoint = url_helpers.scim_v2_users_url
13 end
14 config.resource_type(id: 'Group', location: url_helpers.scim_v2_resource_type_url(id: 'Group')) do |x|
15 x.name = 'Group'
16 x.schema = Scim::Kit::V2::Schemas::GROUP
17 x.endpoint = url_helpers.scim_v2_groups_url
18 end
19 config.schema(id: Scim::Kit::V2::Schemas::USER, name: "User", location: url_helpers.scim_v2_schema_url(id: Scim::Kit::V2::Schemas::USER)) do |schema|
20 schema.add_attribute(name: :user_name) do |x|
21 x.required = true
22 x.uniqueness = :server
23 end
24 schema.add_attribute(name: :password) do |x|
25 x.mutability = :write_only
26 x.required = false
27 x.returned = :never
28 end
29 schema.add_attribute(name: :emails) do |x|
30 x.multi_valued = true
31 x.add_attribute(name: :value)
32 x.add_attribute(name: :primary, type: :boolean)
33 end
34 schema.add_attribute(name: :groups) do |x|
35 x.multi_valued = true
36 x.mutability = :read_only
37 x.add_attribute(name: :value) do |y|
38 y.mutability = :read_only
39 end
40 x.add_attribute(name: '$ref', type: :reference) do |y|
41 y.reference_types = %w[User Group]
42 y.mutability = :read_only
43 end
44 x.add_attribute(name: :display) do |y|
45 y.mutability = :read_only
46 end
47 end
48 schema.add_attribute(name: :timezone)
49 schema.add_attribute(name: :locale)
50 end
51 config.schema(id: Scim::Kit::V2::Schemas::GROUP, name: "Group", location: url_helpers.scim_v2_schema_url(id: Scim::Kit::V2::Schemas::GROUP)) do |schema|
52 schema.add_attribute(name: :display_name)
53 schema.add_attribute(name: :members) do |x|
54 x.multi_valued = true
55 x.add_attribute(name: :value) do |y|
56 y.mutability = :immutable
57 end
58 x.add_attribute(name: '$ref') do |y|
59 y.reference_types = %w[User Group]
60 y.mutability = :immutable
61 end
62 x.add_attribute(name: :type) do |y|
63 y.canonical_values = %w[User Group]
64 y.mutability = :immutable
65 end
66 end
67 end
68 end
69end