Commit cf05d42

mo <mo@mokhan.ca>
2017-12-14 18:55:26
decouple from deprecated method.
1 parent db0e70f
lib/saml/kit/xml_decryption.rb
@@ -4,7 +4,7 @@ module Saml
       attr_reader :private_key
 
       def initialize(configuration: Saml::Kit.configuration)
-        @private_key = configuration.encryption_private_key
+        @private_key = configuration.private_keys(use: :encryption).sample
       end
 
       def decrypt(data)
spec/saml/response_spec.rb
@@ -366,7 +366,7 @@ XML
       public_key = OpenSSL::X509::Certificate.new(certificate_pem).public_key
       private_key = OpenSSL::PKey::RSA.new(private_key_pem, password)
 
-      allow(Saml::Kit.configuration).to receive(:encryption_private_key).and_return(private_key)
+      allow(Saml::Kit.configuration).to receive(:private_keys).with(use: :encryption).and_return([private_key])
 
       cipher = OpenSSL::Cipher.new('AES-128-CBC')
       cipher.encrypt
spec/saml/xml_decryption_spec.rb
@@ -40,7 +40,7 @@ RSpec.describe Saml::Kit::XmlDecryption do
           }
         }
       }
-      subject = described_class.new(configuration: double(encryption_private_key: private_key))
+      subject = described_class.new(configuration: double(private_keys: [private_key]))
       decrypted = subject.decrypt(data)
       expect(decrypted.strip).to eql(secret)
     end