Commit 1765137

mokha <mokha@cisco.com>
2019-02-12 18:12:08
parse authentication schemes
1 parent f04fcfb
Changed files (2)
lib/scim/kit/v2/service_provider_configuration.rb
@@ -8,7 +8,7 @@ module Scim
         include Templatable
         attr_accessor :meta, :documentation_uri
         attr_reader :authentication_schemes
-        attr_reader :bulk, :filter#, :location
+        attr_reader :bulk, :filter
         attr_reader :etag, :sort, :change_password, :patch
 
         def initialize(location:)
@@ -43,6 +43,14 @@ module Scim
             x.change_password.supported = hash[:changePassword][:supported]
             x.sort.supported = hash[:sort][:supported]
             x.etag.supported = hash[:etag][:supported]
+            hash[:authenticationSchemes]&.each do |auth|
+              x.add_authentication(auth[:type], primary: auth[:primary]) do |y|
+                y.description = auth[:description]
+                y.documentation_uri = auth[:documentationUri]
+                y.name = auth[:name]
+                y.spec_uri = auth[:specUri]
+              end
+            end
             x
           end
         end
spec/scim/kit/v2/service_provider_configuration_spec.rb
@@ -136,11 +136,11 @@ RSpec.describe Scim::Kit::V2::ServiceProviderConfiguration do
     end
   end
 
-  describe ".parse" do
+  describe '.parse' do
     let(:result) { described_class.parse(subject.to_json) }
 
     before do
-      #subject.add_authentication(:oauthbearertoken)
+      subject.add_authentication(:oauthbearertoken)
       subject.bulk.max_operations = 1000
       subject.bulk.max_payload_size = 1_048_576
       subject.bulk.supported = true