Skip to content

Commit

Permalink
Add missing case
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshields committed Nov 26, 2023
1 parent f42011e commit b97bea3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/metadata_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,32 @@ class MetadataTest < Minitest::Test
assert validate_xml!(xml_text, "saml-schema-metadata-2.0.xsd")
end
end

describe "with check_sp_cert_expiration and expired keys" do
before do
settings.security[:want_assertions_encrypted] = true
settings.security[:check_sp_cert_expiration] = true
valid_pair = CertificateHelper.generate_pair_hash
early_pair = CertificateHelper.generate_pair_hash(not_before: Time.now + 60)
expired_pair = CertificateHelper.generate_pair_hash(not_after: Time.now - 60)
settings.certificate = nil
settings.certificate_new = nil
settings.private_key = nil
settings.sp_cert_multi = {
signing: [valid_pair, early_pair, expired_pair],
encryption: [valid_pair, early_pair, expired_pair]
}
end

it "generates Service Provider Metadata with X509Certificate for encrypt" do
assert_equal 2, key_descriptors.length
assert_equal "signing", key_descriptors[0].attribute("use").value
assert_equal "encryption", key_descriptors[1].attribute("use").value

assert_equal 2, cert_nodes.length
assert validate_xml!(xml_text, "saml-schema-metadata-2.0.xsd")
end
end
end

describe "when attribute service is configured with multiple attribute values" do
Expand Down

0 comments on commit b97bea3

Please sign in to comment.