Commit 7a6e1d6
2017-11-26 17:48:41
1 parent
93e9e18
Changed files (3)
saml-kit
lib
saml
spec
saml
saml-kit/lib/saml/kit/cryptography.rb
@@ -45,8 +45,8 @@ module Saml
cipher.key = symmetric_key
cipher.iv = iv
- puts ['-key', symmetric_key].inspect
- puts ['-iv', iv].inspect
+ Saml::Kit.logger.debug ['-key', symmetric_key].inspect
+ Saml::Kit.logger.debug ['-iv', iv].inspect
cipher.update(data) + cipher.final
elsif rsa
saml-kit/lib/saml/kit/response.rb
@@ -192,8 +192,8 @@ module Saml
iv = cipher.random_iv
encrypted = cipher.update(raw_xml_to_encrypt) + cipher.final
- puts ['+iv', iv].inspect
- puts ['+key', key].inspect
+ Saml::Kit.logger.debug ['+iv', iv].inspect
+ Saml::Kit.logger.debug ['+key', key].inspect
xml.EncryptedAssertion xmlns: Namespaces::ASSERTION do
xml.EncryptedData xmlns: Namespaces::XMLENC, TYPE: "http://www.w3.org/2001/04/xmlenc#Element" do
saml-kit/spec/saml/response_spec.rb
@@ -424,10 +424,18 @@ RSpec.describe Saml::Kit::Response do
result = Hash.from_xml(subject.to_xml)
expect(result['Response']['EncryptedAssertion']).to be_present
encrypted_assertion = result['Response']['EncryptedAssertion']
- decrypted = Saml::Kit::Cryptography.new.decrypt(encrypted_assertion)
- puts decrypted.inspect
- decrypted_hash = Hash.from_xml(decrypted)
+ decrypted_assertion = Saml::Kit::Cryptography.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
+ expect(decrypted_hash['Assertion']['Subject']).to be_present
+ expect(decrypted_hash['Assertion']['Subject']['NameID']).to be_present
+ expect(decrypted_hash['Assertion']['Subject']['SubjectConfirmation']).to be_present
+ expect(decrypted_hash['Assertion']['Subject']['Conditions']).to be_present
+ expect(decrypted_hash['Assertion']['Subject']['Conditions']['AudienceRestriction']).to be_present
+ expect(decrypted_hash['Assertion']['Subject']['AuthnStatement']).to be_present
+ expect(decrypted_hash['Assertion']['Subject']['AuthnStatement']['AuthnContext']).to be_present
+ expect(decrypted_hash['Assertion']['Subject']['AuthnStatement']['AuthnContext']['AuthnContextClassRef']).to be_present
end
end
end