Commit a53a747

mo <mo.khan@gmail.com>
2019-01-19 22:20:38
add x509 certificates
1 parent 565be40
Changed files (2)
lib
spec
lib/scim/shady.rb
@@ -475,6 +475,91 @@ module Scim
             y.returned = :default
           end
         end
+        schema.add_attribute(name: :roles, type: :complex) do |x|
+          x.multi_valued = true
+          x.description = "A list of roles for the User that collectively represent who the User is, e.g., 'Student', 'Faculty'."
+          x.required = false
+          x.mutability = :read_write
+          x.returned = :default
+          x.add_attribute(name: :value, type: :string) do |y|
+            y.multi_valued = false
+            y.description = "The value of a role."
+            y.required = false
+            y.case_exact = false
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: :display, type: :string) do |y|
+            y.multi_valued = false
+            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
+            y.required = false
+            y.case_exact = false
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: :type, type: :string) do |y|
+            y.multi_valued = false
+            y.description = "A label indicating the attribute's function."
+            y.required = false
+            y.case_exact = false
+            y.canonical_values = []
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: :primary, type: :boolean) do |y|
+            y.multi_valued = false
+            y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute.  The primary attribute value 'true' MUST appear no more than once."
+            y.required = false
+            y.mutability = :read_write
+            y.returned = :default
+          end
+        end
+        schema.add_attribute(name: :x509_certificates, type: :complex) do |x|
+          x.multi_valued = true
+          x.description = "A list of certificates issued to the User."
+          x.required = false
+          x.case_exact = false
+          x.mutability = :read_write
+          x.returned = :default
+          x.add_attribute(name: :value, type: :binary) do |y|
+            y.multi_valued = false
+            y.description = "The value of an X.509 certificate."
+            y.required = false
+            y.case_exact = false
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: :display, type: :string) do |y|
+            y.multi_valued = false
+            y.description = "A human-readable name, primarily used for display purposes.  READ-ONLY."
+            y.required = false
+            y.case_exact = false
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: :type, type: :string) do |y|
+            y.multi_valued = false
+            y.description = "A label indicating the attribute's function."
+            y.required = false
+            y.case_exact = false
+            y.canonical_values = []
+            y.mutability = :read_write
+            y.returned = :default
+            y.uniqueness = :none
+          end
+          x.add_attribute(name: :primary, type: :boolean) do |y|
+            y.multi_valued = false
+            y.description = "A Boolean value indicating the 'primary' or preferred attribute value for this attribute.  The primary attribute value 'true' MUST appear no more than once."
+            y.required = false
+            y.mutability = :read_write
+            y.returned = :default
+          end
+        end
         schema
       end
     end
spec/scim/user_spec.rb
@@ -23,6 +23,7 @@ RSpec.describe Scim::Shady::User do
     subject.addresses << { formatted: '123 street NE, Seattle, WA', street_address: '123 street NE', locality: 'Seattle', region: 'WA', postal_code: '12345', country: 'USA', type: 'work' }
     subject.groups << { value: SecureRandom.uuid, '$ref' => FFaker::Internet.uri('https'), display: '', type: 'direct' }
     subject.entitlements << { value: SecureRandom.uuid, display: 'thing', type: 'thing', primary: true }
+    subject.x509_certificates << { value: '', display: '', type: '', primary: true }
   end
 
   specify { expect(subject.to_h[:userName]).to eql('bjensen') }