diff options
| author | mo <mo@mokhan.ca> | 2018-10-22 10:30:12 -0600 |
|---|---|---|
| committer | mo <mo@mokhan.ca> | 2018-10-22 10:30:12 -0600 |
| commit | 4c28988b7cbfcf58bde8b092cbd32c0e2b21bce8 (patch) | |
| tree | 74831693aa17017ee26266f259e0672c1100b31e | |
| parent | e393cc863c51cdd52f5a846877ebe60108bb099c (diff) | |
ensure encrypted assertion forwards changes to assertionv1.0.26
| -rw-r--r-- | lib/saml/kit/builders/encrypted_assertion.rb | 7 | ||||
| -rw-r--r-- | lib/saml/kit/builders/response.rb | 11 | ||||
| -rw-r--r-- | spec/saml/kit/builders/response_spec.rb | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/lib/saml/kit/builders/encrypted_assertion.rb b/lib/saml/kit/builders/encrypted_assertion.rb index 7c646f1..782ca03 100644 --- a/lib/saml/kit/builders/encrypted_assertion.rb +++ b/lib/saml/kit/builders/encrypted_assertion.rb @@ -10,13 +10,18 @@ module Saml extend Forwardable attr_reader :assertion + attr_accessor :destination def_delegators :@response_builder, :configuration, :encryption_certificate def_delegators :@assertion, :default_name_id_format, - :default_name_id_format= + :default_name_id_format=, + :destination=, + :embed_signature, + :issuer=, + :now= def initialize(response_builder, assertion) @response_builder = response_builder diff --git a/lib/saml/kit/builders/response.rb b/lib/saml/kit/builders/response.rb index bab506f..87cd4cc 100644 --- a/lib/saml/kit/builders/response.rb +++ b/lib/saml/kit/builders/response.rb @@ -52,6 +52,17 @@ module Saml end end + def encrypt=(value) + super(value) + return if @assertion.nil? + + if value + @assertion = EncryptedAssertion.new(self, assertion) if assertion.is_a?(Assertion) + elsif assertion.is_a?(EncryptedAssertion) + @assertion = assertion.assertion if assertion.is_a?(EncryptedAssertion) + end + end + def destination=(value) @destination = value assertion.destination = value diff --git a/spec/saml/kit/builders/response_spec.rb b/spec/saml/kit/builders/response_spec.rb index 9d5742d..1c99b44 100644 --- a/spec/saml/kit/builders/response_spec.rb +++ b/spec/saml/kit/builders/response_spec.rb @@ -76,6 +76,8 @@ RSpec.describe Saml::Kit::Builders::Response do allow(Saml::Kit.configuration).to receive(:entity_id).and_return(issuer) subject.destination = assertion_consumer_service_url subject.encrypt = false + subject.encrypt = true + subject.encrypt = false hash = Hash.from_xml(subject.to_xml) expect(hash['Response']['ID']).to be_present |
