Commit bec0088

mo <mo.khan@gmail.com>
2017-12-02 03:23:15
rename Cryptography to XmlDecryption.
1 parent 23ea2e0
lib/saml/kit/response.rb
@@ -56,7 +56,7 @@ module Saml
         @assertion =
           begin
             if encrypted?
-              decrypted = Cryptography.new.decrypt(to_h.fetch(name, {}).fetch('EncryptedAssertion', {}))
+              decrypted = XmlDecryption.new.decrypt(to_h.fetch(name, {}).fetch('EncryptedAssertion', {}))
               Saml::Kit.logger.debug(decrypted)
               Hash.from_xml(decrypted)['Assertion']
             else
lib/saml/kit/cryptography.rb → lib/saml/kit/xml_decryption.rb
@@ -1,6 +1,6 @@
 module Saml
   module Kit
-    class Cryptography
+    class XmlDecryption
       attr_reader :private_key
 
       def initialize(private_key = Saml::Kit.configuration.encryption_private_key)
lib/saml/kit.rb
@@ -29,7 +29,6 @@ require "saml/kit/bindings"
 require "saml/kit/certificate"
 require "saml/kit/configuration"
 require "saml/kit/crypto"
-require "saml/kit/cryptography"
 require "saml/kit/default_registry"
 require "saml/kit/fingerprint"
 require "saml/kit/logout_response"
@@ -43,6 +42,7 @@ require "saml/kit/self_signed_certificate"
 require "saml/kit/service_provider_metadata"
 require "saml/kit/signature"
 require "saml/kit/xml"
+require "saml/kit/xml_decryption"
 
 I18n.load_path += Dir[File.expand_path("kit/locales/*.yml", File.dirname(__FILE__))]
 
spec/saml/builders/response_spec.rb
@@ -90,7 +90,7 @@ RSpec.describe Saml::Kit::Builders::Response do
       result = Hash.from_xml(subject.to_xml)
       expect(result['Response']['EncryptedAssertion']).to be_present
       encrypted_assertion = result['Response']['EncryptedAssertion']
-      decrypted_assertion = Saml::Kit::Cryptography.new.decrypt(encrypted_assertion)
+      decrypted_assertion = Saml::Kit::XmlDecryption.new.decrypt(encrypted_assertion)
       decrypted_hash = Hash.from_xml(decrypted_assertion)
       expect(decrypted_hash['Assertion']).to be_present
       expect(decrypted_hash['Assertion']['Issuer']).to be_present
spec/saml/cryptography_spec.rb → spec/saml/xml_decryption_spec.rb
@@ -1,6 +1,6 @@
 require 'spec_helper'
 
-RSpec.describe Saml::Kit::Cryptography do
+RSpec.describe Saml::Kit::XmlDecryption do
   describe "#decrypt" do
     let(:secret) { FFaker::Movie.title }
     let(:password) { FFaker::Movie.title }