From 0d6239fea649a157cabaa4e0750286e5c23b77c1 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 19 Dec 2023 20:39:30 +0100 Subject: [PATCH] Add securitypolicy classes --- resources/schemas/ws-securitypolicy-1.2.xsd | 38 +++- src/Constants.php | 5 + src/Utils/XPath.php | 41 ++++ src/XML/sp/AbsXPath.php | 14 ++ src/XML/sp/AbstractEmptyType.php | 64 ++++++ src/XML/sp/AbstractHeaderType.php | 129 ++++++++++++ src/XML/sp/AbstractQNameAssertionType.php | 83 ++++++++ src/XML/sp/AbstractReqPartsType.php | 145 ++++++++++++++ src/XML/sp/AbstractSePartsType.php | 187 ++++++++++++++++++ src/XML/sp/AbstractSpElement.php | 22 +++ src/XML/sp/Attachments.php | 14 ++ src/XML/sp/Basic128.php | 14 ++ src/XML/sp/Basic128Rsa15.php | 14 ++ src/XML/sp/Basic128Sha256.php | 14 ++ src/XML/sp/Basic128Sha256Rsa15.php | 14 ++ src/XML/sp/Basic192.php | 14 ++ src/XML/sp/Basic192Rsa15.php | 14 ++ src/XML/sp/Basic192Sha256.php | 14 ++ src/XML/sp/Basic192Sha256Rsa15.php | 14 ++ src/XML/sp/Basic256.php | 14 ++ src/XML/sp/Basic256Rsa15.php | 14 ++ src/XML/sp/Basic256Sha256.php | 14 ++ src/XML/sp/Basic256Sha256Rsa15.php | 14 ++ src/XML/sp/Body.php | 14 ++ src/XML/sp/EncryptBeforeSigning.php | 14 ++ src/XML/sp/EncryptSignature.php | 14 ++ src/XML/sp/EncryptedParts.php | 14 ++ src/XML/sp/HashPassword.php | 14 ++ src/XML/sp/Header.php | 14 ++ src/XML/sp/HttpBasicAuthentication.php | 14 ++ src/XML/sp/HttpDigestAuthentication.php | 14 ++ src/XML/sp/IncludeTimestamp.php | 14 ++ src/XML/sp/IncludeToken.php | 14 ++ src/XML/sp/IncludeTokenTypeTrait.php | 51 +++++ src/XML/sp/InclusiveC14N.php | 14 ++ src/XML/sp/Lax.php | 14 ++ src/XML/sp/LaxTsFirst.php | 14 ++ src/XML/sp/LaxTsLast.php | 14 ++ src/XML/sp/MustNotSendAmend.php | 14 ++ src/XML/sp/MustNotSendCancel.php | 14 ++ src/XML/sp/MustNotSendRenew.php | 14 ++ src/XML/sp/MustSupportClientChallenge.php | 14 ++ src/XML/sp/MustSupportIssuedTokens.php | 14 ++ src/XML/sp/MustSupportRefEmbeddedToken.php | 14 ++ src/XML/sp/MustSupportRefEncryptedKey.php | 14 ++ src/XML/sp/MustSupportRefExternalURI.php | 14 ++ src/XML/sp/MustSupportRefIssuerSerial.php | 14 ++ src/XML/sp/MustSupportRefKeyIdentifier.php | 14 ++ src/XML/sp/MustSupportRefThumbprint.php | 14 ++ src/XML/sp/MustSupportServerChallenge.php | 14 ++ src/XML/sp/NoPassword.php | 14 ++ src/XML/sp/OnlySignEntireHeadersAndBody.php | 14 ++ src/XML/sp/ProtectTokens.php | 14 ++ src/XML/sp/RequireAppliesTo.php | 14 ++ src/XML/sp/RequireClientCertificate.php | 14 ++ src/XML/sp/RequireClientEntropy.php | 14 ++ src/XML/sp/RequireDerivedKeys.php | 14 ++ src/XML/sp/RequireEmbeddedTokenReference.php | 14 ++ src/XML/sp/RequireExplicitDerivedKeys.php | 14 ++ src/XML/sp/RequireExternalReference.php | 14 ++ src/XML/sp/RequireExternalUriReference.php | 14 ++ src/XML/sp/RequireImpliedDerivedKeys.php | 14 ++ src/XML/sp/RequireInternalReference.php | 14 ++ src/XML/sp/RequireIssuerSerialReference.php | 14 ++ src/XML/sp/RequireKeyIdentifierReference.php | 14 ++ .../RequireRequestSecurityTokenCollection.php | 14 ++ src/XML/sp/RequireServerEntropy.php | 14 ++ src/XML/sp/RequireSignatureConfirmation.php | 14 ++ src/XML/sp/RequireThumbprintReference.php | 14 ++ src/XML/sp/RequiredParts.php | 14 ++ src/XML/sp/RsaKeyValue.php | 14 ++ src/XML/sp/SC13SecurityContextToken.php | 14 ++ src/XML/sp/SOAPNormalization10.php | 14 ++ src/XML/sp/STRTransform10.php | 14 ++ src/XML/sp/SignedParts.php | 14 ++ src/XML/sp/Strict.php | 14 ++ src/XML/sp/TripleDes.php | 14 ++ src/XML/sp/TripleDesRsa15.php | 14 ++ src/XML/sp/TripleDesSha256.php | 14 ++ src/XML/sp/TripleDesSha256Rsa15.php | 14 ++ src/XML/sp/WssGssKerberosV5ApReqToken11.php | 14 ++ src/XML/sp/WssKerberosV5ApReqToken11.php | 14 ++ src/XML/sp/WssRelV10Token10.php | 14 ++ src/XML/sp/WssRelV10Token11.php | 14 ++ src/XML/sp/WssRelV20Token10.php | 14 ++ src/XML/sp/WssRelV20Token11.php | 14 ++ src/XML/sp/WssSamlV11Token10.php | 14 ++ src/XML/sp/WssSamlV11Token11.php | 14 ++ src/XML/sp/WssSamlV20Token11.php | 14 ++ src/XML/sp/WssUsernameToken10.php | 14 ++ src/XML/sp/WssUsernameToken11.php | 14 ++ src/XML/sp/WssX509Pkcs7Token10.php | 14 ++ src/XML/sp/WssX509Pkcs7Token11.php | 14 ++ src/XML/sp/WssX509PkiPathV1Token10.php | 14 ++ src/XML/sp/WssX509PkiPathV1Token11.php | 14 ++ src/XML/sp/WssX509V1Token11.php | 14 ++ src/XML/sp/WssX509V3Token10.php | 14 ++ src/XML/sp/WssX509V3Token11.php | 14 ++ src/XML/sp/XPath10.php | 14 ++ src/XML/sp/XPathFilter20.php | 14 ++ tests/WSSecurity/Constants.php | 15 ++ tests/WSSecurity/XML/sp/AbsXPathTest.php | 41 ++++ .../sp/AbstractQNameAssertionTypeTestCase.php | 92 +++++++++ tests/WSSecurity/XML/sp/AttachmentsTest.php | 74 +++++++ tests/WSSecurity/XML/sp/Basic128Rsa15Test.php | 41 ++++ .../XML/sp/Basic128Sha256Rsa15Test.php | 41 ++++ .../WSSecurity/XML/sp/Basic128Sha256Test.php | 41 ++++ tests/WSSecurity/XML/sp/Basic128Test.php | 41 ++++ tests/WSSecurity/XML/sp/Basic192Rsa15Test.php | 41 ++++ .../XML/sp/Basic192Sha256Rsa15Test.php | 41 ++++ .../WSSecurity/XML/sp/Basic192Sha256Test.php | 41 ++++ tests/WSSecurity/XML/sp/Basic192Test.php | 41 ++++ tests/WSSecurity/XML/sp/Basic256Rsa15Test.php | 41 ++++ .../XML/sp/Basic256Sha256Rsa15Test.php | 41 ++++ .../WSSecurity/XML/sp/Basic256Sha256Test.php | 41 ++++ tests/WSSecurity/XML/sp/Basic256Test.php | 41 ++++ tests/WSSecurity/XML/sp/BodyTest.php | 74 +++++++ .../XML/sp/EncryptBeforeSigningTest.php | 41 ++++ .../XML/sp/EncryptSignatureTest.php | 41 ++++ .../WSSecurity/XML/sp/EncryptedPartsTest.php | 137 +++++++++++++ tests/WSSecurity/XML/sp/HashPasswordTest.php | 41 ++++ tests/WSSecurity/XML/sp/HeaderTest.php | 76 +++++++ .../XML/sp/HttpBasicAuthenticationTest.php | 41 ++++ .../XML/sp/HttpDigestAuthenticationTest.php | 41 ++++ .../XML/sp/IncludeTimestampTest.php | 41 ++++ tests/WSSecurity/XML/sp/InclusiveC14NTest.php | 41 ++++ tests/WSSecurity/XML/sp/LaxTest.php | 41 ++++ tests/WSSecurity/XML/sp/LaxTsFirstTest.php | 41 ++++ tests/WSSecurity/XML/sp/LaxTsLastTest.php | 41 ++++ .../XML/sp/MustNotSendAmendTest.php | 41 ++++ .../XML/sp/MustNotSendCancelTest.php | 41 ++++ .../XML/sp/MustNotSendRenewTest.php | 41 ++++ .../XML/sp/MustSupportClientChallengeTest.php | 41 ++++ .../XML/sp/MustSupportIssuedTokensTest.php | 41 ++++ .../sp/MustSupportRefEmbeddedTokenTest.php | 41 ++++ .../XML/sp/MustSupportRefEncryptedKeyTest.php | 41 ++++ .../XML/sp/MustSupportRefExternalURITest.php | 41 ++++ .../XML/sp/MustSupportRefIssuerSerialTest.php | 41 ++++ .../sp/MustSupportRefKeyIdentifierTest.php | 41 ++++ .../XML/sp/MustSupportRefThumbprintTest.php | 41 ++++ .../XML/sp/MustSupportServerChallengeTest.php | 41 ++++ tests/WSSecurity/XML/sp/NoPasswordTest.php | 41 ++++ .../sp/OnlySignEntireHeadersAndBodyTest.php | 41 ++++ tests/WSSecurity/XML/sp/ProtectTokensTest.php | 41 ++++ .../XML/sp/RequireAppliesToTest.php | 41 ++++ .../XML/sp/RequireClientCertificateTest.php | 41 ++++ .../XML/sp/RequireClientEntropyTest.php | 41 ++++ .../XML/sp/RequireDerivedKeysTest.php | 41 ++++ .../sp/RequireEmbeddedTokenReferenceTest.php | 41 ++++ .../XML/sp/RequireExplicitDerivedKeysTest.php | 41 ++++ .../sp/RequireExternalUriReferenceTest.php | 41 ++++ .../XML/sp/RequireImpliedDerivedKeysTest.php | 41 ++++ .../XML/sp/RequireInternalReferenceTest.php | 41 ++++ .../sp/RequireIssuerSerialReferenceTest.php | 41 ++++ .../sp/RequireKeyIdentifierReferenceTest.php | 41 ++++ ...uireRequestSecurityTokenCollectionTest.php | 41 ++++ .../XML/sp/RequireServerEntropyTest.php | 41 ++++ .../sp/RequireSignatureConfirmationTest.php | 41 ++++ .../XML/sp/RequireThumbprintReferenceTest.php | 41 ++++ tests/WSSecurity/XML/sp/RequiredPartsTest.php | 128 ++++++++++++ tests/WSSecurity/XML/sp/RsaKeyValueTest.php | 41 ++++ .../XML/sp/SC13SecurityContextTokenTest.php | 41 ++++ .../XML/sp/SOAPNormalization10Test.php | 41 ++++ .../WSSecurity/XML/sp/STRTransform10Test.php | 41 ++++ tests/WSSecurity/XML/sp/SignedPartsTest.php | 137 +++++++++++++ tests/WSSecurity/XML/sp/StrictTest.php | 41 ++++ .../WSSecurity/XML/sp/TripleDesRsa15Test.php | 41 ++++ .../XML/sp/TripleDesSha256Rsa15Test.php | 41 ++++ .../WSSecurity/XML/sp/TripleDesSha256Test.php | 41 ++++ tests/WSSecurity/XML/sp/TripleDesTest.php | 41 ++++ .../sp/WssGssKerberosV5ApReqToken11Test.php | 41 ++++ .../XML/sp/WssKerberosV5ApReqToken11Test.php | 41 ++++ .../XML/sp/WssRelV10Token10Test.php | 41 ++++ .../XML/sp/WssRelV10Token11Test.php | 41 ++++ .../XML/sp/WssRelV20Token10Test.php | 41 ++++ .../XML/sp/WssRelV20Token11Test.php | 41 ++++ .../XML/sp/WssSamlV11Token10Test.php | 41 ++++ .../XML/sp/WssSamlV11Token11Test.php | 41 ++++ .../XML/sp/WssSamlV20Token11Test.php | 41 ++++ .../XML/sp/WssUsernameToken10Test.php | 41 ++++ .../XML/sp/WssUsernameToken11Test.php | 41 ++++ .../XML/sp/WssX509Pkcs7Token10Test.php | 41 ++++ .../XML/sp/WssX509Pkcs7Token11Test.php | 41 ++++ .../XML/sp/WssX509PkiPathV1Token10Test.php | 41 ++++ .../XML/sp/WssX509PkiPathV1Token11Test.php | 41 ++++ .../XML/sp/WssX509V1Token11Test.php | 41 ++++ .../XML/sp/WssX509V3Token10Test.php | 41 ++++ .../XML/sp/WssX509V3Token11Test.php | 41 ++++ tests/WSSecurity/XML/sp/XPath10Test.php | 41 ++++ tests/WSSecurity/XML/sp/XPathFilter20Test.php | 41 ++++ tests/resources/xml/sp_AbsXPath.xml | 1 + tests/resources/xml/sp_Attachments.xml | 1 + tests/resources/xml/sp_Basic128.xml | 1 + tests/resources/xml/sp_Basic128Rsa15.xml | 1 + tests/resources/xml/sp_Basic128Sha256.xml | 1 + .../resources/xml/sp_Basic128Sha256Rsa15.xml | 1 + tests/resources/xml/sp_Basic192.xml | 1 + tests/resources/xml/sp_Basic192Rsa15.xml | 1 + tests/resources/xml/sp_Basic192Sha256.xml | 1 + .../resources/xml/sp_Basic192Sha256Rsa15.xml | 1 + tests/resources/xml/sp_Basic256.xml | 1 + tests/resources/xml/sp_Basic256Rsa15.xml | 1 + tests/resources/xml/sp_Basic256Sha256.xml | 1 + .../resources/xml/sp_Basic256Sha256Rsa15.xml | 1 + tests/resources/xml/sp_Body.xml | 1 + .../resources/xml/sp_EncryptBeforeSigning.xml | 1 + tests/resources/xml/sp_EncryptSignature.xml | 1 + tests/resources/xml/sp_EncryptedParts.xml | 6 + tests/resources/xml/sp_HashPassword.xml | 1 + tests/resources/xml/sp_Header.xml | 1 + .../xml/sp_HttpBasicAuthentication.xml | 1 + .../xml/sp_HttpDigestAuthentication.xml | 1 + tests/resources/xml/sp_IncludeTimestamp.xml | 1 + tests/resources/xml/sp_InclusiveC14N.xml | 1 + tests/resources/xml/sp_Lax.xml | 1 + tests/resources/xml/sp_LaxTsFirst.xml | 1 + tests/resources/xml/sp_LaxTsLast.xml | 1 + tests/resources/xml/sp_MustNotSendAmend.xml | 1 + tests/resources/xml/sp_MustNotSendCancel.xml | 1 + tests/resources/xml/sp_MustNotSendRenew.xml | 1 + .../xml/sp_MustSupportClientChallenge.xml | 1 + .../xml/sp_MustSupportIssuedTokens.xml | 1 + .../xml/sp_MustSupportRefEmbeddedToken.xml | 1 + .../xml/sp_MustSupportRefEncryptedKey.xml | 1 + .../xml/sp_MustSupportRefExternalURI.xml | 1 + .../xml/sp_MustSupportRefIssuerSerial.xml | 1 + .../xml/sp_MustSupportRefKeyIdentifier.xml | 1 + .../xml/sp_MustSupportRefThumbprint.xml | 1 + .../xml/sp_MustSupportServerChallenge.xml | 1 + tests/resources/xml/sp_NoPassword.xml | 1 + .../xml/sp_OnlySignEntireHeadersAndBody.xml | 1 + tests/resources/xml/sp_ProtectTokens.xml | 1 + tests/resources/xml/sp_RequireAppliesTo.xml | 1 + .../xml/sp_RequireClientCertificate.xml | 1 + .../resources/xml/sp_RequireClientEntropy.xml | 1 + tests/resources/xml/sp_RequireDerivedKeys.xml | 1 + .../xml/sp_RequireEmbeddedTokenReference.xml | 1 + .../xml/sp_RequireExplicitDerivedKeys.xml | 1 + .../xml/sp_RequireExternalReference.xml | 1 + .../xml/sp_RequireExternalUriReference.xml | 1 + .../xml/sp_RequireImpliedDerivedKeys.xml | 1 + .../xml/sp_RequireInternalReference.xml | 1 + .../xml/sp_RequireIssuerSerialReference.xml | 1 + .../xml/sp_RequireKeyIdentifierReference.xml | 1 + ..._RequireRequestSecurityTokenCollection.xml | 1 + .../resources/xml/sp_RequireServerEntropy.xml | 1 + .../xml/sp_RequireSignatureConfirmation.xml | 1 + .../xml/sp_RequireThumbprintReference.xml | 1 + tests/resources/xml/sp_RequiredParts.xml | 4 + tests/resources/xml/sp_RsaKeyValue.xml | 1 + .../xml/sp_SC13SecurityContextToken.xml | 1 + .../resources/xml/sp_SOAPNormalization10.xml | 1 + tests/resources/xml/sp_STRTransform10.xml | 1 + tests/resources/xml/sp_SignedParts.xml | 6 + tests/resources/xml/sp_Strict.xml | 1 + tests/resources/xml/sp_TripleDes.xml | 1 + tests/resources/xml/sp_TripleDesRsa15.xml | 1 + tests/resources/xml/sp_TripleDesSha256.xml | 1 + .../resources/xml/sp_TripleDesSha256Rsa15.xml | 1 + .../xml/sp_WssGssKerberosV5ApReqToken11.xml | 1 + .../xml/sp_WssKerberosV5ApReqToken11.xml | 1 + tests/resources/xml/sp_WssRelV10Token10.xml | 1 + tests/resources/xml/sp_WssRelV10Token11.xml | 1 + tests/resources/xml/sp_WssRelV20Token10.xml | 1 + tests/resources/xml/sp_WssRelV20Token11.xml | 1 + tests/resources/xml/sp_WssSamlV11Token10.xml | 1 + tests/resources/xml/sp_WssSamlV11Token11.xml | 1 + tests/resources/xml/sp_WssSamlV20Token11.xml | 1 + tests/resources/xml/sp_WssUsernameToken10.xml | 1 + tests/resources/xml/sp_WssUsernameToken11.xml | 1 + .../resources/xml/sp_WssX509Pkcs7Token10.xml | 1 + .../resources/xml/sp_WssX509Pkcs7Token11.xml | 1 + .../xml/sp_WssX509PkiPathV1Token10.xml | 1 + .../xml/sp_WssX509PkiPathV1Token11.xml | 1 + tests/resources/xml/sp_WssX509V1Token11.xml | 1 + tests/resources/xml/sp_WssX509V3Token10.xml | 1 + tests/resources/xml/sp_WssX509V3Token11.xml | 1 + tests/resources/xml/sp_XPath10.xml | 1 + tests/resources/xml/sp_XPathFilter20.xml | 1 + 279 files changed, 6214 insertions(+), 8 deletions(-) create mode 100644 src/Utils/XPath.php create mode 100644 src/XML/sp/AbsXPath.php create mode 100644 src/XML/sp/AbstractEmptyType.php create mode 100644 src/XML/sp/AbstractHeaderType.php create mode 100644 src/XML/sp/AbstractQNameAssertionType.php create mode 100644 src/XML/sp/AbstractReqPartsType.php create mode 100644 src/XML/sp/AbstractSePartsType.php create mode 100644 src/XML/sp/AbstractSpElement.php create mode 100644 src/XML/sp/Attachments.php create mode 100644 src/XML/sp/Basic128.php create mode 100644 src/XML/sp/Basic128Rsa15.php create mode 100644 src/XML/sp/Basic128Sha256.php create mode 100644 src/XML/sp/Basic128Sha256Rsa15.php create mode 100644 src/XML/sp/Basic192.php create mode 100644 src/XML/sp/Basic192Rsa15.php create mode 100644 src/XML/sp/Basic192Sha256.php create mode 100644 src/XML/sp/Basic192Sha256Rsa15.php create mode 100644 src/XML/sp/Basic256.php create mode 100644 src/XML/sp/Basic256Rsa15.php create mode 100644 src/XML/sp/Basic256Sha256.php create mode 100644 src/XML/sp/Basic256Sha256Rsa15.php create mode 100644 src/XML/sp/Body.php create mode 100644 src/XML/sp/EncryptBeforeSigning.php create mode 100644 src/XML/sp/EncryptSignature.php create mode 100644 src/XML/sp/EncryptedParts.php create mode 100644 src/XML/sp/HashPassword.php create mode 100644 src/XML/sp/Header.php create mode 100644 src/XML/sp/HttpBasicAuthentication.php create mode 100644 src/XML/sp/HttpDigestAuthentication.php create mode 100644 src/XML/sp/IncludeTimestamp.php create mode 100644 src/XML/sp/IncludeToken.php create mode 100644 src/XML/sp/IncludeTokenTypeTrait.php create mode 100644 src/XML/sp/InclusiveC14N.php create mode 100644 src/XML/sp/Lax.php create mode 100644 src/XML/sp/LaxTsFirst.php create mode 100644 src/XML/sp/LaxTsLast.php create mode 100644 src/XML/sp/MustNotSendAmend.php create mode 100644 src/XML/sp/MustNotSendCancel.php create mode 100644 src/XML/sp/MustNotSendRenew.php create mode 100644 src/XML/sp/MustSupportClientChallenge.php create mode 100644 src/XML/sp/MustSupportIssuedTokens.php create mode 100644 src/XML/sp/MustSupportRefEmbeddedToken.php create mode 100644 src/XML/sp/MustSupportRefEncryptedKey.php create mode 100644 src/XML/sp/MustSupportRefExternalURI.php create mode 100644 src/XML/sp/MustSupportRefIssuerSerial.php create mode 100644 src/XML/sp/MustSupportRefKeyIdentifier.php create mode 100644 src/XML/sp/MustSupportRefThumbprint.php create mode 100644 src/XML/sp/MustSupportServerChallenge.php create mode 100644 src/XML/sp/NoPassword.php create mode 100644 src/XML/sp/OnlySignEntireHeadersAndBody.php create mode 100644 src/XML/sp/ProtectTokens.php create mode 100644 src/XML/sp/RequireAppliesTo.php create mode 100644 src/XML/sp/RequireClientCertificate.php create mode 100644 src/XML/sp/RequireClientEntropy.php create mode 100644 src/XML/sp/RequireDerivedKeys.php create mode 100644 src/XML/sp/RequireEmbeddedTokenReference.php create mode 100644 src/XML/sp/RequireExplicitDerivedKeys.php create mode 100644 src/XML/sp/RequireExternalReference.php create mode 100644 src/XML/sp/RequireExternalUriReference.php create mode 100644 src/XML/sp/RequireImpliedDerivedKeys.php create mode 100644 src/XML/sp/RequireInternalReference.php create mode 100644 src/XML/sp/RequireIssuerSerialReference.php create mode 100644 src/XML/sp/RequireKeyIdentifierReference.php create mode 100644 src/XML/sp/RequireRequestSecurityTokenCollection.php create mode 100644 src/XML/sp/RequireServerEntropy.php create mode 100644 src/XML/sp/RequireSignatureConfirmation.php create mode 100644 src/XML/sp/RequireThumbprintReference.php create mode 100644 src/XML/sp/RequiredParts.php create mode 100644 src/XML/sp/RsaKeyValue.php create mode 100644 src/XML/sp/SC13SecurityContextToken.php create mode 100644 src/XML/sp/SOAPNormalization10.php create mode 100644 src/XML/sp/STRTransform10.php create mode 100644 src/XML/sp/SignedParts.php create mode 100644 src/XML/sp/Strict.php create mode 100644 src/XML/sp/TripleDes.php create mode 100644 src/XML/sp/TripleDesRsa15.php create mode 100644 src/XML/sp/TripleDesSha256.php create mode 100644 src/XML/sp/TripleDesSha256Rsa15.php create mode 100644 src/XML/sp/WssGssKerberosV5ApReqToken11.php create mode 100644 src/XML/sp/WssKerberosV5ApReqToken11.php create mode 100644 src/XML/sp/WssRelV10Token10.php create mode 100644 src/XML/sp/WssRelV10Token11.php create mode 100644 src/XML/sp/WssRelV20Token10.php create mode 100644 src/XML/sp/WssRelV20Token11.php create mode 100644 src/XML/sp/WssSamlV11Token10.php create mode 100644 src/XML/sp/WssSamlV11Token11.php create mode 100644 src/XML/sp/WssSamlV20Token11.php create mode 100644 src/XML/sp/WssUsernameToken10.php create mode 100644 src/XML/sp/WssUsernameToken11.php create mode 100644 src/XML/sp/WssX509Pkcs7Token10.php create mode 100644 src/XML/sp/WssX509Pkcs7Token11.php create mode 100644 src/XML/sp/WssX509PkiPathV1Token10.php create mode 100644 src/XML/sp/WssX509PkiPathV1Token11.php create mode 100644 src/XML/sp/WssX509V1Token11.php create mode 100644 src/XML/sp/WssX509V3Token10.php create mode 100644 src/XML/sp/WssX509V3Token11.php create mode 100644 src/XML/sp/XPath10.php create mode 100644 src/XML/sp/XPathFilter20.php create mode 100644 tests/WSSecurity/Constants.php create mode 100644 tests/WSSecurity/XML/sp/AbsXPathTest.php create mode 100644 tests/WSSecurity/XML/sp/AbstractQNameAssertionTypeTestCase.php create mode 100644 tests/WSSecurity/XML/sp/AttachmentsTest.php create mode 100644 tests/WSSecurity/XML/sp/Basic128Rsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic128Sha256Rsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic128Sha256Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic128Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic192Rsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic192Sha256Rsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic192Sha256Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic192Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic256Rsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic256Sha256Rsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic256Sha256Test.php create mode 100644 tests/WSSecurity/XML/sp/Basic256Test.php create mode 100644 tests/WSSecurity/XML/sp/BodyTest.php create mode 100644 tests/WSSecurity/XML/sp/EncryptBeforeSigningTest.php create mode 100644 tests/WSSecurity/XML/sp/EncryptSignatureTest.php create mode 100644 tests/WSSecurity/XML/sp/EncryptedPartsTest.php create mode 100644 tests/WSSecurity/XML/sp/HashPasswordTest.php create mode 100644 tests/WSSecurity/XML/sp/HeaderTest.php create mode 100644 tests/WSSecurity/XML/sp/HttpBasicAuthenticationTest.php create mode 100644 tests/WSSecurity/XML/sp/HttpDigestAuthenticationTest.php create mode 100644 tests/WSSecurity/XML/sp/IncludeTimestampTest.php create mode 100644 tests/WSSecurity/XML/sp/InclusiveC14NTest.php create mode 100644 tests/WSSecurity/XML/sp/LaxTest.php create mode 100644 tests/WSSecurity/XML/sp/LaxTsFirstTest.php create mode 100644 tests/WSSecurity/XML/sp/LaxTsLastTest.php create mode 100644 tests/WSSecurity/XML/sp/MustNotSendAmendTest.php create mode 100644 tests/WSSecurity/XML/sp/MustNotSendCancelTest.php create mode 100644 tests/WSSecurity/XML/sp/MustNotSendRenewTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportClientChallengeTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportIssuedTokensTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportRefEmbeddedTokenTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportRefEncryptedKeyTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportRefExternalURITest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportRefIssuerSerialTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportRefKeyIdentifierTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportRefThumbprintTest.php create mode 100644 tests/WSSecurity/XML/sp/MustSupportServerChallengeTest.php create mode 100644 tests/WSSecurity/XML/sp/NoPasswordTest.php create mode 100644 tests/WSSecurity/XML/sp/OnlySignEntireHeadersAndBodyTest.php create mode 100644 tests/WSSecurity/XML/sp/ProtectTokensTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireAppliesToTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireClientCertificateTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireClientEntropyTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireDerivedKeysTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireEmbeddedTokenReferenceTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireExplicitDerivedKeysTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireExternalUriReferenceTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireImpliedDerivedKeysTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireInternalReferenceTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireIssuerSerialReferenceTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireKeyIdentifierReferenceTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireRequestSecurityTokenCollectionTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireServerEntropyTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireSignatureConfirmationTest.php create mode 100644 tests/WSSecurity/XML/sp/RequireThumbprintReferenceTest.php create mode 100644 tests/WSSecurity/XML/sp/RequiredPartsTest.php create mode 100644 tests/WSSecurity/XML/sp/RsaKeyValueTest.php create mode 100644 tests/WSSecurity/XML/sp/SC13SecurityContextTokenTest.php create mode 100644 tests/WSSecurity/XML/sp/SOAPNormalization10Test.php create mode 100644 tests/WSSecurity/XML/sp/STRTransform10Test.php create mode 100644 tests/WSSecurity/XML/sp/SignedPartsTest.php create mode 100644 tests/WSSecurity/XML/sp/StrictTest.php create mode 100644 tests/WSSecurity/XML/sp/TripleDesRsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/TripleDesSha256Rsa15Test.php create mode 100644 tests/WSSecurity/XML/sp/TripleDesSha256Test.php create mode 100644 tests/WSSecurity/XML/sp/TripleDesTest.php create mode 100644 tests/WSSecurity/XML/sp/WssGssKerberosV5ApReqToken11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssKerberosV5ApReqToken11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssRelV10Token10Test.php create mode 100644 tests/WSSecurity/XML/sp/WssRelV10Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssRelV20Token10Test.php create mode 100644 tests/WSSecurity/XML/sp/WssRelV20Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssSamlV11Token10Test.php create mode 100644 tests/WSSecurity/XML/sp/WssSamlV11Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssSamlV20Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssUsernameToken10Test.php create mode 100644 tests/WSSecurity/XML/sp/WssUsernameToken11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssX509Pkcs7Token10Test.php create mode 100644 tests/WSSecurity/XML/sp/WssX509Pkcs7Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssX509PkiPathV1Token10Test.php create mode 100644 tests/WSSecurity/XML/sp/WssX509PkiPathV1Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssX509V1Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/WssX509V3Token10Test.php create mode 100644 tests/WSSecurity/XML/sp/WssX509V3Token11Test.php create mode 100644 tests/WSSecurity/XML/sp/XPath10Test.php create mode 100644 tests/WSSecurity/XML/sp/XPathFilter20Test.php create mode 100644 tests/resources/xml/sp_AbsXPath.xml create mode 100644 tests/resources/xml/sp_Attachments.xml create mode 100644 tests/resources/xml/sp_Basic128.xml create mode 100644 tests/resources/xml/sp_Basic128Rsa15.xml create mode 100644 tests/resources/xml/sp_Basic128Sha256.xml create mode 100644 tests/resources/xml/sp_Basic128Sha256Rsa15.xml create mode 100644 tests/resources/xml/sp_Basic192.xml create mode 100644 tests/resources/xml/sp_Basic192Rsa15.xml create mode 100644 tests/resources/xml/sp_Basic192Sha256.xml create mode 100644 tests/resources/xml/sp_Basic192Sha256Rsa15.xml create mode 100644 tests/resources/xml/sp_Basic256.xml create mode 100644 tests/resources/xml/sp_Basic256Rsa15.xml create mode 100644 tests/resources/xml/sp_Basic256Sha256.xml create mode 100644 tests/resources/xml/sp_Basic256Sha256Rsa15.xml create mode 100644 tests/resources/xml/sp_Body.xml create mode 100644 tests/resources/xml/sp_EncryptBeforeSigning.xml create mode 100644 tests/resources/xml/sp_EncryptSignature.xml create mode 100644 tests/resources/xml/sp_EncryptedParts.xml create mode 100644 tests/resources/xml/sp_HashPassword.xml create mode 100644 tests/resources/xml/sp_Header.xml create mode 100644 tests/resources/xml/sp_HttpBasicAuthentication.xml create mode 100644 tests/resources/xml/sp_HttpDigestAuthentication.xml create mode 100644 tests/resources/xml/sp_IncludeTimestamp.xml create mode 100644 tests/resources/xml/sp_InclusiveC14N.xml create mode 100644 tests/resources/xml/sp_Lax.xml create mode 100644 tests/resources/xml/sp_LaxTsFirst.xml create mode 100644 tests/resources/xml/sp_LaxTsLast.xml create mode 100644 tests/resources/xml/sp_MustNotSendAmend.xml create mode 100644 tests/resources/xml/sp_MustNotSendCancel.xml create mode 100644 tests/resources/xml/sp_MustNotSendRenew.xml create mode 100644 tests/resources/xml/sp_MustSupportClientChallenge.xml create mode 100644 tests/resources/xml/sp_MustSupportIssuedTokens.xml create mode 100644 tests/resources/xml/sp_MustSupportRefEmbeddedToken.xml create mode 100644 tests/resources/xml/sp_MustSupportRefEncryptedKey.xml create mode 100644 tests/resources/xml/sp_MustSupportRefExternalURI.xml create mode 100644 tests/resources/xml/sp_MustSupportRefIssuerSerial.xml create mode 100644 tests/resources/xml/sp_MustSupportRefKeyIdentifier.xml create mode 100644 tests/resources/xml/sp_MustSupportRefThumbprint.xml create mode 100644 tests/resources/xml/sp_MustSupportServerChallenge.xml create mode 100644 tests/resources/xml/sp_NoPassword.xml create mode 100644 tests/resources/xml/sp_OnlySignEntireHeadersAndBody.xml create mode 100644 tests/resources/xml/sp_ProtectTokens.xml create mode 100644 tests/resources/xml/sp_RequireAppliesTo.xml create mode 100644 tests/resources/xml/sp_RequireClientCertificate.xml create mode 100644 tests/resources/xml/sp_RequireClientEntropy.xml create mode 100644 tests/resources/xml/sp_RequireDerivedKeys.xml create mode 100644 tests/resources/xml/sp_RequireEmbeddedTokenReference.xml create mode 100644 tests/resources/xml/sp_RequireExplicitDerivedKeys.xml create mode 100644 tests/resources/xml/sp_RequireExternalReference.xml create mode 100644 tests/resources/xml/sp_RequireExternalUriReference.xml create mode 100644 tests/resources/xml/sp_RequireImpliedDerivedKeys.xml create mode 100644 tests/resources/xml/sp_RequireInternalReference.xml create mode 100644 tests/resources/xml/sp_RequireIssuerSerialReference.xml create mode 100644 tests/resources/xml/sp_RequireKeyIdentifierReference.xml create mode 100644 tests/resources/xml/sp_RequireRequestSecurityTokenCollection.xml create mode 100644 tests/resources/xml/sp_RequireServerEntropy.xml create mode 100644 tests/resources/xml/sp_RequireSignatureConfirmation.xml create mode 100644 tests/resources/xml/sp_RequireThumbprintReference.xml create mode 100644 tests/resources/xml/sp_RequiredParts.xml create mode 100644 tests/resources/xml/sp_RsaKeyValue.xml create mode 100644 tests/resources/xml/sp_SC13SecurityContextToken.xml create mode 100644 tests/resources/xml/sp_SOAPNormalization10.xml create mode 100644 tests/resources/xml/sp_STRTransform10.xml create mode 100644 tests/resources/xml/sp_SignedParts.xml create mode 100644 tests/resources/xml/sp_Strict.xml create mode 100644 tests/resources/xml/sp_TripleDes.xml create mode 100644 tests/resources/xml/sp_TripleDesRsa15.xml create mode 100644 tests/resources/xml/sp_TripleDesSha256.xml create mode 100644 tests/resources/xml/sp_TripleDesSha256Rsa15.xml create mode 100644 tests/resources/xml/sp_WssGssKerberosV5ApReqToken11.xml create mode 100644 tests/resources/xml/sp_WssKerberosV5ApReqToken11.xml create mode 100644 tests/resources/xml/sp_WssRelV10Token10.xml create mode 100644 tests/resources/xml/sp_WssRelV10Token11.xml create mode 100644 tests/resources/xml/sp_WssRelV20Token10.xml create mode 100644 tests/resources/xml/sp_WssRelV20Token11.xml create mode 100644 tests/resources/xml/sp_WssSamlV11Token10.xml create mode 100644 tests/resources/xml/sp_WssSamlV11Token11.xml create mode 100644 tests/resources/xml/sp_WssSamlV20Token11.xml create mode 100644 tests/resources/xml/sp_WssUsernameToken10.xml create mode 100644 tests/resources/xml/sp_WssUsernameToken11.xml create mode 100644 tests/resources/xml/sp_WssX509Pkcs7Token10.xml create mode 100644 tests/resources/xml/sp_WssX509Pkcs7Token11.xml create mode 100644 tests/resources/xml/sp_WssX509PkiPathV1Token10.xml create mode 100644 tests/resources/xml/sp_WssX509PkiPathV1Token11.xml create mode 100644 tests/resources/xml/sp_WssX509V1Token11.xml create mode 100644 tests/resources/xml/sp_WssX509V3Token10.xml create mode 100644 tests/resources/xml/sp_WssX509V3Token11.xml create mode 100644 tests/resources/xml/sp_XPath10.xml create mode 100644 tests/resources/xml/sp_XPathFilter20.xml diff --git a/resources/schemas/ws-securitypolicy-1.2.xsd b/resources/schemas/ws-securitypolicy-1.2.xsd index 710acf4b..b52f120d 100644 --- a/resources/schemas/ws-securitypolicy-1.2.xsd +++ b/resources/schemas/ws-securitypolicy-1.2.xsd @@ -29,7 +29,7 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. blockDefault="#all" > + schemaLocation="ws-addr.xsd" /> @@ -109,11 +131,11 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - - - - - + + + + + @@ -1194,7 +1216,7 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - + 10.1 Trust13 Assertion @@ -1202,4 +1224,4 @@ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - \ No newline at end of file + diff --git a/src/Constants.php b/src/Constants.php index 1a84f602..e8e6596a 100644 --- a/src/Constants.php +++ b/src/Constants.php @@ -42,6 +42,11 @@ class Constants extends \SimpleSAML\SAML2\Constants */ public const NS_SEC_EXT = 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd'; + /** + * The namespace for WS Security Policy. + */ + public const NS_SEC_POLICY = 'http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702'; + /** * The namespace for WS-Security utilities protocol. */ diff --git a/src/Utils/XPath.php b/src/Utils/XPath.php new file mode 100644 index 00000000..cba95d16 --- /dev/null +++ b/src/Utils/XPath.php @@ -0,0 +1,41 @@ +registerNamespace('addr', C::NS_ADDR); + $xp->registerNamespace('auth', C::NS_AUTH); + $xp->registerNamespace('fed', C::NS_FED); + $xp->registerNamespace('trust', C::NS_TRUST); + $xp->registerNamespace('policy', C::NS_POLICY); + $xp->registerNamespace('sp', C::NS_SEC_POLICY); + $xp->registerNamespace('wsse', C::NS_SEC_EXT); + $xp->registerNamespace('wsu', C::NS_SEC_UTIL); + + return $xp; + } +} diff --git a/src/XML/sp/AbsXPath.php b/src/XML/sp/AbsXPath.php new file mode 100644 index 00000000..b59ff705 --- /dev/null +++ b/src/XML/sp/AbsXPath.php @@ -0,0 +1,14 @@ +localName, + $qualifiedName, + sprintf('Unexpected name for EmptyType: %s. Expected: %s.', $xml->localName, $qualifiedName), + InvalidDOMElementException::class + ); + + + return new static(); + } + + + /** + * Convert this element to XML. + * + * @param \DOMElement|null $parent The element we should append this element to. + * @return \DOMElement + */ + public function toXML(DOMElement $parent = null): DOMElement + { + return $this->instantiateParentElement($parent); + } +} diff --git a/src/XML/sp/AbstractHeaderType.php b/src/XML/sp/AbstractHeaderType.php new file mode 100644 index 00000000..08d65115 --- /dev/null +++ b/src/XML/sp/AbstractHeaderType.php @@ -0,0 +1,129 @@ + $namespacedAttributes + */ + final public function __construct( + protected string $namespace, + protected ?string $name = null, + array $namespacedAttributes = [] + ) { + Assert::nullOrValidURI($namespace); + Assert::validQName($name); + + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * Collect the value of the Name property. + * + * @return string|null + */ + public function getName(): ?string + { + return $this->name; + } + + + /** + * Collect the value of the Namespace property. + * + * @return string + */ + public function getNamespace(): string + { + return $this->namespace; + } + + + /** + * Initialize an HeaderType. + * + * Note: this method cannot be used when extending this class, if the constructor has a different signature. + * + * @param \DOMElement $xml The XML element we should load. + * @return static + * + * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * if the qualified name of the supplied element is wrong + */ + public static function fromXML(DOMElement $xml): static + { + $qualifiedName = static::getClassName(static::class); + Assert::eq( + $xml->localName, + $qualifiedName, + sprintf('Unexpected name for HeaderType: %s. Expected: %s.', $xml->localName, $qualifiedName), + InvalidDOMElementException::class + ); + + $namespacedAttributes = self::getAttributesNSFromXML($xml); + foreach ($namespacedAttributes as $i => $attr) { + if ($attr->getNamespaceURI() === null) { + if ($attr->getAttrName() === 'Name' || $attr->getAttrName() === 'Namespace') { + unset($namespacedAttributes[$i]); + } + } + } + + return new static( + self::getAttribute($xml, 'Namespace'), + self::getOptionalAttribute($xml, 'Name', null), + $namespacedAttributes, + ); + } + + + /** + * Convert this element to XML. + * + * @param \DOMElement|null $parent The element we should append this element to. + * @return \DOMElement + */ + public function toXML(DOMElement $parent = null): DOMElement + { + $e = $this->instantiateParentElement($parent); + + if ($this->getName() !== null) { + $e->setAttribute('Name', $this->getName()); + } + + $e->setAttribute('Namespace', $this->getNamespace()); + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/sp/AbstractQNameAssertionType.php b/src/XML/sp/AbstractQNameAssertionType.php new file mode 100644 index 00000000..c22c4d6e --- /dev/null +++ b/src/XML/sp/AbstractQNameAssertionType.php @@ -0,0 +1,83 @@ + $namespacedAttributes + */ + final public function __construct( + array $namespacedAttributes = [] + ) { + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * Initialize an QNameAssertionType. + * + * Note: this method cannot be used when extending this class, if the constructor has a different signature. + * + * @param \DOMElement $xml The XML element we should load. + * @return static + * + * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * if the qualified name of the supplied element is wrong + */ + public static function fromXML(DOMElement $xml): static + { + $qualifiedName = static::getClassName(static::class); + Assert::eq( + $xml->localName, + $qualifiedName, + sprintf('Unexpected name for QNameAssertion: %s. Expected: %s.', $xml->localName, $qualifiedName), + InvalidDOMElementException::class + ); + + + return new static(self::getAttributesNSFromXML($xml)); + } + + + /** + * Convert this element to XML. + * + * @param \DOMElement|null $parent The element we should append this element to. + * @return \DOMElement + */ + public function toXML(DOMElement $parent = null): DOMElement + { + $e = $this->instantiateParentElement($parent); + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/sp/AbstractReqPartsType.php b/src/XML/sp/AbstractReqPartsType.php new file mode 100644 index 00000000..65f1ee32 --- /dev/null +++ b/src/XML/sp/AbstractReqPartsType.php @@ -0,0 +1,145 @@ +setElements($details); + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * Collect the Header + * + * @return \SimpleSAML\WSSecurity\XML\sp\Header[] + */ + public function getHeader(): array + { + return $this->header; + } + + + /** + * Test if an object, at the state it's in, would produce an empty XML-element + * + * @return bool + */ + public function isEmptyElement(): bool + { + return empty($this->getElements()) + && empty($this->getHeader()) + && empty($this->getAttributesNS()); + } + + + /** + * Initialize an ReqPartsType. + * + * Note: this method cannot be used when extending this class, if the constructor has a different signature. + * + * @param \DOMElement $xml The XML element we should load. + * @return static + * + * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * if the qualified name of the supplied element is wrong + */ + public static function fromXML(DOMElement $xml): static + { + $qualifiedName = static::getClassName(static::class); + Assert::eq( + $xml->localName, + $qualifiedName, + sprintf('Unexpected name for Empty: %s. Expected: %s.', $xml->localName, $qualifiedName), + InvalidDOMElementException::class + ); + + $header = Header::getChildrenOfClass($xml); + Assert::maxcount($header, 1, TooManyElementsException::class); + + $details = []; + foreach ($xml->childNodes as $detail) { + if (!($detail instanceof DOMElement)) { + continue; + } elseif ($detail->namespaceURI === static::NS) { + continue; + } + + $details[] = new Chunk($detail); + } + + return new static( + $header, + $details, + self::getAttributesNSFromXML($xml), + ); + } + + + /** + * Convert this element to XML. + * + * @param \DOMElement|null $parent The element we should append this element to. + * @return \DOMElement + */ + public function toXML(DOMElement $parent = null): DOMElement + { + $e = $this->instantiateParentElement($parent); + + foreach ($this->getHeader() as $header) { + $header->toXML($e); + } + + foreach ($this->getElements() as $elt) { + /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ + $elt->toXML($e); + } + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/sp/AbstractSePartsType.php b/src/XML/sp/AbstractSePartsType.php new file mode 100644 index 00000000..179cb8c7 --- /dev/null +++ b/src/XML/sp/AbstractSePartsType.php @@ -0,0 +1,187 @@ +setElements($details); + $this->setAttributesNS($namespacedAttributes); + } + + + /** + * Collect the Body + * + * @return \SimpleSAML\WSSecurity\XML\sp\Body|null + */ + public function getBody(): ?Body + { + return $this->body; + } + + + /** + * Collect the Header + * + * @return \SimpleSAML\WSSecurity\XML\sp\Header[] + */ + public function getHeader(): array + { + return $this->header; + } + + + /** + * Collect the Attachments + * + * @return \SimpleSAML\WSSecurity\XML\sp\Attachments|null + */ + public function getAttachments(): ?Attachments + { + return $this->attachments; + } + + + /** + * Test if an object, at the state it's in, would produce an empty XML-element + * + * @return bool + */ + public function isEmptyElement(): bool + { + return empty($this->getElements()) + && empty($this->getBody()) + && empty($this->getHeader()) + && empty($this->getAttachments()) + && empty($this->getAttributesNS()); + } + + + /** + * Initialize an SePartsType. + * + * Note: this method cannot be used when extending this class, if the constructor has a different signature. + * + * @param \DOMElement $xml The XML element we should load. + * @return static + * + * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * if the qualified name of the supplied element is wrong + */ + public static function fromXML(DOMElement $xml): static + { + $qualifiedName = static::getClassName(static::class); + Assert::eq( + $xml->localName, + $qualifiedName, + sprintf('Unexpected name for Empty: %s. Expected: %s.', $xml->localName, $qualifiedName), + InvalidDOMElementException::class + ); + + $body = Body::getChildrenOfClass($xml); + + $header = Header::getChildrenOfClass($xml); + Assert::maxcount($header, 1, TooManyElementsException::class); + + $attachments = Attachments::getChildrenOfClass($xml); + + $details = []; + foreach ($xml->childNodes as $detail) { + if (!($detail instanceof DOMElement)) { + continue; + } elseif ($detail->namespaceURI === static::NS) { + continue; + } + + $details[] = new Chunk($detail); + } + + return new static( + array_pop($body), + $header, + array_pop($attachments), + $details, + self::getAttributesNSFromXML($xml), + ); + } + + + /** + * Convert this element to XML. + * + * @param \DOMElement|null $parent The element we should append this element to. + * @return \DOMElement + */ + public function toXML(DOMElement $parent = null): DOMElement + { + $e = $this->instantiateParentElement($parent); + + if ($this->getBody() !== null) { + $this->getBody()->toXML($e); + } + + foreach ($this->getHeader() as $header) { + $header->toXML($e); + } + + if ($this->getAttachments() !== null) { + $this->getAttachments()->toXML($e); + } + + foreach ($this->getElements() as $elt) { + /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ + $elt->toXML($e); + } + + foreach ($this->getAttributesNS() as $attr) { + $attr->toXML($e); + } + + return $e; + } +} diff --git a/src/XML/sp/AbstractSpElement.php b/src/XML/sp/AbstractSpElement.php new file mode 100644 index 00000000..019b8991 --- /dev/null +++ b/src/XML/sp/AbstractSpElement.php @@ -0,0 +1,22 @@ +includeToken; + } + + + /** + * Set the value of the includeToken-property + * + * @param \SimpleSAML\WSSecurity\XML\sp\IncludeToken|string $includeToken + */ + protected function setIncludeToken(IncludeToken|string $includeToken): void + { + if (is_string($includeToken)) { + Assert::validURI($includeToken); + } + + $this->includeToken = $includeToken; + } +} diff --git a/src/XML/sp/InclusiveC14N.php b/src/XML/sp/InclusiveC14N.php new file mode 100644 index 00000000..1da447f2 --- /dev/null +++ b/src/XML/sp/InclusiveC14N.php @@ -0,0 +1,14 @@ +assertEquals( + static::$xmlRepresentation->saveXML(static::$xmlRepresentation->documentElement), + strval($qns), + ); + } + + + /** + * Test that creating a QNameAssertionType from scratch without attributes works. + */ + public function testMarshallingWithoutNSAttr(): void + { + $xmlRepresentation = clone static::$xmlRepresentation; + $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'attr1'); + $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'ssp'); + + $qns = new static::$testedClass(); + + $this->assertEquals( + $xmlRepresentation->saveXML($xmlRepresentation->documentElement), + strval($qns), + ); + } + + + // test unmarshalling + + + /** + * Test that creating a QNameAssertionType from XML succeeds. + */ + public function testUnmarshalling(): void + { + $qna = static::$testedClass::fromXML(static::$xmlRepresentation->documentElement); + + $this->assertEquals( + static::$xmlRepresentation->saveXML(static::$xmlRepresentation->documentElement), + strval($qna), + ); + } + + + /** + * Test that creating a QNameAssertionType from XML without attributes succeeds. + */ + public function testUnmarshallingWithoutNSAttr(): void + { + $xmlRepresentation = clone static::$xmlRepresentation; + $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'attr1'); + $xmlRepresentation->documentElement->removeAttributeNS(C::NAMESPACE, 'ssp'); + + $qna = static::$testedClass::fromXML($xmlRepresentation->documentElement); + + $this->assertEquals( + $xmlRepresentation->saveXML($xmlRepresentation->documentElement), + strval($qna), + ); + } +} diff --git a/tests/WSSecurity/XML/sp/AttachmentsTest.php b/tests/WSSecurity/XML/sp/AttachmentsTest.php new file mode 100644 index 00000000..cc04f7cc --- /dev/null +++ b/tests/WSSecurity/XML/sp/AttachmentsTest.php @@ -0,0 +1,74 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($attachments), + ); + } + + + // test unmarshalling + + + /** + * Test that creating an Attachments from XML succeeds. + */ + public function testUnmarshalling(): void + { + $attachments = Attachments::fromXML(self::$xmlRepresentation->documentElement); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($attachments), + ); + } +} diff --git a/tests/WSSecurity/XML/sp/Basic128Rsa15Test.php b/tests/WSSecurity/XML/sp/Basic128Rsa15Test.php new file mode 100644 index 00000000..de4eecfa --- /dev/null +++ b/tests/WSSecurity/XML/sp/Basic128Rsa15Test.php @@ -0,0 +1,41 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($body), + ); + } + + + // test unmarshalling + + + /** + * Test that creating a Body from XML succeeds. + */ + public function testUnmarshalling(): void + { + $body = Body::fromXML(self::$xmlRepresentation->documentElement); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($body), + ); + } +} diff --git a/tests/WSSecurity/XML/sp/EncryptBeforeSigningTest.php b/tests/WSSecurity/XML/sp/EncryptBeforeSigningTest.php new file mode 100644 index 00000000..4081f392 --- /dev/null +++ b/tests/WSSecurity/XML/sp/EncryptBeforeSigningTest.php @@ -0,0 +1,41 @@ +some' + )->documentElement); + + $EncryptedParts = new EncryptedParts($body, [$header], $attachments, [$chunk], [$attr]); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($EncryptedParts), + ); + } + + + /** + * Adding an empty EncryptedParts element should yield an empty element. + */ + public function testMarshallingEmptyElement(): void + { + $spns = C::NS_SEC_POLICY; + $encryptedParts = new EncryptedParts(); + $this->assertEquals( + "", + strval($encryptedParts), + ); + $this->assertTrue($encryptedParts->isEmptyElement()); + } + + + /** + */ + public function testMarshallingElementOrdering(): void + { + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $body = new Body(); + $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $attachments = new Attachments(); + $chunk = new Chunk(DOMDocumentFactory::fromString( + 'some' + )->documentElement); + + $EncryptedParts = new EncryptedParts($body, [$header], $attachments, [$chunk], [$attr]); + $EncryptedPartsElement = $EncryptedParts->toXML(); + + // Test for a Body + $xpCache = XPath::getXPath($EncryptedPartsElement); + $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body', $xpCache); + $this->assertCount(1, $EncryptedPartsElements); + + // Test ordering of EncryptedParts contents + /** @psalm-var \DOMElement[] $EncryptedPartsElements */ + $EncryptedPartsElements = XPath::xpQuery($EncryptedPartsElement, './sp:Body/following-sibling::*', $xpCache); + $this->assertCount(3, $EncryptedPartsElements); + $this->assertEquals('sp:Header', $EncryptedPartsElements[0]->tagName); + $this->assertEquals('sp:Attachments', $EncryptedPartsElements[1]->tagName); + $this->assertEquals('ssp:Chunk', $EncryptedPartsElements[2]->tagName); + } + + + // test unmarshalling + + + /** + * Test that creating a EncryptedParts from XML succeeds. + */ + public function testUnmarshalling(): void + { + $EncryptedParts = EncryptedParts::fromXML(self::$xmlRepresentation->documentElement); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($EncryptedParts), + ); + } +} diff --git a/tests/WSSecurity/XML/sp/HashPasswordTest.php b/tests/WSSecurity/XML/sp/HashPasswordTest.php new file mode 100644 index 00000000..7e9df6f0 --- /dev/null +++ b/tests/WSSecurity/XML/sp/HashPasswordTest.php @@ -0,0 +1,41 @@ +assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($header), + ); + } + + + // test unmarshalling + + + /** + * Test that creating a Header from XML succeeds. + */ + public function testUnmarshalling(): void + { + $header = Header::fromXML(self::$xmlRepresentation->documentElement); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($header), + ); + } +} diff --git a/tests/WSSecurity/XML/sp/HttpBasicAuthenticationTest.php b/tests/WSSecurity/XML/sp/HttpBasicAuthenticationTest.php new file mode 100644 index 00000000..1d3f3d36 --- /dev/null +++ b/tests/WSSecurity/XML/sp/HttpBasicAuthenticationTest.php @@ -0,0 +1,41 @@ +assertEquals( + "", + strval($requiredParts), + ); + $this->assertTrue($requiredParts->isEmptyElement()); + } + + + /** + */ + public function testMarshallingElementOrdering(): void + { + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $chunk = new Chunk(DOMDocumentFactory::fromString( + 'some' + )->documentElement); + + $RequiredParts = new RequiredParts([$header], [$chunk], [$attr]); + $RequiredPartsElement = $RequiredParts->toXML(); + + // Test for a Header + $xpCache = XPath::getXPath($RequiredPartsElement); + $RequiredPartsElements = XPath::xpQuery($RequiredPartsElement, './sp:Header', $xpCache); + $this->assertCount(1, $RequiredPartsElements); + + // Test ordering of RequiredParts contents + /** @psalm-var \DOMElement[] $RequiredPartsElements */ + $RequiredPartsElements = XPath::xpQuery($RequiredPartsElement, './sp:Header/following-sibling::*', $xpCache); + $this->assertCount(1, $RequiredPartsElements); + $this->assertEquals('ssp:Chunk', $RequiredPartsElements[0]->tagName); + } + + + // test marshalling + + + /** + * Test that creating a RequiredParts from scratch works. + */ + public function testMarshalling(): void + { + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $chunk = new Chunk(DOMDocumentFactory::fromString( + 'some' + )->documentElement); + + $RequiredParts = new RequiredParts([$header], [$chunk], [$attr]); + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($RequiredParts), + ); + } + + + // test unmarshalling + + + /** + * Test that creating a RequiredParts from XML succeeds. + */ + public function testUnmarshalling(): void + { + $RequiredParts = RequiredParts::fromXML(self::$xmlRepresentation->documentElement); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($RequiredParts), + ); + } +} diff --git a/tests/WSSecurity/XML/sp/RsaKeyValueTest.php b/tests/WSSecurity/XML/sp/RsaKeyValueTest.php new file mode 100644 index 00000000..13487625 --- /dev/null +++ b/tests/WSSecurity/XML/sp/RsaKeyValueTest.php @@ -0,0 +1,41 @@ +assertEquals( + "", + strval($signedParts), + ); + $this->assertTrue($signedParts->isEmptyElement()); + } + + + // test marshalling + + + /** + * Test that creating a SignedParts from scratch works. + */ + public function testMarshalling(): void + { + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $body = new Body(); + $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $attachments = new Attachments(); + $chunk = new Chunk(DOMDocumentFactory::fromString( + 'some' + )->documentElement); + + $signedParts = new SignedParts($body, [$header], $attachments, [$chunk], [$attr]); + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($signedParts), + ); + } + + + /** + */ + public function testMarshallingElementOrdering(): void + { + $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $body = new Body(); + $header = new Header('urn:x-simplesamlphp:namespace', 'ssp:name', [$attr]); + $attachments = new Attachments(); + $chunk = new Chunk(DOMDocumentFactory::fromString( + 'some' + )->documentElement); + + $SignedParts = new SignedParts($body, [$header], $attachments, [$chunk], [$attr]); + $SignedPartsElement = $SignedParts->toXML(); + + // Test for a Body + $xpCache = XPath::getXPath($SignedPartsElement); + $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body', $xpCache); + $this->assertCount(1, $SignedPartsElements); + + // Test ordering of SignedParts contents + /** @psalm-var \DOMElement[] $SignedartsElements */ + $SignedPartsElements = XPath::xpQuery($SignedPartsElement, './sp:Body/following-sibling::*', $xpCache); + $this->assertCount(3, $SignedPartsElements); + $this->assertEquals('sp:Header', $SignedPartsElements[0]->tagName); + $this->assertEquals('sp:Attachments', $SignedPartsElements[1]->tagName); + $this->assertEquals('ssp:Chunk', $SignedPartsElements[2]->tagName); + } + + + + // test unmarshalling + + + /** + * Test that creating a SignedParts from XML succeeds. + */ + public function testUnmarshalling(): void + { + $signedParts = SignedParts::fromXML(self::$xmlRepresentation->documentElement); + + $this->assertEquals( + self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), + strval($signedParts), + ); + } +} diff --git a/tests/WSSecurity/XML/sp/StrictTest.php b/tests/WSSecurity/XML/sp/StrictTest.php new file mode 100644 index 00000000..2c494350 --- /dev/null +++ b/tests/WSSecurity/XML/sp/StrictTest.php @@ -0,0 +1,41 @@ + diff --git a/tests/resources/xml/sp_Attachments.xml b/tests/resources/xml/sp_Attachments.xml new file mode 100644 index 00000000..e0295d5a --- /dev/null +++ b/tests/resources/xml/sp_Attachments.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic128.xml b/tests/resources/xml/sp_Basic128.xml new file mode 100644 index 00000000..a516099e --- /dev/null +++ b/tests/resources/xml/sp_Basic128.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic128Rsa15.xml b/tests/resources/xml/sp_Basic128Rsa15.xml new file mode 100644 index 00000000..b6e72abf --- /dev/null +++ b/tests/resources/xml/sp_Basic128Rsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic128Sha256.xml b/tests/resources/xml/sp_Basic128Sha256.xml new file mode 100644 index 00000000..f64641c1 --- /dev/null +++ b/tests/resources/xml/sp_Basic128Sha256.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic128Sha256Rsa15.xml b/tests/resources/xml/sp_Basic128Sha256Rsa15.xml new file mode 100644 index 00000000..2e695ccd --- /dev/null +++ b/tests/resources/xml/sp_Basic128Sha256Rsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic192.xml b/tests/resources/xml/sp_Basic192.xml new file mode 100644 index 00000000..0ec3907d --- /dev/null +++ b/tests/resources/xml/sp_Basic192.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic192Rsa15.xml b/tests/resources/xml/sp_Basic192Rsa15.xml new file mode 100644 index 00000000..cbd00ca8 --- /dev/null +++ b/tests/resources/xml/sp_Basic192Rsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic192Sha256.xml b/tests/resources/xml/sp_Basic192Sha256.xml new file mode 100644 index 00000000..b4fd83fc --- /dev/null +++ b/tests/resources/xml/sp_Basic192Sha256.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic192Sha256Rsa15.xml b/tests/resources/xml/sp_Basic192Sha256Rsa15.xml new file mode 100644 index 00000000..2bb8128d --- /dev/null +++ b/tests/resources/xml/sp_Basic192Sha256Rsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic256.xml b/tests/resources/xml/sp_Basic256.xml new file mode 100644 index 00000000..6935966b --- /dev/null +++ b/tests/resources/xml/sp_Basic256.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic256Rsa15.xml b/tests/resources/xml/sp_Basic256Rsa15.xml new file mode 100644 index 00000000..224dc72b --- /dev/null +++ b/tests/resources/xml/sp_Basic256Rsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic256Sha256.xml b/tests/resources/xml/sp_Basic256Sha256.xml new file mode 100644 index 00000000..98b17685 --- /dev/null +++ b/tests/resources/xml/sp_Basic256Sha256.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Basic256Sha256Rsa15.xml b/tests/resources/xml/sp_Basic256Sha256Rsa15.xml new file mode 100644 index 00000000..bc0eb105 --- /dev/null +++ b/tests/resources/xml/sp_Basic256Sha256Rsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Body.xml b/tests/resources/xml/sp_Body.xml new file mode 100644 index 00000000..f4468dab --- /dev/null +++ b/tests/resources/xml/sp_Body.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_EncryptBeforeSigning.xml b/tests/resources/xml/sp_EncryptBeforeSigning.xml new file mode 100644 index 00000000..d60d91b2 --- /dev/null +++ b/tests/resources/xml/sp_EncryptBeforeSigning.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_EncryptSignature.xml b/tests/resources/xml/sp_EncryptSignature.xml new file mode 100644 index 00000000..47adcfba --- /dev/null +++ b/tests/resources/xml/sp_EncryptSignature.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_EncryptedParts.xml b/tests/resources/xml/sp_EncryptedParts.xml new file mode 100644 index 00000000..c9ce63b1 --- /dev/null +++ b/tests/resources/xml/sp_EncryptedParts.xml @@ -0,0 +1,6 @@ + + + + + some + diff --git a/tests/resources/xml/sp_HashPassword.xml b/tests/resources/xml/sp_HashPassword.xml new file mode 100644 index 00000000..21955d33 --- /dev/null +++ b/tests/resources/xml/sp_HashPassword.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Header.xml b/tests/resources/xml/sp_Header.xml new file mode 100644 index 00000000..56ef7fc3 --- /dev/null +++ b/tests/resources/xml/sp_Header.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_HttpBasicAuthentication.xml b/tests/resources/xml/sp_HttpBasicAuthentication.xml new file mode 100644 index 00000000..a2f23e02 --- /dev/null +++ b/tests/resources/xml/sp_HttpBasicAuthentication.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_HttpDigestAuthentication.xml b/tests/resources/xml/sp_HttpDigestAuthentication.xml new file mode 100644 index 00000000..fe1c23d8 --- /dev/null +++ b/tests/resources/xml/sp_HttpDigestAuthentication.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_IncludeTimestamp.xml b/tests/resources/xml/sp_IncludeTimestamp.xml new file mode 100644 index 00000000..c41a226e --- /dev/null +++ b/tests/resources/xml/sp_IncludeTimestamp.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_InclusiveC14N.xml b/tests/resources/xml/sp_InclusiveC14N.xml new file mode 100644 index 00000000..6f68710d --- /dev/null +++ b/tests/resources/xml/sp_InclusiveC14N.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_Lax.xml b/tests/resources/xml/sp_Lax.xml new file mode 100644 index 00000000..1451d6e3 --- /dev/null +++ b/tests/resources/xml/sp_Lax.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_LaxTsFirst.xml b/tests/resources/xml/sp_LaxTsFirst.xml new file mode 100644 index 00000000..5ac1257f --- /dev/null +++ b/tests/resources/xml/sp_LaxTsFirst.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_LaxTsLast.xml b/tests/resources/xml/sp_LaxTsLast.xml new file mode 100644 index 00000000..ba086a7a --- /dev/null +++ b/tests/resources/xml/sp_LaxTsLast.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustNotSendAmend.xml b/tests/resources/xml/sp_MustNotSendAmend.xml new file mode 100644 index 00000000..8f6ed888 --- /dev/null +++ b/tests/resources/xml/sp_MustNotSendAmend.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustNotSendCancel.xml b/tests/resources/xml/sp_MustNotSendCancel.xml new file mode 100644 index 00000000..56ef447b --- /dev/null +++ b/tests/resources/xml/sp_MustNotSendCancel.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustNotSendRenew.xml b/tests/resources/xml/sp_MustNotSendRenew.xml new file mode 100644 index 00000000..0372e02d --- /dev/null +++ b/tests/resources/xml/sp_MustNotSendRenew.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportClientChallenge.xml b/tests/resources/xml/sp_MustSupportClientChallenge.xml new file mode 100644 index 00000000..d001e37b --- /dev/null +++ b/tests/resources/xml/sp_MustSupportClientChallenge.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportIssuedTokens.xml b/tests/resources/xml/sp_MustSupportIssuedTokens.xml new file mode 100644 index 00000000..620a74dd --- /dev/null +++ b/tests/resources/xml/sp_MustSupportIssuedTokens.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportRefEmbeddedToken.xml b/tests/resources/xml/sp_MustSupportRefEmbeddedToken.xml new file mode 100644 index 00000000..3bf5cd24 --- /dev/null +++ b/tests/resources/xml/sp_MustSupportRefEmbeddedToken.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportRefEncryptedKey.xml b/tests/resources/xml/sp_MustSupportRefEncryptedKey.xml new file mode 100644 index 00000000..f3c3b3c3 --- /dev/null +++ b/tests/resources/xml/sp_MustSupportRefEncryptedKey.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportRefExternalURI.xml b/tests/resources/xml/sp_MustSupportRefExternalURI.xml new file mode 100644 index 00000000..ef967f97 --- /dev/null +++ b/tests/resources/xml/sp_MustSupportRefExternalURI.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportRefIssuerSerial.xml b/tests/resources/xml/sp_MustSupportRefIssuerSerial.xml new file mode 100644 index 00000000..c0ca665c --- /dev/null +++ b/tests/resources/xml/sp_MustSupportRefIssuerSerial.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportRefKeyIdentifier.xml b/tests/resources/xml/sp_MustSupportRefKeyIdentifier.xml new file mode 100644 index 00000000..a9ef430a --- /dev/null +++ b/tests/resources/xml/sp_MustSupportRefKeyIdentifier.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportRefThumbprint.xml b/tests/resources/xml/sp_MustSupportRefThumbprint.xml new file mode 100644 index 00000000..1a3cbe42 --- /dev/null +++ b/tests/resources/xml/sp_MustSupportRefThumbprint.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_MustSupportServerChallenge.xml b/tests/resources/xml/sp_MustSupportServerChallenge.xml new file mode 100644 index 00000000..be2824fc --- /dev/null +++ b/tests/resources/xml/sp_MustSupportServerChallenge.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_NoPassword.xml b/tests/resources/xml/sp_NoPassword.xml new file mode 100644 index 00000000..5b82ad29 --- /dev/null +++ b/tests/resources/xml/sp_NoPassword.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_OnlySignEntireHeadersAndBody.xml b/tests/resources/xml/sp_OnlySignEntireHeadersAndBody.xml new file mode 100644 index 00000000..492b78ba --- /dev/null +++ b/tests/resources/xml/sp_OnlySignEntireHeadersAndBody.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_ProtectTokens.xml b/tests/resources/xml/sp_ProtectTokens.xml new file mode 100644 index 00000000..a9aa5f05 --- /dev/null +++ b/tests/resources/xml/sp_ProtectTokens.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireAppliesTo.xml b/tests/resources/xml/sp_RequireAppliesTo.xml new file mode 100644 index 00000000..dd3383b2 --- /dev/null +++ b/tests/resources/xml/sp_RequireAppliesTo.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireClientCertificate.xml b/tests/resources/xml/sp_RequireClientCertificate.xml new file mode 100644 index 00000000..dc613fb9 --- /dev/null +++ b/tests/resources/xml/sp_RequireClientCertificate.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireClientEntropy.xml b/tests/resources/xml/sp_RequireClientEntropy.xml new file mode 100644 index 00000000..30a36c1a --- /dev/null +++ b/tests/resources/xml/sp_RequireClientEntropy.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireDerivedKeys.xml b/tests/resources/xml/sp_RequireDerivedKeys.xml new file mode 100644 index 00000000..32be2ec1 --- /dev/null +++ b/tests/resources/xml/sp_RequireDerivedKeys.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireEmbeddedTokenReference.xml b/tests/resources/xml/sp_RequireEmbeddedTokenReference.xml new file mode 100644 index 00000000..feb5a8e4 --- /dev/null +++ b/tests/resources/xml/sp_RequireEmbeddedTokenReference.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireExplicitDerivedKeys.xml b/tests/resources/xml/sp_RequireExplicitDerivedKeys.xml new file mode 100644 index 00000000..27dc75f9 --- /dev/null +++ b/tests/resources/xml/sp_RequireExplicitDerivedKeys.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireExternalReference.xml b/tests/resources/xml/sp_RequireExternalReference.xml new file mode 100644 index 00000000..8c4c0428 --- /dev/null +++ b/tests/resources/xml/sp_RequireExternalReference.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireExternalUriReference.xml b/tests/resources/xml/sp_RequireExternalUriReference.xml new file mode 100644 index 00000000..60bc469c --- /dev/null +++ b/tests/resources/xml/sp_RequireExternalUriReference.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireImpliedDerivedKeys.xml b/tests/resources/xml/sp_RequireImpliedDerivedKeys.xml new file mode 100644 index 00000000..bab75242 --- /dev/null +++ b/tests/resources/xml/sp_RequireImpliedDerivedKeys.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireInternalReference.xml b/tests/resources/xml/sp_RequireInternalReference.xml new file mode 100644 index 00000000..6bf3fbdc --- /dev/null +++ b/tests/resources/xml/sp_RequireInternalReference.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireIssuerSerialReference.xml b/tests/resources/xml/sp_RequireIssuerSerialReference.xml new file mode 100644 index 00000000..59290954 --- /dev/null +++ b/tests/resources/xml/sp_RequireIssuerSerialReference.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireKeyIdentifierReference.xml b/tests/resources/xml/sp_RequireKeyIdentifierReference.xml new file mode 100644 index 00000000..a8da36ca --- /dev/null +++ b/tests/resources/xml/sp_RequireKeyIdentifierReference.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireRequestSecurityTokenCollection.xml b/tests/resources/xml/sp_RequireRequestSecurityTokenCollection.xml new file mode 100644 index 00000000..a6f20f5f --- /dev/null +++ b/tests/resources/xml/sp_RequireRequestSecurityTokenCollection.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireServerEntropy.xml b/tests/resources/xml/sp_RequireServerEntropy.xml new file mode 100644 index 00000000..4c7126e0 --- /dev/null +++ b/tests/resources/xml/sp_RequireServerEntropy.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireSignatureConfirmation.xml b/tests/resources/xml/sp_RequireSignatureConfirmation.xml new file mode 100644 index 00000000..0f5d7599 --- /dev/null +++ b/tests/resources/xml/sp_RequireSignatureConfirmation.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequireThumbprintReference.xml b/tests/resources/xml/sp_RequireThumbprintReference.xml new file mode 100644 index 00000000..29213350 --- /dev/null +++ b/tests/resources/xml/sp_RequireThumbprintReference.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_RequiredParts.xml b/tests/resources/xml/sp_RequiredParts.xml new file mode 100644 index 00000000..45ddb1e9 --- /dev/null +++ b/tests/resources/xml/sp_RequiredParts.xml @@ -0,0 +1,4 @@ + + + some + diff --git a/tests/resources/xml/sp_RsaKeyValue.xml b/tests/resources/xml/sp_RsaKeyValue.xml new file mode 100644 index 00000000..006d390b --- /dev/null +++ b/tests/resources/xml/sp_RsaKeyValue.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_SC13SecurityContextToken.xml b/tests/resources/xml/sp_SC13SecurityContextToken.xml new file mode 100644 index 00000000..66f4cb86 --- /dev/null +++ b/tests/resources/xml/sp_SC13SecurityContextToken.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_SOAPNormalization10.xml b/tests/resources/xml/sp_SOAPNormalization10.xml new file mode 100644 index 00000000..71afddb3 --- /dev/null +++ b/tests/resources/xml/sp_SOAPNormalization10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_STRTransform10.xml b/tests/resources/xml/sp_STRTransform10.xml new file mode 100644 index 00000000..bbd6464d --- /dev/null +++ b/tests/resources/xml/sp_STRTransform10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_SignedParts.xml b/tests/resources/xml/sp_SignedParts.xml new file mode 100644 index 00000000..87c91e57 --- /dev/null +++ b/tests/resources/xml/sp_SignedParts.xml @@ -0,0 +1,6 @@ + + + + + some + diff --git a/tests/resources/xml/sp_Strict.xml b/tests/resources/xml/sp_Strict.xml new file mode 100644 index 00000000..1bf8b550 --- /dev/null +++ b/tests/resources/xml/sp_Strict.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_TripleDes.xml b/tests/resources/xml/sp_TripleDes.xml new file mode 100644 index 00000000..c778ddf0 --- /dev/null +++ b/tests/resources/xml/sp_TripleDes.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_TripleDesRsa15.xml b/tests/resources/xml/sp_TripleDesRsa15.xml new file mode 100644 index 00000000..e65bb6f9 --- /dev/null +++ b/tests/resources/xml/sp_TripleDesRsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_TripleDesSha256.xml b/tests/resources/xml/sp_TripleDesSha256.xml new file mode 100644 index 00000000..5a533112 --- /dev/null +++ b/tests/resources/xml/sp_TripleDesSha256.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_TripleDesSha256Rsa15.xml b/tests/resources/xml/sp_TripleDesSha256Rsa15.xml new file mode 100644 index 00000000..a8352942 --- /dev/null +++ b/tests/resources/xml/sp_TripleDesSha256Rsa15.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssGssKerberosV5ApReqToken11.xml b/tests/resources/xml/sp_WssGssKerberosV5ApReqToken11.xml new file mode 100644 index 00000000..d8b38a2f --- /dev/null +++ b/tests/resources/xml/sp_WssGssKerberosV5ApReqToken11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssKerberosV5ApReqToken11.xml b/tests/resources/xml/sp_WssKerberosV5ApReqToken11.xml new file mode 100644 index 00000000..00f87c2e --- /dev/null +++ b/tests/resources/xml/sp_WssKerberosV5ApReqToken11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssRelV10Token10.xml b/tests/resources/xml/sp_WssRelV10Token10.xml new file mode 100644 index 00000000..0b041bda --- /dev/null +++ b/tests/resources/xml/sp_WssRelV10Token10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssRelV10Token11.xml b/tests/resources/xml/sp_WssRelV10Token11.xml new file mode 100644 index 00000000..b2818f51 --- /dev/null +++ b/tests/resources/xml/sp_WssRelV10Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssRelV20Token10.xml b/tests/resources/xml/sp_WssRelV20Token10.xml new file mode 100644 index 00000000..50d53093 --- /dev/null +++ b/tests/resources/xml/sp_WssRelV20Token10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssRelV20Token11.xml b/tests/resources/xml/sp_WssRelV20Token11.xml new file mode 100644 index 00000000..cc10a513 --- /dev/null +++ b/tests/resources/xml/sp_WssRelV20Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssSamlV11Token10.xml b/tests/resources/xml/sp_WssSamlV11Token10.xml new file mode 100644 index 00000000..a43dc8b0 --- /dev/null +++ b/tests/resources/xml/sp_WssSamlV11Token10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssSamlV11Token11.xml b/tests/resources/xml/sp_WssSamlV11Token11.xml new file mode 100644 index 00000000..6c11f647 --- /dev/null +++ b/tests/resources/xml/sp_WssSamlV11Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssSamlV20Token11.xml b/tests/resources/xml/sp_WssSamlV20Token11.xml new file mode 100644 index 00000000..a5be0604 --- /dev/null +++ b/tests/resources/xml/sp_WssSamlV20Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssUsernameToken10.xml b/tests/resources/xml/sp_WssUsernameToken10.xml new file mode 100644 index 00000000..cb1ecf84 --- /dev/null +++ b/tests/resources/xml/sp_WssUsernameToken10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssUsernameToken11.xml b/tests/resources/xml/sp_WssUsernameToken11.xml new file mode 100644 index 00000000..16aeeff0 --- /dev/null +++ b/tests/resources/xml/sp_WssUsernameToken11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssX509Pkcs7Token10.xml b/tests/resources/xml/sp_WssX509Pkcs7Token10.xml new file mode 100644 index 00000000..e5cb90ca --- /dev/null +++ b/tests/resources/xml/sp_WssX509Pkcs7Token10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssX509Pkcs7Token11.xml b/tests/resources/xml/sp_WssX509Pkcs7Token11.xml new file mode 100644 index 00000000..8e9aa504 --- /dev/null +++ b/tests/resources/xml/sp_WssX509Pkcs7Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssX509PkiPathV1Token10.xml b/tests/resources/xml/sp_WssX509PkiPathV1Token10.xml new file mode 100644 index 00000000..af250e42 --- /dev/null +++ b/tests/resources/xml/sp_WssX509PkiPathV1Token10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssX509PkiPathV1Token11.xml b/tests/resources/xml/sp_WssX509PkiPathV1Token11.xml new file mode 100644 index 00000000..896712c1 --- /dev/null +++ b/tests/resources/xml/sp_WssX509PkiPathV1Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssX509V1Token11.xml b/tests/resources/xml/sp_WssX509V1Token11.xml new file mode 100644 index 00000000..62becc8f --- /dev/null +++ b/tests/resources/xml/sp_WssX509V1Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssX509V3Token10.xml b/tests/resources/xml/sp_WssX509V3Token10.xml new file mode 100644 index 00000000..6931e0a0 --- /dev/null +++ b/tests/resources/xml/sp_WssX509V3Token10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_WssX509V3Token11.xml b/tests/resources/xml/sp_WssX509V3Token11.xml new file mode 100644 index 00000000..f6d56e98 --- /dev/null +++ b/tests/resources/xml/sp_WssX509V3Token11.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_XPath10.xml b/tests/resources/xml/sp_XPath10.xml new file mode 100644 index 00000000..233ab1fd --- /dev/null +++ b/tests/resources/xml/sp_XPath10.xml @@ -0,0 +1 @@ + diff --git a/tests/resources/xml/sp_XPathFilter20.xml b/tests/resources/xml/sp_XPathFilter20.xml new file mode 100644 index 00000000..c871aa27 --- /dev/null +++ b/tests/resources/xml/sp_XPathFilter20.xml @@ -0,0 +1 @@ +