From 8dc71560d24c92cd1052f7e5c0047bbd7f8c5c69 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 27 Feb 2025 21:49:14 +0100 Subject: [PATCH 01/34] Migrate to xsd-types --- .github/workflows/interoperability.yml | 6 + composer.json | 8 +- phpstan-baseline.neon | 211 ------------ phpstan.neon | 2 - src/Assert/Assert.php | 32 +- src/Assert/CIDRTrait.php | 60 ++++ src/Assert/CustomAssertionTrait.php | 84 ----- src/Assert/DomainTrait.php | 38 ++ src/Assert/EntityIDTrait.php | 37 ++ src/Assert/GeolocationTrait.php | 37 ++ src/Assert/SAMLAnyURITrait.php | 32 ++ src/Assert/SAMLDateTimeTrait.php | 33 ++ src/Assert/SAMLStringTrait.php | 35 ++ .../NameIdDecryptionTransformer.php | 2 +- .../ConstraintValidator/NotBefore.php | 19 +- .../ConstraintValidator/NotOnOrAfter.php | 19 +- .../ConstraintValidator/SpIsValidAudience.php | 6 +- .../SubjectConfirmationMethod.php | 4 +- .../SubjectConfirmationNotBefore.php | 8 +- .../SubjectConfirmationNotOnOrAfter.php | 8 +- .../SubjectConfirmationRecipientMatches.php | 14 +- .../SubjectConfirmationResponseToMatches.php | 29 +- src/Binding/HTTPArtifact.php | 2 +- src/Binding/HTTPPost.php | 4 +- src/Binding/HTTPRedirect.php | 11 +- src/Binding/SOAP.php | 20 +- src/Certificate/Key.php | 2 +- src/Certificate/KeyCollection.php | 2 +- src/Certificate/PrivateKeyLoader.php | 3 +- src/Compat/AbstractContainer.php | 73 ++-- src/Compat/ContainerSingleton.php | 2 +- src/Configuration/PrivateKey.php | 2 +- .../DestinationMatches.php | 2 +- .../ConstraintValidator/IsSuccessful.php | 6 +- src/Signature/AbstractChainedValidator.php | 2 +- src/Signature/PublicKeyValidator.php | 2 +- src/Type/CIDRValue.php | 25 ++ src/Type/DomainValue.php | 43 +++ src/Type/EmailAddressValue.php | 43 +++ src/Type/EntityIDValue.php | 37 ++ src/Type/GeolocationValue.php | 41 +++ src/Type/KeyTypesValue.php | 51 +++ src/Type/ListOfStringsValue.php | 79 +++++ src/Type/SAMLAnyURIValue.php | 26 ++ src/Type/SAMLDateTimeValue.php | 31 ++ src/Type/SAMLStringValue.php | 26 ++ src/XML/EncryptedElementTrait.php | 4 +- src/XML/ExtensionPointInterface.php | 18 +- src/XML/ExtensionPointTrait.php | 27 +- src/XML/ExtensionsTrait.php | 14 +- src/XML/IdentifierTrait.php | 7 +- src/XML/SignableElementTrait.php | 41 ++- src/XML/SignedElementTrait.php | 5 +- src/XML/StringElementTrait.php | 40 --- src/XML/URIElementTrait.php | 42 --- src/XML/alg/AbstractAlgElement.php | 1 + src/XML/alg/DigestMethod.php | 20 +- src/XML/alg/SigningMethod.php | 50 ++- src/XML/ecp/RelayState.php | 39 +-- src/XML/ecp/Request.php | 41 +-- src/XML/ecp/RequestAuthenticated.php | 41 +-- src/XML/ecp/Response.php | 35 +- src/XML/ecp/SubjectConfirmation.php | 34 +- src/XML/emd/RepublishRequest.php | 17 +- src/XML/emd/RepublishTarget.php | 34 +- src/XML/idpdisc/DiscoveryResponse.php | 31 +- src/XML/init/RequestInitiator.php | 26 +- src/XML/md/AbstractEndpointType.php | 59 ++-- src/XML/md/AbstractIndexedEndpointType.php | 62 ++-- src/XML/md/AbstractLocalizedName.php | 53 +-- src/XML/md/AbstractLocalizedURI.php | 93 +++-- src/XML/md/AbstractMetadataDocument.php | 87 +++-- src/XML/md/AbstractRoleDescriptor.php | 91 ++--- src/XML/md/AbstractRoleDescriptorType.php | 31 +- src/XML/md/AbstractSSODescriptor.php | 24 +- src/XML/md/AbstractSignedMdElement.php | 9 +- src/XML/md/AdditionalMetadataLocation.php | 47 +-- src/XML/md/AffiliateMember.php | 32 +- src/XML/md/AffiliationDescriptor.php | 49 ++- src/XML/md/ArtifactResolutionService.php | 27 +- src/XML/md/AssertionConsumerService.php | 3 +- src/XML/md/AttributeAuthorityDescriptor.php | 43 +-- src/XML/md/AttributeConsumingService.php | 32 +- src/XML/md/AttributeProfile.php | 18 +- src/XML/md/AttributeService.php | 3 +- src/XML/md/AuthnAuthorityDescriptor.php | 41 +-- src/XML/md/Company.php | 18 +- src/XML/md/ContactPerson.php | 59 ++-- src/XML/md/EmailAddress.php | 77 +---- src/XML/md/EncryptionMethod.php | 3 +- src/XML/md/EntitiesDescriptor.php | 153 ++++++-- src/XML/md/EntityDescriptor.php | 51 ++- src/XML/md/Extensions.php | 31 +- src/XML/md/GivenName.php | 18 +- src/XML/md/IDPSSODescriptor.php | 58 ++-- src/XML/md/IndexedElementTrait.php | 28 +- src/XML/md/KeyDescriptor.php | 47 +-- src/XML/md/KeyTypesEnum.php | 11 + src/XML/md/NameIDFormat.php | 18 +- src/XML/md/NameIDMappingService.php | 19 +- src/XML/md/Organization.php | 13 +- src/XML/md/OrganizationDisplayName.php | 3 +- src/XML/md/OrganizationName.php | 3 +- src/XML/md/OrganizationURL.php | 3 +- src/XML/md/PDPDescriptor.php | 40 +-- src/XML/md/RequestedAttribute.php | 38 +- src/XML/md/SPSSODescriptor.php | 74 ++-- src/XML/md/ServiceDescription.php | 3 +- src/XML/md/ServiceName.php | 3 +- src/XML/md/SingleSignOnService.php | 20 +- src/XML/md/SurName.php | 18 +- src/XML/md/TelephoneNumber.php | 31 +- src/XML/md/UnknownRoleDescriptor.php | 26 +- src/XML/mdattr/EntityAttributes.php | 14 +- src/XML/mdrpi/Publication.php | 77 ++--- src/XML/mdrpi/PublicationInfo.php | 75 ++-- src/XML/mdrpi/PublicationPath.php | 5 +- src/XML/mdrpi/RegistrationInfo.php | 59 ++-- src/XML/mdui/DiscoHints.php | 36 +- src/XML/mdui/DomainHint.php | 58 +--- src/XML/mdui/GeolocationHint.php | 69 +--- src/XML/mdui/IPHint.php | 17 +- src/XML/mdui/Keywords.php | 77 ++--- src/XML/mdui/Logo.php | 96 +++--- src/XML/mdui/UIInfo.php | 33 +- src/XML/saml/AbstractBaseID.php | 55 +-- src/XML/saml/AbstractBaseIDType.php | 15 +- src/XML/saml/AbstractCondition.php | 37 +- src/XML/saml/AbstractStatement.php | 37 +- src/XML/saml/Action.php | 36 +- src/XML/saml/Advice.php | 9 +- src/XML/saml/Assertion.php | 65 ++-- src/XML/saml/AssertionIDRef.php | 36 +- src/XML/saml/AssertionURIRef.php | 18 +- src/XML/saml/Attribute.php | 68 ++-- src/XML/saml/AttributeStatement.php | 5 +- src/XML/saml/AttributeValue.php | 3 +- src/XML/saml/Audience.php | 32 +- src/XML/saml/AudienceRestriction.php | 8 +- src/XML/saml/AuthenticatingAuthority.php | 32 +- src/XML/saml/AuthnContext.php | 12 +- src/XML/saml/AuthnContextClassRef.php | 18 +- src/XML/saml/AuthnContextDecl.php | 14 +- src/XML/saml/AuthnContextDeclRef.php | 17 +- src/XML/saml/AuthnStatement.php | 69 ++-- src/XML/saml/AuthzDecisionStatement.php | 36 +- src/XML/saml/BaseIdentifierInterface.php | 10 +- src/XML/saml/Conditions.php | 62 ++-- src/XML/saml/EncryptedAssertion.php | 4 +- src/XML/saml/EncryptedAttribute.php | 4 +- src/XML/saml/EncryptedID.php | 10 +- src/XML/saml/Evidence.php | 8 +- src/XML/saml/IDNameQualifiersTrait.php | 10 +- src/XML/saml/Issuer.php | 32 +- src/XML/saml/NameID.php | 109 +++--- src/XML/saml/NameIDType.php | 82 ++--- src/XML/saml/OneTimeUse.php | 5 +- src/XML/saml/ProxyRestriction.php | 21 +- src/XML/saml/Subject.php | 8 +- src/XML/saml/SubjectConfirmation.php | 28 +- src/XML/saml/SubjectConfirmationData.php | 134 +++---- src/XML/saml/SubjectLocality.php | 37 +- src/XML/saml/UnknownCondition.php | 5 +- src/XML/saml/UnknownID.php | 14 +- src/XML/saml/UnknownStatement.php | 5 +- src/XML/samlp/AbstractMessage.php | 88 ++--- src/XML/samlp/AbstractStatusResponse.php | 42 +-- src/XML/samlp/AbstractSubjectQuery.php | 28 +- src/XML/samlp/Artifact.php | 41 +-- src/XML/samlp/ArtifactResolve.php | 60 ++-- src/XML/samlp/ArtifactResponse.php | 70 ++-- src/XML/samlp/AssertionIDRequest.php | 63 ++-- src/XML/samlp/AttributeQuery.php | 69 ++-- src/XML/samlp/AuthnQuery.php | 77 ++--- src/XML/samlp/AuthnRequest.php | 157 ++++----- src/XML/samlp/AuthzDecisionQuery.php | 86 ++--- src/XML/samlp/Extensions.php | 5 +- src/XML/samlp/GetComplete.php | 27 +- src/XML/samlp/IDPEntry.php | 62 ++-- src/XML/samlp/IDPList.php | 9 +- src/XML/samlp/LogoutRequest.php | 95 ++--- src/XML/samlp/LogoutResponse.php | 64 ++-- src/XML/samlp/MessageFactory.php | 2 +- src/XML/samlp/NameIDPolicy.php | 64 ++-- src/XML/samlp/RequestedAuthnContext.php | 25 +- src/XML/samlp/RequesterID.php | 26 +- src/XML/samlp/Response.php | 75 ++-- src/XML/samlp/Scoping.php | 25 +- src/XML/samlp/SessionIndex.php | 17 +- src/XML/samlp/Status.php | 12 +- src/XML/samlp/StatusCode.php | 27 +- src/XML/samlp/StatusDetail.php | 6 +- src/XML/samlp/StatusMessage.php | 18 +- src/XML/shibmd/KeyAuthority.php | 23 +- src/XML/shibmd/Scope.php | 38 +- .../EntitiesDescriptorTest.php | 3 + tests/SAML2/Assert/CIDRTest.php | 58 ++++ tests/SAML2/Assert/DomainTest.php | 51 +++ tests/SAML2/Assert/EntityIDTest.php | 10 +- .../{URITest.php => SAMLAnyURITest.php} | 16 +- ...{DateTimeTest.php => SAMLDateTimeTest.php} | 16 +- tests/SAML2/Assert/SAMLStringTest.php | 50 +++ .../NameIdDecryptionTransformerTest.php | 74 ++-- .../Validation/AssertionValidatorTest.php | 26 +- .../ConstraintValidator/NotBeforeTest.php | 54 ++- .../ConstraintValidator/NotOnOrAfterTest.php | 57 ++- .../SessionNotOnOrAfterTest.php | 64 ++-- .../SpIsValidAudienceTest.php | 49 ++- .../SubjectConfirmationMethodTest.php | 12 +- .../SubjectConfirmationNotBeforeTest.php | 39 ++- .../SubjectConfirmationNotOnOrAfterTest.php | 44 ++- ...ubjectConfirmationRecipientMatchesTest.php | 35 +- ...bjectConfirmationResponseToMatchesTest.php | 58 +++- .../SubjectConfirmationValidatorTest.php | 26 +- tests/SAML2/Binding/HTTPArtifactTest.php | 3 +- tests/SAML2/Binding/HTTPPostTest.php | 39 ++- tests/SAML2/Binding/HTTPRedirectTest.php | 66 +++- tests/SAML2/Binding/SOAPTest.php | 19 +- tests/SAML2/BindingTest.php | 3 +- tests/SAML2/CustomBaseID.php | 35 +- tests/SAML2/CustomCondition.php | 12 +- tests/SAML2/CustomRoleDescriptor.php | 97 +++--- tests/SAML2/CustomStatement.php | 12 +- .../DestinationMatchesTest.php | 25 +- .../ConstraintValidator/IsSuccessfulTest.php | 17 +- tests/SAML2/Signature/ValidatorChainTest.php | 31 +- tests/SAML2/Type/EntityIDValueTest.php | 57 +++ tests/SAML2/Type/ListOfStringsValueTest.php | 57 +++ tests/SAML2/Type/SAMLAnyURIValueTest.php | 55 +++ tests/SAML2/Type/SAMLDateTimeValueTest.php | 63 ++++ tests/SAML2/Type/SAMLStringValueTest.php | 48 +++ tests/SAML2/UtilsTest.php | 19 +- tests/SAML2/XML/alg/DigestMethodTest.php | 15 +- tests/SAML2/XML/alg/SigningMethodTest.php | 20 +- tests/SAML2/XML/ecp/RelayStateTest.php | 14 +- .../XML/ecp/RequestAuthenticatedTest.php | 14 +- tests/SAML2/XML/ecp/RequestTest.php | 48 ++- tests/SAML2/XML/ecp/ResponseTest.php | 29 +- .../SAML2/XML/ecp/SubjectConfirmationTest.php | 51 +-- tests/SAML2/XML/emd/RepublishRequestTest.php | 16 +- tests/SAML2/XML/emd/RepublishTargetTest.php | 13 +- .../XML/idpdisc/DiscoveryResponseTest.php | 40 ++- tests/SAML2/XML/init/RequestInitiatorTest.php | 19 +- .../XML/md/AbstractLocalizedNameTest.php | 42 +-- .../XML/md/AdditionalMetadataLocationTest.php | 26 +- tests/SAML2/XML/md/AffiliateMemberTest.php | 41 +-- .../XML/md/AffiliationDescriptorTest.php | 70 ++-- .../XML/md/ArtifactResolutionServiceTest.php | 39 ++- .../XML/md/AssertionConsumerServiceTest.php | 33 +- .../md/AttributeAuthorityDescriptorTest.php | 104 +++--- .../XML/md/AttributeConsumingServiceTest.php | 124 ++++--- tests/SAML2/XML/md/AttributeProfileTest.php | 14 +- .../XML/md/AuthnAuthorityDescriptorTest.php | 89 +++-- tests/SAML2/XML/md/CompanyTest.php | 14 +- tests/SAML2/XML/md/ContactPersonTest.php | 49 ++- tests/SAML2/XML/md/EmailAddressTest.php | 19 +- tests/SAML2/XML/md/EncryptionMethodTest.php | 45 ++- tests/SAML2/XML/md/EndpointTypeTest.php | 67 ++-- tests/SAML2/XML/md/EntitiesDescriptorTest.php | 53 ++- tests/SAML2/XML/md/EntityDescriptorTest.php | 326 ++++++++++-------- tests/SAML2/XML/md/ExtensionsTest.php | 83 +++-- tests/SAML2/XML/md/GivenNameTest.php | 14 +- tests/SAML2/XML/md/IDPSSODescriptorTest.php | 187 +++++----- .../SAML2/XML/md/IndexedEndpointTypeTest.php | 78 +---- tests/SAML2/XML/md/KeyDescriptorTest.php | 58 ++-- tests/SAML2/XML/md/NameIDFormatTest.php | 14 +- .../SAML2/XML/md/NameIDMappingServiceTest.php | 19 +- .../XML/md/OrganizationDisplayNameTest.php | 18 +- tests/SAML2/XML/md/OrganizationNameTest.php | 18 +- tests/SAML2/XML/md/OrganizationTest.php | 49 ++- tests/SAML2/XML/md/OrganizationURLTest.php | 19 +- tests/SAML2/XML/md/PDPDescriptorTest.php | 50 +-- tests/SAML2/XML/md/RequestedAttributeTest.php | 30 +- tests/SAML2/XML/md/RoleDescriptorTest.php | 227 ++++++------ tests/SAML2/XML/md/SPSSODescriptorTest.php | 215 +++++++----- tests/SAML2/XML/md/ServiceDescriptionTest.php | 18 +- tests/SAML2/XML/md/ServiceNameTest.php | 50 +-- .../SAML2/XML/md/SingleSignOnServiceTest.php | 27 +- tests/SAML2/XML/md/SurNameTest.php | 14 +- tests/SAML2/XML/md/TelephoneNumberTest.php | 19 +- .../SAML2/XML/mdattr/EntityAttributesTest.php | 84 +++-- tests/SAML2/XML/mdrpi/PublicationInfoTest.php | 73 +++- tests/SAML2/XML/mdrpi/PublicationPathTest.php | 25 +- tests/SAML2/XML/mdrpi/PublicationTest.php | 22 +- .../SAML2/XML/mdrpi/RegistrationInfoTest.php | 75 ++-- .../XML/mdrpi/RegistrationPolicyTest.php | 19 +- tests/SAML2/XML/mdrpi/UsagePolicyTest.php | 19 +- tests/SAML2/XML/mdui/DescriptionTest.php | 16 +- tests/SAML2/XML/mdui/DiscoHintsTest.php | 59 +++- tests/SAML2/XML/mdui/DisplayNameTest.php | 16 +- tests/SAML2/XML/mdui/DomainHintTest.php | 28 +- tests/SAML2/XML/mdui/GeolocationHintTest.php | 14 +- tests/SAML2/XML/mdui/IPHintTest.php | 14 +- tests/SAML2/XML/mdui/InformationURLTest.php | 17 +- tests/SAML2/XML/mdui/KeywordsTest.php | 42 +-- tests/SAML2/XML/mdui/LogoTest.php | 41 ++- .../XML/mdui/PrivacyStatementURLTest.php | 17 +- tests/SAML2/XML/mdui/UIInfoTest.php | 127 +++++-- tests/SAML2/XML/saml/ActionTest.php | 11 +- tests/SAML2/XML/saml/AdviceTest.php | 23 +- tests/SAML2/XML/saml/AssertionIDRefTest.php | 14 +- tests/SAML2/XML/saml/AssertionTest.php | 307 ++++++++++------- tests/SAML2/XML/saml/AssertionURIRefTest.php | 14 +- .../SAML2/XML/saml/AttributeStatementTest.php | 25 +- tests/SAML2/XML/saml/AttributeTest.php | 28 +- tests/SAML2/XML/saml/AttributeValueTest.php | 10 +- .../XML/saml/AudienceRestrictionTest.php | 19 +- tests/SAML2/XML/saml/AudienceTest.php | 15 +- .../XML/saml/AuthenticatingAuthorityTest.php | 14 +- .../XML/saml/AuthnContextClassRefTest.php | 14 +- .../XML/saml/AuthnContextDeclRefTest.php | 14 +- tests/SAML2/XML/saml/AuthnContextDeclTest.php | 17 +- tests/SAML2/XML/saml/AuthnContextTest.php | 33 +- ...AuthnContextWithClassRefAndDeclRefTest.php | 33 +- .../AuthnContextWithClassRefAndDeclTest.php | 35 +- .../XML/saml/AuthnContextWithClassRefTest.php | 22 +- .../XML/saml/AuthnContextWithDeclRefTest.php | 19 +- .../XML/saml/AuthnContextWithDeclTest.php | 24 +- tests/SAML2/XML/saml/AuthnStatementTest.php | 68 ++-- .../XML/saml/AuthzDecisionStatementTest.php | 31 +- tests/SAML2/XML/saml/BaseIDTest.php | 40 ++- tests/SAML2/XML/saml/ConditionTest.php | 38 +- tests/SAML2/XML/saml/ConditionsTest.php | 37 +- .../SAML2/XML/saml/EncryptedAssertionTest.php | 99 ++++-- .../SAML2/XML/saml/EncryptedAttributeTest.php | 23 +- tests/SAML2/XML/saml/EncryptedIDTest.php | 148 +++++--- tests/SAML2/XML/saml/EvidenceTest.php | 20 +- tests/SAML2/XML/saml/IssuerTest.php | 39 +-- tests/SAML2/XML/saml/NameIDTest.php | 22 +- tests/SAML2/XML/saml/OneTimeUseTest.php | 10 +- tests/SAML2/XML/saml/ProxyRestrictionTest.php | 22 +- tests/SAML2/XML/saml/StatementTest.php | 38 +- .../XML/saml/SubjectConfirmationDataTest.php | 69 ++-- .../XML/saml/SubjectConfirmationTest.php | 73 ++-- tests/SAML2/XML/saml/SubjectLocalityTest.php | 14 +- tests/SAML2/XML/saml/SubjectTest.php | 141 ++++---- tests/SAML2/XML/samlp/AbstractMessageTest.php | 68 ++-- .../XML/samlp/AbstractStatusResponseTest.php | 65 ++-- tests/SAML2/XML/samlp/ArtifactResolveTest.php | 32 +- .../SAML2/XML/samlp/ArtifactResponseTest.php | 63 ++-- tests/SAML2/XML/samlp/ArtifactTest.php | 14 +- .../XML/samlp/AssertionIDRequestTest.php | 36 +- tests/SAML2/XML/samlp/AttributeQueryTest.php | 71 ++-- tests/SAML2/XML/samlp/AuthnQueryTest.php | 47 +-- tests/SAML2/XML/samlp/AuthnRequestTest.php | 200 ++++++----- .../XML/samlp/AuthzDecisionQueryTest.php | 57 +-- tests/SAML2/XML/samlp/ExtensionsTest.php | 12 +- tests/SAML2/XML/samlp/GetCompleteTest.php | 18 +- tests/SAML2/XML/samlp/IDPEntryTest.php | 23 +- tests/SAML2/XML/samlp/IDPListTest.php | 51 ++- tests/SAML2/XML/samlp/LogoutRequestTest.php | 123 ++++--- tests/SAML2/XML/samlp/LogoutResponseTest.php | 43 ++- tests/SAML2/XML/samlp/MessageFactoryTest.php | 22 +- tests/SAML2/XML/samlp/NameIDPolicyTest.php | 20 +- .../XML/samlp/RequestedAuthnContextTest.php | 48 ++- tests/SAML2/XML/samlp/RequesterIDTest.php | 15 +- tests/SAML2/XML/samlp/ResponseTest.php | 50 +-- tests/SAML2/XML/samlp/ScopingTest.php | 66 ++-- tests/SAML2/XML/samlp/SessionIndexTest.php | 14 +- tests/SAML2/XML/samlp/StatusCodeTest.php | 16 +- tests/SAML2/XML/samlp/StatusDetailTest.php | 12 +- tests/SAML2/XML/samlp/StatusMessageTest.php | 14 +- tests/SAML2/XML/samlp/StatusTest.php | 32 +- tests/SAML2/XML/shibmd/KeyAuthorityTest.php | 31 +- tests/SAML2/XML/shibmd/ScopeTest.php | 48 +-- tests/resources/xml/md_Extensions.xml | 4 +- tests/resources/xml/md_RoleDescriptor.xml | 6 +- tests/resources/xml/mdui_Keywords.xml | 2 +- tests/resources/xml/samlp_ArtifactResolve.xml | 4 +- .../resources/xml/samlp_ArtifactResponse.xml | 6 +- .../xml/samlp_AssertionIDRequest.xml | 8 +- tests/resources/xml/samlp_AttributeQuery.xml | 14 +- tests/resources/xml/samlp_AuthnQuery.xml | 8 +- tests/resources/xml/samlp_AuthnRequest.xml | 6 +- .../xml/samlp_AuthzDecisionQuery.xml | 12 +- tests/resources/xml/samlp_LogoutRequest.xml | 6 +- tests/resources/xml/samlp_LogoutResponse.xml | 4 +- tests/resources/xml/samlp_Response.xml | 4 +- 378 files changed, 7643 insertions(+), 6847 deletions(-) delete mode 100644 phpstan-baseline.neon create mode 100644 src/Assert/CIDRTrait.php delete mode 100644 src/Assert/CustomAssertionTrait.php create mode 100644 src/Assert/DomainTrait.php create mode 100644 src/Assert/EntityIDTrait.php create mode 100644 src/Assert/GeolocationTrait.php create mode 100644 src/Assert/SAMLAnyURITrait.php create mode 100644 src/Assert/SAMLDateTimeTrait.php create mode 100644 src/Assert/SAMLStringTrait.php create mode 100644 src/Type/CIDRValue.php create mode 100644 src/Type/DomainValue.php create mode 100644 src/Type/EmailAddressValue.php create mode 100644 src/Type/EntityIDValue.php create mode 100644 src/Type/GeolocationValue.php create mode 100644 src/Type/KeyTypesValue.php create mode 100644 src/Type/ListOfStringsValue.php create mode 100644 src/Type/SAMLAnyURIValue.php create mode 100644 src/Type/SAMLDateTimeValue.php create mode 100644 src/Type/SAMLStringValue.php delete mode 100644 src/XML/StringElementTrait.php delete mode 100644 src/XML/URIElementTrait.php create mode 100644 src/XML/md/KeyTypesEnum.php create mode 100644 tests/SAML2/Assert/CIDRTest.php create mode 100644 tests/SAML2/Assert/DomainTest.php rename tests/SAML2/Assert/{URITest.php => SAMLAnyURITest.php} (78%) rename tests/SAML2/Assert/{DateTimeTest.php => SAMLDateTimeTest.php} (74%) create mode 100644 tests/SAML2/Assert/SAMLStringTest.php create mode 100644 tests/SAML2/Type/EntityIDValueTest.php create mode 100644 tests/SAML2/Type/ListOfStringsValueTest.php create mode 100644 tests/SAML2/Type/SAMLAnyURIValueTest.php create mode 100644 tests/SAML2/Type/SAMLDateTimeValueTest.php create mode 100644 tests/SAML2/Type/SAMLStringValueTest.php diff --git a/.github/workflows/interoperability.yml b/.github/workflows/interoperability.yml index 7d31ebe289..352a6739b5 100644 --- a/.github/workflows/interoperability.yml +++ b/.github/workflows/interoperability.yml @@ -82,6 +82,12 @@ jobs: wget https://mds.edugain.org/edugain-v2.xml -O /tmp/metadata/edugain.xml wget https://technical.edugain.org/mds-v2.cer -O /tmp/metadata/edugain-pub.crt + - name: Download eduID metadata & public key + if: steps.cache-metadata.outputs.cache-hit != 'true' + run: | + mkdir -p /tmp/metadata + wget https://metadata.eduid.cz/entities/eduid -O /tmp/metadata/eduid.xml + wget https://www.eduid.cz/docs/eduid/metadata/metadata.eduid.cz.crt.pem -O /tmp/metadata/eduid.crt - name: Download eduID metadata & public key if: steps.cache-metadata.outputs.cache-hit != 'true' diff --git a/composer.json b/composer.json index 8f95f934b2..fae3bf27fb 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,10 @@ "psr/clock": "~1.0.0", "psr/http-message": "~2.0", "psr/log": "~2.3.1 || ~3.0.0", - "simplesamlphp/assert": "~1.8.1", - "simplesamlphp/xml-common": "~1.25.0", - "simplesamlphp/xml-security": "~1.13.4", - "simplesamlphp/xml-soap": "~1.7.0" + "simplesamlphp/assert": "~1.9.0", + "simplesamlphp/xml-common": "~2.0.2", + "simplesamlphp/xml-security": "~2.0.1", + "simplesamlphp/xml-soap": "~2.0.2" }, "require-dev": { "ext-intl": "*", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon deleted file mode 100644 index 82a9b5cb25..0000000000 --- a/phpstan-baseline.neon +++ /dev/null @@ -1,211 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Call to static method addSign\\(\\) on an unknown class SimpleSAML\\\\Module\\\\saml\\\\Message\\.$#" - count: 1 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" - count: 2 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Store\\\\StoreFactory\\.$#" - count: 1 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Call to static method getMetadataHandler\\(\\) on an unknown class SimpleSAML\\\\Metadata\\\\MetaDataStorageHandler\\.$#" - count: 1 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Instantiated class SimpleSAML\\\\Utils\\\\HTTP not found\\.$#" - count: 1 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:validateSignature\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" - count: 1 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Parameter \\$sp of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:setSPMetadata\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Property SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:\\$spMetadata has unknown class SimpleSAML\\\\Configuration as its type\\.$#" - count: 1 - path: src/Binding/HTTPArtifact.php - - - - message: "#^Access to constant AES128_CBC on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" - count: 1 - path: src/Certificate/PrivateKeyLoader.php - - - - message: "#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" - count: 1 - path: src/Certificate/PrivateKeyLoader.php - - - - message: "#^Instantiated class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey not found\\.$#" - count: 2 - path: src/Certificate/PrivateKeyLoader.php - - - - message: "#^Method SimpleSAML\\\\SAML2\\\\Certificate\\\\PrivateKeyLoader\\:\\:convertPrivateKeyToRsaKey\\(\\) has invalid return type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" - count: 1 - path: src/Certificate/PrivateKeyLoader.php - - - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForDecryptionProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:pluckConfiguration\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Config not found\\.$#" - count: 1 - path: src/SOAPClient.php - - - - message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Crypto not found\\.$#" - count: 1 - path: src/SOAPClient.php - - - - message: "#^Parameter \\$dstMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/SOAPClient.php - - - - message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:validateSSL\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" - count: 1 - path: src/SOAPClient.php - - - - message: "#^Parameter \\$srcMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" - count: 1 - path: src/SOAPClient.php - - - - message: "#^Unsafe usage of new static\\(\\)\\.$#" - count: 2 - path: src/XML/md/AbstractEndpointType.php - - - - message: "#^Unsafe usage of new static\\(\\)\\.$#" - count: 2 - path: src/XML/md/AbstractIndexedEndpointType.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractRoleDescriptor\\)\\:\\:XSI_TYPE_NAME\\.$#" - count: 2 - path: src/XML/md/AbstractRoleDescriptor.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractRoleDescriptor\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#" - count: 2 - path: src/XML/md/AbstractRoleDescriptor.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractRoleDescriptor\\)\\:\\:XSI_TYPE_PREFIX\\.$#" - count: 2 - path: src/XML/md/AbstractRoleDescriptor.php - - - - message: "#^Call to an undefined static method SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractSignedMdElement\\:\\:getXsiTypeNamespaceURI\\(\\)\\.$#" - count: 1 - path: src/XML/md/AbstractSignedMdElement.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractBaseID\\)\\:\\:XSI_TYPE_NAME\\.$#" - count: 2 - path: src/XML/saml/AbstractBaseID.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractBaseID\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#" - count: 2 - path: src/XML/saml/AbstractBaseID.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractBaseID\\)\\:\\:XSI_TYPE_PREFIX\\.$#" - count: 2 - path: src/XML/saml/AbstractBaseID.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractCondition\\)\\:\\:XSI_TYPE_NAME\\.$#" - count: 2 - path: src/XML/saml/AbstractCondition.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractCondition\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#" - count: 2 - path: src/XML/saml/AbstractCondition.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractCondition\\)\\:\\:XSI_TYPE_PREFIX\\.$#" - count: 2 - path: src/XML/saml/AbstractCondition.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractStatement\\)\\:\\:XSI_TYPE_NAME\\.$#" - count: 2 - path: src/XML/saml/AbstractStatement.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractStatement\\)\\:\\:XSI_TYPE_NAMESPACE\\.$#" - count: 2 - path: src/XML/saml/AbstractStatement.php - - - - message: "#^Access to undefined constant static\\(SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\AbstractStatement\\)\\:\\:XSI_TYPE_PREFIX\\.$#" - count: 2 - path: src/XML/saml/AbstractStatement.php - - - - message: "#^Unsafe usage of new static\\(\\)\\.$#" - count: 1 - path: src/XML/saml/Attribute.php - - - - message: "#^Unsafe usage of new static\\(\\)\\.$#" - count: 1 - path: src/XML/saml/EncryptedAttribute.php - - - - message: "#^Unsafe usage of new static\\(\\)\\.$#" - count: 1 - path: src/XML/saml/EncryptedID.php - - - - message: "#^Unsafe usage of new static\\(\\)\\.$#" - count: 1 - path: src/XML/saml/NameIDType.php diff --git a/phpstan.neon b/phpstan.neon index e4c4cf7f5a..21cf5903a3 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,5 +2,3 @@ parameters: level: 1 paths: - src -includes: - - phpstan-baseline.neon diff --git a/src/Assert/Assert.php b/src/Assert/Assert.php index cb166eebe9..a2a30c295b 100644 --- a/src/Assert/Assert.php +++ b/src/Assert/Assert.php @@ -11,21 +11,39 @@ * * @package simplesamlphp/saml2 * - * @method static void validDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void validCIDR(mixed $value, string $message = '', string $exception = '') + * @method static void validDomain(mixed $value, string $message = '', string $exception = '') * @method static void validEntityID(mixed $value, string $message = '', string $exception = '') - * @method static void validURI(mixed $value, string $message = '', string $exception = '') + * @method static void validGeolocation(mixed $value, string $message = '', string $exception = '') * @method static void validRelayState(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrValidDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void validSAMLAnyURI(mixed $value, string $message = '', string $exception = '') + * @method static void validSAMLDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void validSAMLString(mixed $value, string $message = '', string $exception = '') + * @method static void nullOrValidCIDR(mixed $value, string $message = '', string $exception = '') + * @method static void nullOrValidDomain(mixed $value, string $message = '', string $exception = '') * @method static void nullOrValidEntityID(mixed $value, string $message = '', string $exception = '') + * @method static void nullOrValidGeolocation(mixed $value, string $message = '', string $exception = '') * @method static void nullOrValidRelayState(mixed $value, string $message = '', string $exception = '') - * @method static void nullOrValidURI(mixed $value, string $message = '', string $exception = '') - * @method static void allValidDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void nullOrValidSAMLAnyURI(mixed $value, string $message = '', string $exception = '') + * @method static void nullOrValidSAMLDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void nullOrValidSAMLString(mixed $value, string $message = '', string $exception = '') + * @method static void allValidCIDR(mixed $value, string $message = '', string $exception = '') + * @method static void allValidDomain(mixed $value, string $message = '', string $exception = '') * @method static void allValidEntityID(mixed $value, string $message = '', string $exception = '') + * @method static void allValidGeolocation(mixed $value, string $message = '', string $exception = '') * @method static void allValidRelayState(mixed $value, string $message = '', string $exception = '') - * @method static void allValidURI(mixed $value, string $message = '', string $exception = '') + * @method static void allValidSAMLAnyURI(mixed $value, string $message = '', string $exception = '') + * @method static void allValidSAMLDateTime(mixed $value, string $message = '', string $exception = '') + * @method static void allValidSAMLString(mixed $value, string $message = '', string $exception = '') */ class Assert extends BaseAssert { - use CustomAssertionTrait; + use CIDRTrait; + use DomainTrait; + use EntityIDTrait; + use GeolocationTrait; use RelayStateTrait; + use SAMLAnyURITrait; + use SAMLDateTimeTrait; + use SAMLStringTrait; } diff --git a/src/Assert/CIDRTrait.php b/src/Assert/CIDRTrait.php new file mode 100644 index 0000000000..8f9bee2250 --- /dev/null +++ b/src/Assert/CIDRTrait.php @@ -0,0 +1,60 @@ +getMessage()); + } + } +} diff --git a/src/Assert/CustomAssertionTrait.php b/src/Assert/CustomAssertionTrait.php deleted file mode 100644 index d2b676eb53..0000000000 --- a/src/Assert/CustomAssertionTrait.php +++ /dev/null @@ -1,84 +0,0 @@ -getMessage()); - } - } - - - /** - * @param string $value - * @param string $message - */ - protected static function validURI(string $value, string $message = ''): void - { - parent::validURI($value); - - try { - // If it doesn't have a scheme, it's not an absolute URI - parent::regex($value, self::$scheme_regex, $message ?: '%s is not a SAML2-compliant URI'); - } catch (AssertionFailedException $e) { - throw new ProtocolViolationException($e->getMessage()); - } - } - - - /** - * @param string $value - * @param string $message - */ - protected static function validEntityID(string $value, string $message = ''): void - { - static::validURI($value); - - try { - parent::notWhitespaceOnly($value); - parent::maxLength( - $value, - C::ENTITYID_MAX_LENGTH, - sprintf('An entityID cannot be longer than %d characters.', C::ENTITYID_MAX_LENGTH), - ); - } catch (AssertionFailedException $e) { - throw new ProtocolViolationException($e->getMessage()); - } - } -} diff --git a/src/Assert/DomainTrait.php b/src/Assert/DomainTrait.php new file mode 100644 index 0000000000..0d3c3c7527 --- /dev/null +++ b/src/Assert/DomainTrait.php @@ -0,0 +1,38 @@ +getMessage()); + } + } +} diff --git a/src/Assert/EntityIDTrait.php b/src/Assert/EntityIDTrait.php new file mode 100644 index 0000000000..3f10726362 --- /dev/null +++ b/src/Assert/EntityIDTrait.php @@ -0,0 +1,37 @@ +getMessage()); + } + } +} diff --git a/src/Assert/GeolocationTrait.php b/src/Assert/GeolocationTrait.php new file mode 100644 index 0000000000..97f0df63c5 --- /dev/null +++ b/src/Assert/GeolocationTrait.php @@ -0,0 +1,37 @@ +getMessage()); + } + } +} diff --git a/src/Assert/SAMLAnyURITrait.php b/src/Assert/SAMLAnyURITrait.php new file mode 100644 index 0000000000..4f6d39d57d --- /dev/null +++ b/src/Assert/SAMLAnyURITrait.php @@ -0,0 +1,32 @@ +getMessage()); + } + } +} diff --git a/src/Assert/SAMLDateTimeTrait.php b/src/Assert/SAMLDateTimeTrait.php new file mode 100644 index 0000000000..63bda593c8 --- /dev/null +++ b/src/Assert/SAMLDateTimeTrait.php @@ -0,0 +1,33 @@ +getMessage()); + } + } +} diff --git a/src/Assert/SAMLStringTrait.php b/src/Assert/SAMLStringTrait.php new file mode 100644 index 0000000000..7c68e1b11a --- /dev/null +++ b/src/Assert/SAMLStringTrait.php @@ -0,0 +1,35 @@ +getMessage()); + } + } +} diff --git a/src/Assertion/Transformer/NameIdDecryptionTransformer.php b/src/Assertion/Transformer/NameIdDecryptionTransformer.php index 008ca995aa..ab1441ea4e 100644 --- a/src/Assertion/Transformer/NameIdDecryptionTransformer.php +++ b/src/Assertion/Transformer/NameIdDecryptionTransformer.php @@ -6,7 +6,7 @@ use Exception; use Psr\Log\LoggerInterface; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Assertion\Exception\NotDecryptedException; use SimpleSAML\SAML2\Certificate\PrivateKeyLoader; use SimpleSAML\SAML2\Configuration\IdentityProvider; diff --git a/src/Assertion/Validation/ConstraintValidator/NotBefore.php b/src/Assertion/Validation/ConstraintValidator/NotBefore.php index b615463025..807e6b8838 100644 --- a/src/Assertion/Validation/ConstraintValidator/NotBefore.php +++ b/src/Assertion/Validation/ConstraintValidator/NotBefore.php @@ -18,18 +18,13 @@ class NotBefore implements AssertionConstraintValidator */ public function validate(Assertion $assertion, Result $result): void { - $conditions = $assertion->getConditions(); - if ($conditions !== null) { - $notBeforeTimestamp = $conditions->getNotBefore(); - $clock = Utils::getContainer()->getClock(); - if ( - ($notBeforeTimestamp !== null) && - ($notBeforeTimestamp > ($clock->now()->add(new DateInterval('PT60S')))) - ) { - $result->addError( - 'Received an assertion that is valid in the future. Check clock synchronization on IdP and SP.', - ); - } + $notBefore = $assertion->getConditions()?->getNotBefore()?->toDateTime(); + $clock = Utils::getContainer()->getClock(); + + if (($notBefore !== null) && ($notBefore > ($clock->now()->add(new DateInterval('PT60S'))))) { + $result->addError( + 'Received an assertion that is valid in the future. Check clock synchronization on IdP and SP.', + ); } } } diff --git a/src/Assertion/Validation/ConstraintValidator/NotOnOrAfter.php b/src/Assertion/Validation/ConstraintValidator/NotOnOrAfter.php index 29e5fe5d13..f86c0619b2 100644 --- a/src/Assertion/Validation/ConstraintValidator/NotOnOrAfter.php +++ b/src/Assertion/Validation/ConstraintValidator/NotOnOrAfter.php @@ -18,18 +18,13 @@ class NotOnOrAfter implements AssertionConstraintValidator */ public function validate(Assertion $assertion, Result $result): void { - $conditions = $assertion->getConditions(); - if ($conditions !== null) { - $notValidOnOrAfterTimestamp = $conditions->getNotOnOrAfter(); - $clock = Utils::getContainer()->getClock(); - if ( - ($notValidOnOrAfterTimestamp !== null) && - ($notValidOnOrAfterTimestamp <= ($clock->now()->sub(new DateInterval('PT60S')))) - ) { - $result->addError( - 'Received an assertion that has expired. Check clock synchronization on IdP and SP.', - ); - } + $notOnOrAfter = $assertion->getConditions()?->getNotOnOrAfter()?->toDateTime(); + $clock = Utils::getContainer()->getClock(); + + if (($notOnOrAfter !== null) && ($notOnOrAfter <= ($clock->now()->sub(new DateInterval('PT60S'))))) { + $result->addError( + 'Received an assertion that has expired. Check clock synchronization on IdP and SP.', + ); } } } diff --git a/src/Assertion/Validation/ConstraintValidator/SpIsValidAudience.php b/src/Assertion/Validation/ConstraintValidator/SpIsValidAudience.php index 503d5a2a47..1fdedd8312 100644 --- a/src/Assertion/Validation/ConstraintValidator/SpIsValidAudience.php +++ b/src/Assertion/Validation/ConstraintValidator/SpIsValidAudience.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Assertion\Validation\AssertionConstraintValidator; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Configuration\ServiceProvider; @@ -60,10 +60,10 @@ public function validate(Assertion $assertion, Result $result): void foreach ($audienceRestrictions as $audienceRestriction) { $audiences = $audienceRestriction->getAudience(); foreach ($audiences as $audience) { - if ($entityId === $audience->getContent()) { + if ($entityId === $audience->getContent()->getValue()) { return; } - $all[] = $audience->getContent(); + $all[] = $audience->getContent()->getValue(); } } diff --git a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethod.php b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethod.php index 7252258b64..9d427a76a0 100644 --- a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethod.php +++ b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethod.php @@ -21,9 +21,9 @@ public function validate( SubjectConfirmation $subjectConfirmation, Result $result, ): void { - if ($subjectConfirmation->getMethod() !== C::CM_BEARER) { + if ($subjectConfirmation->getMethod()->getValue() !== C::CM_BEARER) { $result->addError(sprintf( - 'Invalid Method on SubjectConfirmation, current;y only Bearer (%s) is supported', + 'Invalid Method on SubjectConfirmation, currently only Bearer (%s) is supported', C::CM_BEARER, )); } diff --git a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBefore.php b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBefore.php index ac92d7d706..1d8f0f21f6 100644 --- a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBefore.php +++ b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBefore.php @@ -5,7 +5,6 @@ namespace SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use SimpleSAML\Assert\Assert; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationConstraintValidator; use SimpleSAML\SAML2\Utils; @@ -23,12 +22,9 @@ public function validate( SubjectConfirmation $subjectConfirmation, Result $result, ): void { - $data = $subjectConfirmation->getSubjectConfirmationData(); - Assert::notNull($data); - - /** @psalm-suppress PossiblyNullReference */ - $notBefore = $data->getNotBefore(); + $notBefore = $subjectConfirmation->getSubjectConfirmationData()?->getNotBefore()?->toDateTime(); $clock = Utils::getContainer()->getClock(); + if ($notBefore !== null && $notBefore > ($clock->now()->add(new DateInterval('PT60S')))) { $result->addError('NotBefore in SubjectConfirmationData is in the future'); } diff --git a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfter.php b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfter.php index bd3d850253..f7dfb346f7 100644 --- a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfter.php +++ b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfter.php @@ -5,7 +5,6 @@ namespace SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use SimpleSAML\Assert\Assert; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationConstraintValidator; use SimpleSAML\SAML2\Utils; @@ -23,12 +22,9 @@ public function validate( SubjectConfirmation $subjectConfirmation, Result $result, ): void { - $data = $subjectConfirmation->getSubjectConfirmationData(); - Assert::notNull($data); - - /** @psalm-suppress PossiblyNullReference */ - $notOnOrAfter = $data->getNotOnOrAfter(); + $notOnOrAfter = $subjectConfirmation->getSubjectConfirmationData()?->getNotOnOrAfter()?->toDateTime(); $clock = Utils::getContainer()->getClock(); + if ($notOnOrAfter !== null && $notOnOrAfter <= ($clock->now()->sub(new DateInterval('PT60S')))) { $result->addError('NotOnOrAfter in SubjectConfirmationData is in the past'); } diff --git a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php index 358ba5e4aa..5a74a25510 100644 --- a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php +++ b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php @@ -4,14 +4,11 @@ namespace SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assertion\Validation\Result; -use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationConstraintValidator; +use SimpleSAML\SAML2\Assertion\Validation\{Result, SubjectConfirmationConstraintValidator}; use SimpleSAML\SAML2\Configuration\Destination; use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; use function sprintf; -use function strval; class SubjectConfirmationRecipientMatches implements SubjectConfirmationConstraintValidator { @@ -33,16 +30,13 @@ public function __construct( */ public function validate(SubjectConfirmation $subjectConfirmation, Result $result): void { - $data = $subjectConfirmation->getSubjectConfirmationData(); - Assert::notNull($data); + $recipient = $subjectConfirmation->getSubjectConfirmationData()?->getRecipient(); - /** @psalm-suppress PossiblyNullReference */ - $recipient = $data->getRecipient(); - if ($recipient && !$this->destination->equals(new Destination($recipient))) { + if ($recipient !== null && !$recipient->equals((string)$this->destination)) { $result->addError(sprintf( 'Recipient in SubjectConfirmationData ("%s") does not match the current destination ("%s")', $recipient, - strval($this->destination), + (string)$this->destination, )); } } diff --git a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php index 5c9463aff1..cf794a031a 100644 --- a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php +++ b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php @@ -4,14 +4,11 @@ namespace SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assertion\Validation\Result; -use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationConstraintValidator; +use SimpleSAML\SAML2\Assertion\Validation\{Result, SubjectConfirmationConstraintValidator}; use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; use SimpleSAML\SAML2\XML\samlp\Response; use function sprintf; -use function strval; class SubjectConfirmationResponseToMatches implements SubjectConfirmationConstraintValidator { @@ -34,31 +31,27 @@ public function __construct( */ public function validate(SubjectConfirmation $subjectConfirmation, Result $result): void { - $data = $subjectConfirmation->getSubjectConfirmationData(); - Assert::notNull($data); + $inResponseTo = $subjectConfirmation->getSubjectConfirmationData()?->getInResponseTo(); - /** @psalm-suppress PossiblyNullReference */ - $inResponseTo = $data->getInResponseTo(); - if ($inResponseTo && ($this->getInResponseTo() !== false) && ($this->getInResponseTo() !== $inResponseTo)) { + if ( + $inResponseTo !== null + && $this->getInResponseTo() !== null + && !$inResponseTo->equals($this->getInResponseTo()) + ) { $result->addError(sprintf( 'InResponseTo in SubjectConfirmationData ("%s") does not match the Response InResponseTo ("%s")', $inResponseTo, - strval($this->getInResponseTo()), + $this->getInResponseTo(), )); } } /** - * @return string|bool + * @return string|null */ - private function getInResponseTo() + private function getInResponseTo(): ?string { - $inResponseTo = $this->response->getInResponseTo(); - if ($inResponseTo === null) { - return false; - } - - return $inResponseTo; + return $this->response->getInResponseTo()?->getValue(); } } diff --git a/src/Binding/HTTPArtifact.php b/src/Binding/HTTPArtifact.php index 7dd64cbf1c..ed8be8d3a3 100644 --- a/src/Binding/HTTPArtifact.php +++ b/src/Binding/HTTPArtifact.php @@ -9,10 +9,10 @@ use Nyholm\Psr7\Response; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use SimpleSAML\Assert\Assert; use SimpleSAML\Configuration; use SimpleSAML\Metadata\MetaDataStorageHandler; use SimpleSAML\Module\saml\Message as MSG; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Binding; use SimpleSAML\SAML2\Binding\RelayStateTrait; use SimpleSAML\SAML2\SOAPClient; diff --git a/src/Binding/HTTPPost.php b/src/Binding/HTTPPost.php index ed96a73ce0..136c913c83 100644 --- a/src/Binding/HTTPPost.php +++ b/src/Binding/HTTPPost.php @@ -8,7 +8,7 @@ use Nyholm\Psr7\Response; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Binding; use SimpleSAML\SAML2\Binding\RelayStateTrait; use SimpleSAML\SAML2\Exception\ProtocolViolationException; @@ -41,7 +41,7 @@ class HTTPPost extends Binding implements AsynchronousBindingInterface, RelaySta public function send(AbstractMessage $message): ResponseInterface { if ($this->destination === null) { - $destination = $message->getDestination(); + $destination = $message->getDestination()?->getValue(); if ($destination === null) { throw new Exception('Cannot send message, no destination set.'); } diff --git a/src/Binding/HTTPRedirect.php b/src/Binding/HTTPRedirect.php index a4b365f14f..cb07d4483d 100644 --- a/src/Binding/HTTPRedirect.php +++ b/src/Binding/HTTPRedirect.php @@ -8,7 +8,7 @@ use Nyholm\Psr7\Response; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Binding; use SimpleSAML\SAML2\Binding\RelayStateTrait; use SimpleSAML\SAML2\Compat\ContainerSingleton; @@ -55,6 +55,8 @@ public function getRedirectURL(AbstractMessage $message): string $destination = $message->getDestination(); if ($destination === null) { throw new Exception('Cannot build a redirect URL, no destination set.'); + } else { + $destination = $destination->getValue(); } } else { $destination = $this->destination; @@ -84,8 +86,11 @@ public function getRedirectURL(AbstractMessage $message): string $signature = $message->getSignature(); if ($signature !== null) { // add the signature - $msg .= '&SigAlg=' . urlencode($signature->getSignedInfo()->getSignatureMethod()->getAlgorithm()); - $msg .= '&Signature=' . urlencode($signature->getSignatureValue()->getContent()); + $signatureMethod = $signature->getSignedInfo()->getSignatureMethod(); + $signatureValue = $signature->getSignatureValue(); + + $msg .= '&SigAlg=' . urlencode($signatureMethod->getAlgorithm()->getValue()); + $msg .= '&Signature=' . urlencode($signatureValue->getContent()->getValue()); } if (str_contains($destination, '?')) { diff --git a/src/Binding/SOAP.php b/src/Binding/SOAP.php index f9b456e40e..dc9bfa4882 100644 --- a/src/Binding/SOAP.php +++ b/src/Binding/SOAP.php @@ -6,21 +6,19 @@ use Exception; use Nyholm\Psr7\Response; -use Psr\Http\Message\ResponseInterface; -use Psr\Http\Message\ServerRequestInterface; +use Psr\Http\Message\{ResponseInterface, ServerRequestInterface}; use SimpleSAML\SAML2\Binding; use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated; -use SimpleSAML\SAML2\XML\ecp\Response as ECPResponse; +use SimpleSAML\SAML2\XML\ecp\{RequestAuthenticated, Response as ECPResponse}; use SimpleSAML\SAML2\XML\samlp\AbstractMessage; use SimpleSAML\SAML2\XML\samlp\MessageFactory; use SimpleSAML\SAML2\XML\samlp\Response as SAML2_Response; use SimpleSAML\SOAP\Utils\XPath; -use SimpleSAML\SOAP\XML\env_200106\Body; -use SimpleSAML\SOAP\XML\env_200106\Envelope; -use SimpleSAML\SOAP\XML\env_200106\Header; +use SimpleSAML\SOAP\XML\env_200106\{Body, Envelope, Header}; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\BooleanValue; use function file_get_contents; @@ -44,13 +42,15 @@ public function getOutputToSend(AbstractMessage $message) // containing another message (e.g. a Response), however in the ECP // profile, this is the Response itself. if ($message instanceof SAML2_Response) { - $requestAuthenticated = new RequestAuthenticated(true); + $requestAuthenticated = new RequestAuthenticated( + BooleanValue::fromBoolean(true), + ); - $destination = $this->destination ?: $message->getDestination(); + $destination = $this->destination ?: $message->getDestination()?->getValue(); if ($destination === null) { throw new Exception('No destination available for SOAP message.'); } - $response = new ECPResponse($destination); + $response = new ECPResponse(SAMLAnyURIValue::fromString($destination)); $header = new Header([$requestAuthenticated, $response]); } diff --git a/src/Certificate/Key.php b/src/Certificate/Key.php index 47aefe883f..486e85d8ae 100644 --- a/src/Certificate/Key.php +++ b/src/Certificate/Key.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\Certificate; use ArrayAccess; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Certificate\Exception\InvalidKeyUsageException; use SimpleSAML\SAML2\Exception\InvalidArgumentException; diff --git a/src/Certificate/KeyCollection.php b/src/Certificate/KeyCollection.php index 8fc8b25263..f5331c3b3e 100644 --- a/src/Certificate/KeyCollection.php +++ b/src/Certificate/KeyCollection.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\Certificate; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Utilities\ArrayCollection; /** diff --git a/src/Certificate/PrivateKeyLoader.php b/src/Certificate/PrivateKeyLoader.php index f8c990eb4f..16af413f0e 100644 --- a/src/Certificate/PrivateKeyLoader.php +++ b/src/Certificate/PrivateKeyLoader.php @@ -7,6 +7,7 @@ use SimpleSAML\SAML2\Certificate\PrivateKey; use SimpleSAML\SAML2\Configuration\DecryptionProvider; use SimpleSAML\SAML2\Configuration\PrivateKey as PrivateKeyConfiguration; +use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utilities\ArrayCollection; use SimpleSAML\SAML2\Utilities\File; use SimpleSAML\XMLSecurity\XMLSecurityKey; @@ -45,7 +46,7 @@ public function loadDecryptionKeys( $senderSharedKey = $identityProvider->getSharedKey(); if ($senderSharedKey !== null) { - $key = new XMLSecurityKey(XMLSecurityKey::AES128_CBC); + $key = new XMLSecurityKey(C::BLOCK_ENC_AES128); $key->loadKey($senderSharedKey); $decryptionKeys->add($key); diff --git a/src/Compat/AbstractContainer.php b/src/Compat/AbstractContainer.php index 9d1d97b06c..ef939af55d 100644 --- a/src/Compat/AbstractContainer.php +++ b/src/Compat/AbstractContainer.php @@ -8,25 +8,23 @@ use Psr\Log\LoggerInterface; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\ExtensionPointInterface; -use SimpleSAML\XML\AbstractElement; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\{AbstractElement, ElementInterface}; +use SimpleSAML\XML\Type\QNameValue; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use function array_key_exists; -use function implode; -use function is_subclass_of; +use function constant; abstract class AbstractContainer { - /** @var string */ - private const XSI_TYPE_PREFIX = ''; - - /** @var array */ protected array $registry = []; + /** @var array */ + protected array $extRegistry = []; + /** @var array|null */ protected ?array $blacklistedEncryptionAlgorithms = [ EncryptionAlgorithmFactory::DEFAULT_BLACKLIST, @@ -47,6 +45,20 @@ public function getBlacklistedEncryptionAlgorithms(): ?array } + /** + * Register a class that can handle a given element. + * + * @param string $class The class name of a class extending AbstractElement + * @psalm-param class-string $class + */ + public function registerElementHandler(string $class): void + { + Assert::subclassOf($class, AbstractElement::class); + $key = '{' . constant($class::NS) . '}' . AbstractElement::getClassName($class); + $this->registry[$key] = $class; + } + + /** * Register a class that can handle given extension points of the standard. * @@ -55,37 +67,29 @@ public function getBlacklistedEncryptionAlgorithms(): ?array */ public function registerExtensionHandler(string $class): void { - Assert::subclassOf($class, AbstractElement::class); - if (is_subclass_of($class, ExtensionPointInterface::class, true)) { - $key = implode(':', [self::XSI_TYPE_PREFIX, $class::getXsiTypeNamespaceURI(), $class::getXsiTypeName()]); - } else { - $className = AbstractElement::getClassName($class); - $key = ($class::NS === null) ? $className : implode(':', [$class::NS, $className]); - } - $this->registry[$key] = $class; + Assert::subclassOf($class, ExtensionPointInterface::class); + $key = '{' . $class::getXsiTypeNamespaceURI() . '}' . $class::getXsiTypeName(); + $this->extRegistry[$key] = $class; } /** - * Search for a class that implements an $element in the given $namespace. + * Search for a class that implements an element in the given $namespace. * * Such classes must have been registered previously by calling registerExtensionHandler(), and they must * extend \SimpleSAML\XML\AbstractElement. * - * @param string|null $namespace The namespace URI for the given element. - * @param string $element The local name of the element. + * @param \SimpleSAML\XML\Type\QNameValue|null $qName The qualified name of the element. * * @return string|null The fully-qualified name of a class extending \SimpleSAML\XML\AbstractElement and * implementing support for the given element, or null if no such class has been registered before. * @psalm-return class-string|null */ - public function getElementHandler(?string $namespace, string $element): ?string + public function getElementHandler(QNameValue $qName): ?string { - Assert::nullOrValidURI($namespace, SchemaViolationException::class); - Assert::validNCName($element, SchemaViolationException::class); - - $key = ($namespace === null) ? $element : implode(':', [$namespace, $element]); + $key = '{' . $qName->getNameSpaceURI()->getValue() . '}' . $qName->getLocalName()->getValue(); if (array_key_exists($key, $this->registry) === true) { + Assert::implementsInterface($this->registry[$key], ElementInterface::class); return $this->registry[$key]; } @@ -97,23 +101,22 @@ public function getElementHandler(?string $namespace, string $element): ?string * Search for a class that implements a custom element type. * * Such classes must have been registered previously by calling registerExtensionHandler(), and they must - * implement \SimpleSAML\SAML2\XML\saml\ExtensionPointInterface. - * - * @param string $type The type of the identifier (xsi:type of a BaseID element). + * implement \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface. * + * @param \SimpleSAML\XML\Type\QNameValue $qName The qualified name of the extension. * @return string|null The fully-qualified name of a class implementing - * \SimpleSAML\SAML2\XML\saml\ExtensionPointInterface or null if no such class has been registered before. + * \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface or null if no such class has been registered before. * @psalm-return class-string|null */ - public function getExtensionHandler(string $type): ?string + public function getExtensionHandler(QNameValue $qName): ?string { - Assert::notEmpty($type, 'Cannot search for identifier handlers with an empty type.'); - $type = implode(':', [self::XSI_TYPE_PREFIX, $type]); - if (!array_key_exists($type, $this->registry)) { - return null; + $key = '{' . $qName->getNameSpaceURI()->getValue() . '}' . $qName->getLocalName()->getValue(); + if (array_key_exists($key, $this->extRegistry) === true) { + Assert::implementsInterface($this->extRegistry[$key], ExtensionPointInterface::class); + return $this->extRegistry[$key]; } - Assert::implementsInterface($this->registry[$type], ExtensionPointInterface::class); - return $this->registry[$type]; + + return null; } diff --git a/src/Compat/ContainerSingleton.php b/src/Compat/ContainerSingleton.php index 1e6f0dae27..06c07d3c07 100644 --- a/src/Compat/ContainerSingleton.php +++ b/src/Compat/ContainerSingleton.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\Compat; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; class ContainerSingleton { diff --git a/src/Configuration/PrivateKey.php b/src/Configuration/PrivateKey.php index 456119303f..1707bbe016 100644 --- a/src/Configuration/PrivateKey.php +++ b/src/Configuration/PrivateKey.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\Configuration; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; /** * Configuration of a private key. diff --git a/src/Response/Validation/ConstraintValidator/DestinationMatches.php b/src/Response/Validation/ConstraintValidator/DestinationMatches.php index 94cd166808..716b4fcf3e 100644 --- a/src/Response/Validation/ConstraintValidator/DestinationMatches.php +++ b/src/Response/Validation/ConstraintValidator/DestinationMatches.php @@ -36,7 +36,7 @@ public function validate(Response $response, Result $result): void if ($destination === null) { throw new Exception('No destination set in the response.'); } - if (!$this->expectedDestination->equals(new Destination($destination))) { + if (!$this->expectedDestination->equals(new Destination($destination->getValue()))) { $result->addError(sprintf( 'Destination in response "%s" does not match the expected destination "%s"', $destination, diff --git a/src/Response/Validation/ConstraintValidator/IsSuccessful.php b/src/Response/Validation/ConstraintValidator/IsSuccessful.php index 23b411ca6c..ec95529ec9 100644 --- a/src/Response/Validation/ConstraintValidator/IsSuccessful.php +++ b/src/Response/Validation/ConstraintValidator/IsSuccessful.php @@ -44,16 +44,16 @@ private function buildMessage(Status $responseStatus): string $codes = $statusCode->getSubCodes(); if (!empty($codes)) { foreach ($codes as $code) { - $subCodes[] = $this->truncateStatus($code->getValue()); + $subCodes[] = $this->truncateStatus($code->getValue()->getValue()); } } $statusMessage = $responseStatus->getStatusMessage(); return sprintf( '%s%s%s', - $this->truncateStatus($statusCode->getValue()), + $this->truncateStatus($statusCode->getValue()->getValue()), $subCodes ? '/' . implode('/', $subCodes) : '', - $statusMessage ? ' ' . $statusMessage->getContent() : '', + $statusMessage ? ' ' . $statusMessage->getContent()->getValue() : '', ); } diff --git a/src/Signature/AbstractChainedValidator.php b/src/Signature/AbstractChainedValidator.php index d2f0fea93e..4e5be4fb1c 100644 --- a/src/Signature/AbstractChainedValidator.php +++ b/src/Signature/AbstractChainedValidator.php @@ -45,7 +45,7 @@ protected function validateElementWithKeys( foreach ($pemCandidates as $index => $candidateKey) { $cert = new X509(PEM::fromString($candidateKey->getCertificate())); $verifier = (new SignatureAlgorithmFactory([]))->getAlgorithm( - $element->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm(), + $element->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(), $cert->getPublicKey(), ); diff --git a/src/Signature/PublicKeyValidator.php b/src/Signature/PublicKeyValidator.php index 9e0bd8d47b..2bc949c999 100644 --- a/src/Signature/PublicKeyValidator.php +++ b/src/Signature/PublicKeyValidator.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\Signature; use Psr\Log\LoggerInterface; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Certificate\Key; use SimpleSAML\SAML2\Certificate\KeyCollection; use SimpleSAML\SAML2\Certificate\KeyLoader; diff --git a/src/Type/CIDRValue.php b/src/Type/CIDRValue.php new file mode 100644 index 0000000000..e129e77ad2 --- /dev/null +++ b/src/Type/CIDRValue.php @@ -0,0 +1,25 @@ +sanitizeValue($value)); + } +} diff --git a/src/Type/DomainValue.php b/src/Type/DomainValue.php new file mode 100644 index 0000000000..687ed37860 --- /dev/null +++ b/src/Type/DomainValue.php @@ -0,0 +1,43 @@ +sanitizeValue($value)); + } +} diff --git a/src/Type/EmailAddressValue.php b/src/Type/EmailAddressValue.php new file mode 100644 index 0000000000..728a69f1d1 --- /dev/null +++ b/src/Type/EmailAddressValue.php @@ -0,0 +1,43 @@ +sanitizeValue($value)); + } +} diff --git a/src/Type/EntityIDValue.php b/src/Type/EntityIDValue.php new file mode 100644 index 0000000000..1d38808fbd --- /dev/null +++ b/src/Type/EntityIDValue.php @@ -0,0 +1,37 @@ +sanitizeValue($value)); + } +} diff --git a/src/Type/GeolocationValue.php b/src/Type/GeolocationValue.php new file mode 100644 index 0000000000..5fb242f543 --- /dev/null +++ b/src/Type/GeolocationValue.php @@ -0,0 +1,41 @@ +sanitizeValue($value)); + } +} diff --git a/src/Type/KeyTypesValue.php b/src/Type/KeyTypesValue.php new file mode 100644 index 0000000000..96e01bc5d4 --- /dev/null +++ b/src/Type/KeyTypesValue.php @@ -0,0 +1,51 @@ +sanitizeValue($value), + array_column(KeyTypesEnum::cases(), 'value'), + SchemaViolationException::class, + ); + } + + + /** + * Convert enum to value type + */ + public static function fromEnum(KeyTypesEnum $use): static + { + return static::fromString($use->value); + } + + + /** + * Convert this value type to enum + */ + public function toEnum(): KeyTypesEnum + { + return KeyTypesEnum::from($this->getValue()); + } +} diff --git a/src/Type/ListOfStringsValue.php b/src/Type/ListOfStringsValue.php new file mode 100644 index 0000000000..f6aa416328 --- /dev/null +++ b/src/Type/ListOfStringsValue.php @@ -0,0 +1,79 @@ +sanitizeValue($value), C::UNBOUNDED_LIMIT); + + Assert::allValidString($strings, SchemaViolationException::class); + } + + + /** + * Convert an array of xs:string items into a mdui:ListOfStrings + * + * @param array<\SimpleSAML\SAML2\Type\StringValue> $keywords + * @return static + */ + public static function fromArray(array $keywords): static + { + Assert::allNotContains($keywords, '+', ProtocolViolationException::class); + + $str = ''; + foreach ($keywords as $keyword) { + $str .= str_replace(' ', '+', $keyword) . ' '; + } + + return new static(trim($str)); + } + + + /** + * Convert this mdui:ListOfStrings to an array of xs:string items + * + * @return array<\SimpleSAML\SAML2\Type\StringValue> + */ + public function toArray(): array + { + $strings = preg_split('/[\s]+/', $this->getValue(), C::UNBOUNDED_LIMIT); + $strings = str_replace('+', ' ', $strings); + + return array_map([SAMLStringValue::class, 'fromString'], $strings); + } +} diff --git a/src/Type/SAMLAnyURIValue.php b/src/Type/SAMLAnyURIValue.php new file mode 100644 index 0000000000..0c41e987e3 --- /dev/null +++ b/src/Type/SAMLAnyURIValue.php @@ -0,0 +1,26 @@ +sanitizeValue($value)); + } +} diff --git a/src/Type/SAMLDateTimeValue.php b/src/Type/SAMLDateTimeValue.php new file mode 100644 index 0000000000..b4aea4405a --- /dev/null +++ b/src/Type/SAMLDateTimeValue.php @@ -0,0 +1,31 @@ +sanitizeValue($value), ProtocolViolationException::class); + } +} diff --git a/src/Type/SAMLStringValue.php b/src/Type/SAMLStringValue.php new file mode 100644 index 0000000000..26e83d84d9 --- /dev/null +++ b/src/Type/SAMLStringValue.php @@ -0,0 +1,26 @@ +sanitizeValue($value)); + } +} diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index 4b582b9d2c..46ef7798b3 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\XML; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\AbstractElement; @@ -43,7 +43,7 @@ public function __construct( * 6.2: The element's Type attribute SHOULD be used and, if it is * present, MUST have the value http://www.w3.org/2001/04/xmlenc#Element. */ - Assert::nullOrSame($encryptedData->getType(), C::XMLENC_ELEMENT); + Assert::nullOrSame($encryptedData->getType()->getValue(), C::XMLENC_ELEMENT); $keyInfo = $this->encryptedData->getKeyInfo(); if ($keyInfo === null) { diff --git a/src/XML/ExtensionPointInterface.php b/src/XML/ExtensionPointInterface.php index b7945f2d32..01a6299b73 100644 --- a/src/XML/ExtensionPointInterface.php +++ b/src/XML/ExtensionPointInterface.php @@ -4,6 +4,8 @@ namespace SimpleSAML\SAML2\XML; +use SimpleSAML\XML\Type\{AnyURIValue, NCNameValue, QNameValue}; + /** * Interface for several extension points objects. * @@ -14,31 +16,31 @@ interface ExtensionPointInterface /** * Get the local name for the element's xsi:type. * - * @return string + * @return \SimpleSAML\XML\Type\NCNameValue */ - public static function getXsiTypeName(): string; + public static function getXsiTypeName(): NCNameValue; /** * Get the namespace for the element's xsi:type. * - * @return string + * @return \SimpleSAML\XML\Type\AnyURIValue */ - public static function getXsiTypeNamespaceURI(): string; + public static function getXsiTypeNamespaceURI(): AnyURIValue; /** * Get the namespace-prefix for the element's xsi:type. * - * @return string + * @return \SimpleSAML\XML\Type\NCNameValue */ - public static function getXsiTypePrefix(): string; + public static function getXsiTypePrefix(): NCNameValue; /** * Return the xsi:type value corresponding this element. * - * @return string + * @return \SimpleSAML\XML\Type\QNameValue */ - public function getXsiType(): string; + public function getXsiType(): QNameValue; } diff --git a/src/XML/ExtensionPointTrait.php b/src/XML/ExtensionPointTrait.php index 3602fb67d3..edd2bdca1c 100644 --- a/src/XML/ExtensionPointTrait.php +++ b/src/XML/ExtensionPointTrait.php @@ -6,7 +6,11 @@ use RuntimeException; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\Type\{AnyURIValue, NCNameValue}; + +use function constant; +use function defined; +use function sprintf; /** * Trait for several extension points objects. @@ -18,9 +22,9 @@ trait ExtensionPointTrait /** * Get the local name for the element's xsi:type. * - * @return string + * @return \SimpleSAML\XML\Type\NCNameValue */ - public static function getXsiTypeName(): string + public static function getXsiTypeName(): NCNameValue { Assert::true( defined('static::XSI_TYPE_NAME'), @@ -29,17 +33,16 @@ public static function getXsiTypeName(): string RuntimeException::class, ); - Assert::validNCName(static::XSI_TYPE_NAME, SchemaViolationException::class); - return static::XSI_TYPE_NAME; + return NCNameValue::fromString(constant('static::XSI_TYPE_NAME')); } /** * Get the namespace for the element's xsi:type. * - * @return string + * @return \SimpleSAML\XML\Type\AnyURIValue */ - public static function getXsiTypeNamespaceURI(): string + public static function getXsiTypeNamespaceURI(): AnyURIValue { Assert::true( defined('static::XSI_TYPE_NAMESPACE'), @@ -48,17 +51,16 @@ public static function getXsiTypeNamespaceURI(): string RuntimeException::class, ); - Assert::validURI(static::XSI_TYPE_NAMESPACE, SchemaViolationException::class); - return static::XSI_TYPE_NAMESPACE; + return AnyURIValue::fromString(constant('static::XSI_TYPE_NAMESPACE')); } /** * Get the namespace-prefix for the element's xsi:type. * - * @return string + * @return \SimpleSAML\XML\Type\NCNameValue */ - public static function getXsiTypePrefix(): string + public static function getXsiTypePrefix(): NCNameValue { Assert::true( defined('static::XSI_TYPE_PREFIX'), @@ -69,7 +71,6 @@ public static function getXsiTypePrefix(): string RuntimeException::class, ); - Assert::validNCName(static::XSI_TYPE_PREFIX, SchemaViolationException::class); - return static::XSI_TYPE_PREFIX; + return NCNameValue::fromString(constant('static::XSI_TYPE_PREFIX')); } } diff --git a/src/XML/ExtensionsTrait.php b/src/XML/ExtensionsTrait.php index 5e9d31a749..42c07ab996 100644 --- a/src/XML/ExtensionsTrait.php +++ b/src/XML/ExtensionsTrait.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\XML; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\ElementInterface; @@ -72,11 +72,11 @@ public function getList(): array */ public function isEmptyElement(): bool { - if (empty($this->extensions)) { + if (empty($this->getList())) { return true; } - foreach ($this->extensions as $extension) { + foreach ($this->getList() as $extension) { if ($extension->isEmptyElement() === false) { return false; } @@ -96,9 +96,11 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - foreach ($this->extensions as $extension) { - if (!$extension->isEmptyElement()) { - $extension->toXML($e); + if (!$this->isEmptyElement()) { + foreach ($this->getList() as $extension) { + if (!$extension->isEmptyElement()) { + $extension->toXML($e); + } } } diff --git a/src/XML/IdentifierTrait.php b/src/XML/IdentifierTrait.php index 3a227a70c5..26d60eadf8 100644 --- a/src/XML/IdentifierTrait.php +++ b/src/XML/IdentifierTrait.php @@ -5,11 +5,8 @@ namespace SimpleSAML\SAML2\XML; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\AbstractBaseID; -use SimpleSAML\SAML2\XML\saml\EncryptedID; -use SimpleSAML\SAML2\XML\saml\IdentifierInterface; -use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, EncryptedID, IdentifierInterface, NameID}; use SimpleSAML\XML\Exception\TooManyElementsException; use function array_pop; diff --git a/src/XML/SignableElementTrait.php b/src/XML/SignableElementTrait.php index 00fda83f0d..98ea8b87d3 100644 --- a/src/XML/SignableElementTrait.php +++ b/src/XML/SignableElementTrait.php @@ -5,22 +5,24 @@ namespace SimpleSAML\SAML2\XML; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\{AnyURIValue, Base64BinaryValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmInterface; use SimpleSAML\XMLSecurity\Constants as C; -use SimpleSAML\XMLSecurity\Exception\RuntimeException; -use SimpleSAML\XMLSecurity\Exception\UnsupportedAlgorithmException; +use SimpleSAML\XMLSecurity\Exception\{RuntimeException, UnsupportedAlgorithmException}; use SimpleSAML\XMLSecurity\Utils\XML; -use SimpleSAML\XMLSecurity\XML\ds\CanonicalizationMethod; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\Signature; -use SimpleSAML\XMLSecurity\XML\ds\SignatureMethod; -use SimpleSAML\XMLSecurity\XML\ds\SignatureValue; -use SimpleSAML\XMLSecurity\XML\ds\SignedInfo; -use SimpleSAML\XMLSecurity\XML\ds\Transform; -use SimpleSAML\XMLSecurity\XML\ds\Transforms; +use SimpleSAML\XMLSecurity\XML\ds\{ + CanonicalizationMethod, + KeyInfo, + Signature, + SignatureMethod, + SignatureValue, + SignedInfo, + Transform, + Transforms, +}; use SimpleSAML\XMLSecurity\XML\SignableElementTrait as BaseSignableElementTrait; use function base64_encode; @@ -105,22 +107,29 @@ protected function doSign(DOMElement $xml): DOMElement * 5.4.1: SAML assertions and protocols MUST use enveloped signatures when * signing assertions and protocol messages */ - new Transform(C::XMLDSIG_ENVELOPED), - new Transform($this->c14nAlg), + new Transform(AnyURIValue::fromString(C::XMLDSIG_ENVELOPED)), + new Transform(AnyURIValue::fromString($this->c14nAlg)), ]); $canonicalDocument = XML::processTransforms($transforms, $xml); $signedInfo = new SignedInfo( - new CanonicalizationMethod($this->c14nAlg), - new SignatureMethod($algorithm), + new CanonicalizationMethod(AnyURIValue::fromString($this->c14nAlg)), + new SignatureMethod(AnyURIValue::fromString($algorithm)), [$this->getReference($digest, $transforms, $xml, $canonicalDocument)], ); $signingData = $signedInfo->canonicalize($this->c14nAlg); $signedData = base64_encode($this->signer->sign($signingData)); - $this->signature = new Signature($signedInfo, new SignatureValue($signedData), $this->keyInfo); + $this->signature = new Signature( + $signedInfo, + new SignatureValue( + Base64BinaryValue::fromString($signedData), + ), + $this->keyInfo, + ); + return DOMDocumentFactory::fromString($canonicalDocument)->documentElement; } diff --git a/src/XML/SignedElementTrait.php b/src/XML/SignedElementTrait.php index dd8cdc0450..ed80fbe3f2 100644 --- a/src/XML/SignedElementTrait.php +++ b/src/XML/SignedElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XMLSecurity\Exception\ReferenceValidationFailedException; @@ -39,9 +39,8 @@ protected function setSignature(Signature $signature): void $reference = array_pop($references); Assert::notNull($reference->getURI(), "URI attribute not found.", ReferenceValidationFailedException::class); - Assert::validURI($reference->getURI(), ReferenceValidationFailedException::class); Assert::startsWith( - $reference->getURI(), + $reference->getURI()->getValue(), '#', "Reference must contain a same-document reference to the ID-attribute of the root element.", ReferenceValidationFailedException::class, diff --git a/src/XML/StringElementTrait.php b/src/XML/StringElementTrait.php deleted file mode 100644 index 9d764b9dcc..0000000000 --- a/src/XML/StringElementTrait.php +++ /dev/null @@ -1,40 +0,0 @@ -setElements($elements); } @@ -47,9 +45,9 @@ public function __construct( /** * Collect the value of the algorithm-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getAlgorithm(): string + public function getAlgorithm(): SAMLAnyURIValue { return $this->algorithm; } @@ -72,7 +70,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, DigestMethod::NS, InvalidDOMElementException::class); return new static( - self::getAttribute($xml, 'Algorithm'), + self::getAttribute($xml, 'Algorithm', SAMLAnyURIValue::class), self::getChildElementsFromXML($xml), ); } @@ -87,7 +85,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Algorithm', $this->getAlgorithm()); + $e->setAttribute('Algorithm', $this->getAlgorithm()->getValue()); foreach ($this->getElements() as $element) { /** @var \SimpleSAML\XML\SerializableElementInterface $element */ diff --git a/src/XML/alg/SigningMethod.php b/src/XML/alg/SigningMethod.php index f454ac3081..38768f7cc6 100644 --- a/src/XML/alg/SigningMethod.php +++ b/src/XML/alg/SigningMethod.php @@ -5,16 +5,14 @@ namespace SimpleSAML\SAML2\XML\alg; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\PositiveIntegerValue; use SimpleSAML\XML\XsNamespace as NS; -use function strval; - /** * Class for handling the alg:SigningMethod element. * @@ -34,21 +32,17 @@ final class SigningMethod extends AbstractAlgElement implements SchemaValidatabl /** * Create/parse an alg:SigningMethod element. * - * @param string $algorithm - * @param int|null $minKeySize - * @param int|null $maxKeySize + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $algorithm + * @param \SimpleSAML\XML\Type\PositiveIntegerValue|null $minKeySize + * @param \SimpleSAML\XML\Type\PositiveIntegerValue|null $maxKeySize * @param \SimpleSAML\XML\Chunk[] $elements */ public function __construct( - protected string $algorithm, - protected ?int $minKeySize = null, - protected ?int $maxKeySize = null, + protected SAMLAnyURIValue $algorithm, + protected ?PositiveIntegerValue $minKeySize = null, + protected ?PositiveIntegerValue $maxKeySize = null, array $elements = [], ) { - SAMLAssert::validURI($algorithm); - Assert::nullOrPositiveInteger($minKeySize); - Assert::nullOrPositiveInteger($maxKeySize); - $this->setElements($elements); } @@ -56,9 +50,9 @@ public function __construct( /** * Collect the value of the Algorithm-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getAlgorithm(): string + public function getAlgorithm(): SAMLAnyURIValue { return $this->algorithm; } @@ -67,9 +61,9 @@ public function getAlgorithm(): string /** * Collect the value of the MinKeySize-property * - * @return int|null + * @return \SimpleSAML\XML\Type\PositiveIntegerValue|null */ - public function getMinKeySize(): ?int + public function getMinKeySize(): ?PositiveIntegerValue { return $this->minKeySize; } @@ -78,9 +72,9 @@ public function getMinKeySize(): ?int /** * Collect the value of the MaxKeySize-property * - * @return int|null + * @return \SimpleSAML\XML\Type\PositiveIntegerValue|null */ - public function getMaxKeySize(): ?int + public function getMaxKeySize(): ?PositiveIntegerValue { return $this->maxKeySize; } @@ -103,9 +97,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, SigningMethod::NS, InvalidDOMElementException::class); return new static( - self::getAttribute($xml, 'Algorithm'), - self::getOptionalIntegerAttribute($xml, 'MinKeySize', null), - self::getOptionalIntegerAttribute($xml, 'MaxKeySize', null), + self::getAttribute($xml, 'Algorithm', SAMLAnyURIValue::class), + self::getOptionalAttribute($xml, 'MinKeySize', PositiveIntegerValue::class, null), + self::getOptionalAttribute($xml, 'MaxKeySize', PositiveIntegerValue::class, null), self::getChildElementsFromXML($xml), ); } @@ -121,14 +115,14 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Algorithm', $this->getAlgorithm()); + $e->setAttribute('Algorithm', $this->getAlgorithm()->getValue()); if ($this->getMinKeySize() !== null) { - $e->setAttribute('MinKeySize', strval($this->getMinKeySize())); + $e->setAttribute('MinKeySize', $this->getMinKeySize()->getValue()); } if ($this->getMaxKeySize() !== null) { - $e->setAttribute('MaxKeySize', strval($this->getMaxKeySize())); + $e->setAttribute('MaxKeySize', $this->getMaxKeySize()->getValue()); } /** @var \SimpleSAML\XML\SerializableElementInterface $element */ diff --git a/src/XML/ecp/RelayState.php b/src/XML/ecp/RelayState.php index 0f0f518ee7..daae01402a 100644 --- a/src/XML/ecp/RelayState.php +++ b/src/XML/ecp/RelayState.php @@ -5,14 +5,13 @@ namespace SimpleSAML\SAML2\XML\ecp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\StringElementTrait; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing the ECP RelayState element. @@ -22,19 +21,10 @@ final class RelayState extends AbstractEcpElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * Create a ECP RelayState element. - * - * @param string $relayState - */ - public function __construct( - string $relayState, - ) { - $this->setContent($relayState); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; /** @@ -65,23 +55,23 @@ public static function fromXML(DOMElement $xml): static MissingAttributeException::class, ); - $mustUnderstand = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'); Assert::same( - $mustUnderstand, + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), '1', 'Invalid value of env:mustUnderstand attribute in .', ProtocolViolationException::class, ); - $actor = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'); Assert::same( - $actor, + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, ); - return new static($xml->textContent); + return new static( + SAMLStringValue::fromString($xml->textContent), + ); } @@ -94,9 +84,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); + $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', '1'); $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); - $e->textContent = $this->getContent(); + $e->textContent = $this->getContent()->getValue(); return $e; } diff --git a/src/XML/ecp/Request.php b/src/XML/ecp/Request.php index f73566819a..b822c05b3e 100644 --- a/src/XML/ecp/Request.php +++ b/src/XML/ecp/Request.php @@ -5,16 +5,15 @@ namespace SimpleSAML\SAML2\XML\ecp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\IDPList; use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\BooleanValue; use function intval; use function strval; @@ -34,14 +33,14 @@ final class Request extends AbstractEcpElement implements SchemaValidatableEleme * * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer * @param \SimpleSAML\SAML2\XML\samlp\IDPList|null $idpList - * @param string|null $providerName - * @param bool|null $isPassive + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $providerName + * @param \SimpleSAML\XML\Type\BooleanValue|null $isPassive */ public function __construct( protected Issuer $issuer, protected ?IDPList $idpList = null, - protected ?string $providerName = null, - protected ?bool $isPassive = null, + protected ?SAMLStringValue $providerName = null, + protected ?BooleanValue $isPassive = null, ) { } @@ -49,9 +48,9 @@ public function __construct( /** * Collect the value of the isPassive-property * - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function getIsPassive(): ?bool + public function getIsPassive(): ?BooleanValue { return $this->isPassive; } @@ -60,9 +59,9 @@ public function getIsPassive(): ?bool /** * Collect the value of the providerName-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getProviderName(): ?string + public function getProviderName(): ?SAMLStringValue { return $this->providerName; } @@ -118,17 +117,15 @@ public static function fromXML(DOMElement $xml): static MissingAttributeException::class, ); - $mustUnderstand = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'); Assert::same( - $mustUnderstand, + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), '1', 'Invalid value of env:mustUnderstand attribute in .', ProtocolViolationException::class, ); - $actor = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'); Assert::same( - $actor, + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, @@ -147,8 +144,8 @@ public static function fromXML(DOMElement $xml): static return new static( array_pop($issuer), array_pop($idpList), - self::getOptionalAttribute($xml, 'ProviderName', null), - self::getOptionalBooleanAttribute($xml, 'IsPassive', null), + self::getOptionalAttribute($xml, 'ProviderName', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'IsPassive', BooleanValue::class, null), ); } @@ -166,11 +163,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); if ($this->getProviderName() !== null) { - $e->setAttribute('ProviderName', $this->getProviderName()); + $e->setAttribute('ProviderName', $this->getProviderName()->getValue()); } if ($this->getIsPassive() !== null) { - $e->setAttribute('IsPassive', strval(intval($this->getIsPassive()))); + $e->setAttribute('IsPassive', strval(intval($this->getIsPassive()->toBoolean()))); } $this->getIssuer()->toXML($e); diff --git a/src/XML/ecp/RequestAuthenticated.php b/src/XML/ecp/RequestAuthenticated.php index 7e8cc682ac..b1874de67f 100644 --- a/src/XML/ecp/RequestAuthenticated.php +++ b/src/XML/ecp/RequestAuthenticated.php @@ -5,15 +5,14 @@ namespace SimpleSAML\SAML2\XML\ecp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\BooleanValue; -use function boolval; +use function intval; use function strval; /** @@ -29,10 +28,10 @@ final class RequestAuthenticated extends AbstractEcpElement implements SchemaVal /** * Create a ECP RequestAuthenticated element. * - * @param bool|null $mustUnderstand + * @param \SimpleSAML\XML\Type\BooleanValue|null $mustUnderstand */ public function __construct( - protected ?bool $mustUnderstand = false, + protected ?BooleanValue $mustUnderstand, ) { } @@ -40,9 +39,9 @@ public function __construct( /** * Collect the value of the mustUnderstand-property * - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function getMustUnderstand(): ?bool + public function getMustUnderstand(): ?BooleanValue { return $this->mustUnderstand; } @@ -73,22 +72,12 @@ public static function fromXML(DOMElement $xml): static $mustUnderstand = null; if ($xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand')) { - $mustUnderstand = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'); - - Assert::nullOrOneOf( - $mustUnderstand, - ['0', '1'], - 'Invalid value of env:mustUnderstand attribute in .', - ProtocolViolationException::class, - ); - - $mustUnderstand = boolval($mustUnderstand); + $mustUnderstand = BooleanValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand')); } - $actor = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'); Assert::same( - $actor, - 'http://schemas.xmlsoap.org/soap/actor/next', + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, ); @@ -108,7 +97,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getMustUnderstand() !== null) { - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', strval(intval($this->getMustUnderstand()))); + $e->setAttributeNS( + C::NS_SOAP_ENV_11, + 'env:mustUnderstand', + strval(intval($this->getMustUnderstand()->getValue())), + ); } $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); diff --git a/src/XML/ecp/Response.php b/src/XML/ecp/Response.php index 49f16d719a..2ed7dc57ed 100644 --- a/src/XML/ecp/Response.php +++ b/src/XML/ecp/Response.php @@ -5,14 +5,12 @@ namespace SimpleSAML\SAML2\XML\ecp; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing the ECP Response element. @@ -27,21 +25,20 @@ final class Response extends AbstractEcpElement implements SchemaValidatableElem /** * Create a ECP Response element. * - * @param string $assertionConsumerServiceURL + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $assertionConsumerServiceURL */ public function __construct( - protected string $assertionConsumerServiceURL, + protected SAMLAnyURIValue $assertionConsumerServiceURL, ) { - SAMLAssert::validURI($assertionConsumerServiceURL); } /** * Collect the value of the AssertionConsumerServiceURL-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getAssertionConsumerServiceURL(): string + public function getAssertionConsumerServiceURL(): SAMLAnyURIValue { return $this->assertionConsumerServiceURL; } @@ -80,23 +77,21 @@ public static function fromXML(DOMElement $xml): static MissingAttributeException::class, ); - $mustUnderstand = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'); - $actor = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'); - Assert::same( - $mustUnderstand, + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), '1', 'Invalid value of env:mustUnderstand attribute in .', ProtocolViolationException::class, ); + Assert::same( - $actor, - 'http://schemas.xmlsoap.org/soap/actor/next', + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, ); - return new static(self::getAttribute($xml, 'AssertionConsumerServiceURL')); + return new static(self::getAttribute($xml, 'AssertionConsumerServiceURL', SAMLAnyURIValue::class)); } @@ -111,8 +106,8 @@ public function toXML(?DOMElement $parent = null): DOMElement $response = $this->instantiateParentElement($parent); $response->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', '1'); - $response->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', 'http://schemas.xmlsoap.org/soap/actor/next'); - $response->setAttribute('AssertionConsumerServiceURL', $this->getAssertionConsumerServiceURL()); + $response->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); + $response->setAttribute('AssertionConsumerServiceURL', $this->getAssertionConsumerServiceURL()->getValue()); return $response; } diff --git a/src/XML/ecp/SubjectConfirmation.php b/src/XML/ecp/SubjectConfirmation.php index 5d1ae6e33c..537eb78421 100644 --- a/src/XML/ecp/SubjectConfirmation.php +++ b/src/XML/ecp/SubjectConfirmation.php @@ -5,16 +5,13 @@ namespace SimpleSAML\SAML2\XML\ecp; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing the ECP SubjectConfirmation element. @@ -29,23 +26,22 @@ final class SubjectConfirmation extends AbstractEcpElement implements SchemaVali /** * Create a ECP SubjectConfirmation element. * - * @param string $method + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $method * @param \SimpleSAML\SAML2\XML\saml\SubjectConfirmationData|null $subjectConfirmationData */ public function __construct( - protected string $method, + protected SAMLAnyURIValue $method, protected ?SubjectConfirmationData $subjectConfirmationData = null, ) { - SAMLAssert::validURI($method); } /** * Collect the value of the method-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getMethod(): string + public function getMethod(): SAMLAnyURIValue { return $this->method; } @@ -90,17 +86,15 @@ public static function fromXML(DOMElement $xml): static MissingAttributeException::class, ); - $mustUnderstand = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'); - Assert::same( - $mustUnderstand, - '1', + Assert::oneOf( + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), + ['1', 'true'], 'Invalid value of env:mustUnderstand attribute in .', ProtocolViolationException::class, ); - $actor = $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'); Assert::same( - $actor, + $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, @@ -115,7 +109,7 @@ public static function fromXML(DOMElement $xml): static ); return new static( - self::getAttribute($xml, 'Method'), + self::getAttribute($xml, 'Method', SAMLAnyURIValue::class), array_pop($subjectConfirmationData), ); } @@ -132,7 +126,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', '1'); $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); - $e->setAttribute('Method', $this->getMethod()); + $e->setAttribute('Method', $this->getMethod()->getValue()); $this->getSubjectConfirmationData()?->toXML($e); diff --git a/src/XML/emd/RepublishRequest.php b/src/XML/emd/RepublishRequest.php index 365b013581..2796f6409b 100644 --- a/src/XML/emd/RepublishRequest.php +++ b/src/XML/emd/RepublishRequest.php @@ -5,13 +5,12 @@ namespace SimpleSAML\SAML2\XML\emd; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_pop; @@ -102,7 +101,11 @@ public static function fromArray(array $data): static Assert::keyExists($data, 'RepublishTarget', ArrayValidationException::class); Assert::string($data['RepublishTarget'], ArrayValidationException::class); - return new static(new RepublishTarget($data['RepublishTarget'])); + return new static( + new RepublishTarget( + SAMLAnyURIValue::fromString($data['RepublishTarget']), + ), + ); } @@ -113,6 +116,6 @@ public static function fromArray(array $data): static */ public function toArray(): array { - return ['RepublishTarget' => $this->getRepublishTarget()->getContent()]; + return ['RepublishTarget' => $this->getRepublishTarget()->getContent()->getValue()]; } } diff --git a/src/XML/emd/RepublishTarget.php b/src/XML/emd/RepublishTarget.php index fb40885c2f..d2726223e8 100644 --- a/src/XML/emd/RepublishTarget.php +++ b/src/XML/emd/RepublishTarget.php @@ -4,8 +4,9 @@ namespace SimpleSAML\SAML2\XML\emd; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\URIElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing RepublishTarget. @@ -14,30 +15,19 @@ */ final class RepublishTarget extends AbstractEmdElement { - use URIElementTrait { - URIElementTrait::validateContent as baseValidateContent; - } + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $content */ - protected function validateContent(string $content): void - { - $this->baseValidateContent($content); - Assert::same($content, 'http://edugain.org/'); + public function __construct( + SAMLAnyURIValue $content, + ) { + $this->setContent($content); + Assert::same($content->getValue(), 'http://edugain.org/'); } } diff --git a/src/XML/idpdisc/DiscoveryResponse.php b/src/XML/idpdisc/DiscoveryResponse.php index f23e0bd1c8..0af57be668 100644 --- a/src/XML/idpdisc/DiscoveryResponse.php +++ b/src/XML/idpdisc/DiscoveryResponse.php @@ -4,12 +4,13 @@ namespace SimpleSAML\SAML2\XML\idpdisc; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; /** * Abstract class to be implemented by all the classes in this namespace @@ -38,30 +39,30 @@ final class DiscoveryResponse extends AbstractIndexedEndpointType implements Sch * * This is an endpoint with one restriction: it cannot contain a ResponseLocation. * - * @param int $index - * @param string $binding - * @param string $location - * @param bool|null $isDefault - * @param string|null $unused + * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location + * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $attributes * * @throws \SimpleSAML\Assert\AssertionFailedException */ public function __construct( - int $index, - string $binding, - string $location, - ?bool $isDefault = null, - ?string $unused = null, + UnsignedShortValue $index, + SAMLAnyURIValue $binding, + SAMLAnyURIValue $location, + ?BooleanValue $isDefault = null, + ?SAMLAnyURIValue $unused = null, array $children = [], array $attributes = [], ) { - Assert::same($binding, C::BINDING_IDPDISC, ProtocolViolationException::class); + Assert::same($binding->getValue(), C::BINDING_IDPDISC, ProtocolViolationException::class); Assert::null( $unused, 'The \'ResponseLocation\' attribute must be omitted for idpdisc:DiscoveryResponse.', ); - parent::__construct($index, C::BINDING_IDPDISC, $location, $isDefault, null, $children, $attributes); + parent::__construct($index, $binding, $location, $isDefault, null, $children, $attributes); } } diff --git a/src/XML/init/RequestInitiator.php b/src/XML/init/RequestInitiator.php index 5f33ebec80..b675d47297 100644 --- a/src/XML/init/RequestInitiator.php +++ b/src/XML/init/RequestInitiator.php @@ -5,12 +5,12 @@ namespace SimpleSAML\SAML2\XML\init; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\md\AbstractEndpointType; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class for handling the init:RequestInitiator element. @@ -37,20 +37,26 @@ final class RequestInitiator extends AbstractEndpointType implements SchemaValid /** * EndpointType constructor. * - * @param string $location - * @param string|null $responseLocation + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation * @param array $children * @param array<\SimpleSAML\XML\Attribute> $attributes * * @throws \InvalidArgumentException */ public function __construct( - string $location, - ?string $responseLocation = null, + SAMLAnyURIValue $location, + ?SAMLAnyURIValue $responseLocation = null, array $children = [], array $attributes = [], ) { - parent::__construct(self::NS, $location, $responseLocation, $children, $attributes); + parent::__construct( + SAMLAnyURIValue::fromString(self::NS), + $location, + $responseLocation, + $children, + $attributes, + ); } @@ -81,8 +87,8 @@ public static function fromXML(DOMElement $xml): static ); return new static( - self::getAttribute($xml, 'Location'), - self::getOptionalAttribute($xml, 'ResponseLocation', null), + self::getAttribute($xml, 'Location', SAMLAnyURIValue::class), + self::getOptionalAttribute($xml, 'ResponseLocation', SAMLAnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); diff --git a/src/XML/md/AbstractEndpointType.php b/src/XML/md/AbstractEndpointType.php index ed3c6e7f9a..f664816ba6 100644 --- a/src/XML/md/AbstractEndpointType.php +++ b/src/XML/md/AbstractEndpointType.php @@ -5,14 +5,13 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait}; use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XML\XsNamespace as NS; @@ -52,25 +51,21 @@ abstract class AbstractEndpointType extends AbstractMdElement implements Arrayiz /** * EndpointType constructor. * - * @param string $binding - * @param string $location - * @param string|null $responseLocation + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation * @param \SimpleSAML\XML\ElementInterface[] $children * @param array<\SimpleSAML\XML\Attribute> $attributes * * @throws \SimpleSAML\Assert\AssertionFailedException */ public function __construct( - protected string $binding, - protected string $location, - protected ?string $responseLocation = null, + protected SAMLAnyURIValue $binding, + protected SAMLAnyURIValue $location, + protected ?SAMLAnyURIValue $responseLocation = null, array $children = [], array $attributes = [], ) { - SAMLAssert::validURI($binding); - SAMLAssert::validURI($location); - SAMLAssert::nullOrValidURI($responseLocation); - $this->setElements($children); $this->setAttributesNS($attributes); } @@ -79,9 +74,9 @@ public function __construct( /** * Collect the value of the Binding property. * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getBinding(): string + public function getBinding(): SAMLAnyURIValue { return $this->binding; } @@ -90,9 +85,9 @@ public function getBinding(): string /** * Collect the value of the Location property. * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getLocation(): string + public function getLocation(): SAMLAnyURIValue { return $this->location; } @@ -101,9 +96,9 @@ public function getLocation(): string /** * Collect the value of the ResponseLocation property. * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null */ - public function getResponseLocation(): ?string + public function getResponseLocation(): ?SAMLAnyURIValue { return $this->responseLocation; } @@ -133,9 +128,9 @@ public static function fromXML(DOMElement $xml): static ); return new static( - self::getAttribute($xml, 'Binding'), - self::getAttribute($xml, 'Location'), - self::getOptionalAttribute($xml, 'ResponseLocation', null), + self::getAttribute($xml, 'Binding', SAMLAnyURIValue::class), + self::getAttribute($xml, 'Location', SAMLAnyURIValue::class), + self::getOptionalAttribute($xml, 'ResponseLocation', SAMLAnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -152,11 +147,11 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = parent::instantiateParentElement($parent); - $e->setAttribute('Binding', $this->getBinding()); - $e->setAttribute('Location', $this->getLocation()); + $e->setAttribute('Binding', $this->getBinding()->getValue()); + $e->setAttribute('Location', $this->getLocation()->getValue()); if ($this->getResponseLocation() !== null) { - $e->setAttribute('ResponseLocation', $this->getResponseLocation()); + $e->setAttribute('ResponseLocation', $this->getResponseLocation()->getValue()); } foreach ($this->getAttributesNS() as $attr) { @@ -185,9 +180,9 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['Binding'], - $data['Location'], - $data['ResponseLocation'] ?? null, + SAMLAnyURIValue::fromString($data['Binding']), + SAMLAnyURIValue::fromString($data['Location']), + $data['ResponseLocation'] !== null ? SAMLAnyURIValue::fromString($data['ResponseLocation']) : null, $data['children'] ?? [], $data['attributes'] ?? [], ); @@ -260,9 +255,9 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = [ - 'Binding' => $this->getBinding(), - 'Location' => $this->getLocation(), - 'ResponseLocation' => $this->getResponseLocation(), + 'Binding' => $this->getBinding()->getValue(), + 'Location' => $this->getLocation()->getValue(), + 'ResponseLocation' => $this->getResponseLocation()?->getValue(), 'children' => $this->getElements(), ]; diff --git a/src/XML/md/AbstractIndexedEndpointType.php b/src/XML/md/AbstractIndexedEndpointType.php index 6a66a6ada5..6c24af7c4c 100644 --- a/src/XML/md/AbstractIndexedEndpointType.php +++ b/src/XML/md/AbstractIndexedEndpointType.php @@ -5,18 +5,18 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\SerializableElementInterface; +use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; use function array_filter; use function array_key_exists; use function array_keys; -use function is_bool; -use function strval; /** * Class representing a SAML2 IndexedEndpointType. @@ -36,20 +36,20 @@ abstract class AbstractIndexedEndpointType extends AbstractEndpointType implemen * static methods to get its properties from a given \DOMElement for your convenience. Look at the implementation * of fromXML() to know how to use them. * - * @param int $index - * @param string $binding - * @param string $location - * @param bool|null $isDefault - * @param string|null $responseLocation + * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location + * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault + * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $responseLocation * @param array $children * @param list<\SimpleSAML\XML\Attribute> $attributes */ public function __construct( - int $index, - string $binding, - string $location, - ?bool $isDefault = null, - ?string $responseLocation = null, + UnsignedShortValue $index, + SAMLAnyURIValue $binding, + SAMLAnyURIValue $location, + ?BooleanValue $isDefault = null, + ?SAMLAnyURIValue $responseLocation = null, array $children = [], array $attributes = [], ) { @@ -82,11 +82,11 @@ public static function fromXML(DOMElement $xml): static ); return new static( - self::getIntegerAttribute($xml, 'index'), - self::getAttribute($xml, 'Binding'), - self::getAttribute($xml, 'Location'), - self::getOptionalBooleanAttribute($xml, 'isDefault', null), - self::getOptionalAttribute($xml, 'ResponseLocation', null), + self::getAttribute($xml, 'index', UnsignedShortValue::class), + self::getAttribute($xml, 'Binding', SAMLAnyURIValue::class), + self::getAttribute($xml, 'Location', SAMLAnyURIValue::class), + self::getOptionalAttribute($xml, 'isDefault', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'ResponseLocation', SAMLAnyURIValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -102,17 +102,17 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = parent::instantiateParentElement($parent); + $e->setAttribute('Binding', $this->getBinding()->getValue()); + $e->setAttribute('Location', $this->getLocation()->getValue()); - $e->setAttribute('Binding', $this->getBinding()); - $e->setAttribute('Location', $this->getLocation()); if ($this->getResponseLocation() !== null) { - $e->setAttribute('ResponseLocation', $this->getResponseLocation()); + $e->setAttribute('ResponseLocation', $this->getResponseLocation()->getValue()); } - $e->setAttribute('index', strval($this->getIndex())); + $e->setAttribute('index', $this->getIndex()->getValue()); - if (is_bool($this->getIsDefault())) { - $e->setAttribute('isDefault', $this->getIsDefault() ? 'true' : 'false'); + if ($this->getIsDefault() !== null) { + $e->setAttribute('isDefault', $this->getIsDefault()->getValue()); } foreach ($this->getAttributesNS() as $attr) { @@ -141,11 +141,11 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['index'], - $data['Binding'], - $data['Location'], - $data['isDefault'] ?? null, - $data['ResponseLocation'] ?? null, + UnsignedShortValue::fromInteger($data['index']), + SAMLAnyURIValue::fromString($data['Binding']), + SAMLAnyURIValue::fromString($data['Location']), + $data['isDefault'] !== null ? BooleanValue::fromBoolean($data['isDefault']) : null, + ($data['ResponseLocation'] ?? null) ? SAMLAnyURIValue::fromString($data['ResponseLocation']) : null, $data['children'] ?? [], $data['attributes'] ?? [], ); @@ -226,8 +226,8 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = parent::toArray(); - $data['index'] = $this->getIndex(); - $data['isDefault'] = $this->getIsDefault(); + $data['index'] = $this->getIndex()->toInteger(); + $data['isDefault'] = $this->getIsDefault()->toBoolean(); return array_filter($data); } diff --git a/src/XML/md/AbstractLocalizedName.php b/src/XML/md/AbstractLocalizedName.php index 91cad4395e..9be5a270d8 100644 --- a/src/XML/md/AbstractLocalizedName.php +++ b/src/XML/md/AbstractLocalizedName.php @@ -5,14 +5,14 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\StringElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; @@ -23,31 +23,32 @@ */ abstract class AbstractLocalizedName extends AbstractMdElement implements ArrayizableElementInterface { - use StringElementTrait; + use TypedTextContentTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; /** * LocalizedNameType constructor. * - * @param string $language The language this string is localized in. - * @param string $value The localized string. + * @param \SimpleSAML\XML\Type\LanguageValue $language The language this string is localized in. + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $value The localized string. */ - final public function __construct( - protected string $language, - string $value, + public function __construct( + protected LanguageValue $language, + SAMLStringValue $content, ) { - Assert::notWhitespaceOnly($language, ProtocolViolationException::class); - - $this->setContent($value); + $this->setContent($content); } /** * Get the language this string is localized in. * - * @return string + * @return \SimpleSAML\XML\Type\LanguageValue */ - public function getLanguage(): string + public function getLanguage(): LanguageValue { return $this->language; } @@ -72,7 +73,10 @@ public static function fromXML(DOMElement $xml): static MissingAttributeException::class, ); - return new static($xml->getAttributeNS(C::NS_XML, 'lang'), $xml->textContent); + return new static( + LanguageValue::fromString($xml->getAttributeNS(C::NS_XML, 'lang')), + SAMLStringValue::fromString($xml->textContent), + ); } @@ -83,8 +87,8 @@ public static function fromXML(DOMElement $xml): static final public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttributeNS(C::NS_XML, 'xml:lang', $this->getLanguage()); - $e->textContent = $this->getContent(); + $e->setAttributeNS(C::NS_XML, 'xml:lang', $this->getLanguage()->getValue()); + $e->textContent = $this->getContent()->getValue(); return $e; } @@ -100,11 +104,8 @@ public static function fromArray(array $data): static { Assert::count($data, 1, ArrayValidationException::class); - $lang = array_key_first($data); - Assert::stringNotEmpty($lang, ArrayValidationException::class); - - $value = $data[$lang]; - Assert::stringNotEmpty($value, ArrayValidationException::class); + $lang = LanguageValue::fromString(array_key_first($data)); + $value = SAMLStringValue::fromString($data[$lang->getValue()]); return new static($lang, $value); } @@ -117,6 +118,6 @@ public static function fromArray(array $data): static */ public function toArray(): array { - return [$this->language => $this->getContent()]; + return [$this->getLanguage()->getValue() => $this->getContent()->getValue()]; } } diff --git a/src/XML/md/AbstractLocalizedURI.php b/src/XML/md/AbstractLocalizedURI.php index 826e047827..fd9641759b 100644 --- a/src/XML/md/AbstractLocalizedURI.php +++ b/src/XML/md/AbstractLocalizedURI.php @@ -4,8 +4,14 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use DOMElement; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\Type\LanguageValue; + +use function array_key_first; /** * Abstract class implementing LocalizedURIType. @@ -14,64 +20,49 @@ */ abstract class AbstractLocalizedURI extends AbstractLocalizedName { - /** - * Set the content of the element. - * - * @param string $content The value to go in the XML textContent - */ - protected function setContent(string $content): void - { - $this->validateContent($content); - $this->content = $content; - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; /** - * Get the content of the element. + * LocalizedNameType constructor. * - * @return string + * @param \SimpleSAML\XML\Type\LanguageValue $language The language this string is localized in. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $value The localized string. */ - public function getContent(): string - { - return $this->sanitizeContent($this->getRawContent()); - } - + final public function __construct( + protected LanguageValue $language, + SAMLAnyURIValue $content, + ) { + $content = SAMLStringValue::fromString($content->getValue()); - /** - * Get the raw and unsanitized content of the element. - * - * @return string - */ - public function getRawContent(): string - { - return $this->content; + parent::__construct($language, $content); } /** - * Sanitize the content of the element. + * Create an instance of this object from its XML representation. * - * @param string $content The unsanitized textContent - * @throws \Exception on failure - * @return string - */ - protected function sanitizeContent(string $content): string - { - // We've seen metadata in the wild that had stray whitespace around URIs, causing assertions to fail - return trim($content); - } - - - /** - * Validate the content of the element. + * @param \DOMElement $xml + * @return static * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void + * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * if the qualified name of the supplied element is wrong */ - protected function validateContent(string $content): void + public static function fromXML(DOMElement $xml): static { - SAMLAssert::validURI($this->sanitizeContent($content)); + Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); + Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); + Assert::true( + $xml->hasAttributeNS(C::NS_XML, 'lang'), + 'Missing xml:lang from ' . static::getLocalName(), + MissingAttributeException::class, + ); + + return new static( + LanguageValue::fromString($xml->getAttributeNS(C::NS_XML, 'lang')), + SAMLAnyURIValue::fromString($xml->textContent), + ); } @@ -85,12 +76,10 @@ public static function fromArray(array $data): static { Assert::count($data, 1); - $lang = array_key_first($data); - Assert::stringNotEmpty($lang); - - $value = $data[$lang]; - Assert::stringNotEmpty($value); - SAMLAssert::validURI($value); + $lang = LanguageValue::fromString(array_key_first($data)); + $value = SAMLAnyURIValue::fromString( + $data[$lang->getValue()], + ); return new static($lang, $value); } diff --git a/src/XML/md/AbstractMetadataDocument.php b/src/XML/md/AbstractMetadataDocument.php index 845e91090c..98ded978ec 100644 --- a/src/XML/md/AbstractMetadataDocument.php +++ b/src/XML/md/AbstractMetadataDocument.php @@ -4,12 +4,14 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\XML\ExtendableElementTrait; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, PublicationPath, RegistrationInfo}; +use SimpleSAML\SAML2\XML\mdui\{DiscoHints, UIInfo}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; /** * Class to represent a metadata document @@ -24,20 +26,63 @@ abstract class AbstractMetadataDocument extends AbstractSignedMdElement /** * Generic constructor for SAML metadata documents. * - * @param string|null $id The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XML\Type\IDValue|null $id The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to null. */ public function __construct( - protected ?string $id = null, - protected ?DateTimeImmutable $validUntil = null, - protected ?string $cacheDuration = null, + protected ?IDValue $id = null, + protected ?SAMLDateTimeValue $validUntil = null, + protected ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, ) { - Assert::nullOrValidNCName($id, SchemaViolationException::class); - Assert::nullOrSame($validUntil?->getTimeZone()->getName(), 'Z'); - Assert::nullOrValidDuration($cacheDuration, SchemaViolationException::class); + if ($extensions !== null) { + $exts = $extensions->getList(); + + /** + * MDUI 2.1: this element MUST NOT appear more than once within a given element. + */ + $uiInfo = array_values(array_filter($exts, function ($ext) { + return $ext instanceof UIInfo; + })); + Assert::maxCount($uiInfo, 1, ProtocolViolationException::class); + + /** + * MDUI 2.2: this element MUST NOT appear more than once within a given element. + */ + $discoHints = array_values(array_filter($exts, function ($ext) { + return $ext instanceof DiscoHints; + })); + Assert::maxCount($discoHints, 1, ProtocolViolationException::class); + + /** + * MDRPI 2.1: this element MUST NOT appear more than once within a given element. + */ + $regInfo = array_values(array_filter($exts, function ($ext) { + return $ext instanceof RegistrationInfo; + })); + Assert::maxCount($regInfo, 1, ProtocolViolationException::class); + + /** + * MDRPI 2.2: this element MUST NOT appear more than once within a given element. + */ + $pubInfo = array_values(array_filter($exts, function ($ext) { + return $ext instanceof PublicationInfo; + })); + Assert::maxCount($regInfo, 1, ProtocolViolationException::class); + + /** + * MDRPI 2.3: The element MUST NOT appear more than once within the + * element of a given or element. + */ + $pubPath = array_values(array_filter($exts, function ($ext) { + return $ext instanceof PublicationPath; + })); + Assert::maxCount($pubPath, 1, ProtocolViolationException::class); + } $this->setExtensions($extensions); } @@ -46,9 +91,9 @@ public function __construct( /** * Collect the value of the id property. * - * @return string|null + * @return \SimpleSAML\XML\Type\IDValue|null */ - public function getId(): ?string + public function getId(): ?IDValue { return $this->id; } @@ -57,9 +102,9 @@ public function getId(): ?string /** * Collect the value of the validUntil property. * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getValidUntil(): ?DateTimeImmutable + public function getValidUntil(): ?SAMLDateTimeValue { return $this->validUntil; } @@ -68,9 +113,9 @@ public function getValidUntil(): ?DateTimeImmutable /** * Collect the value of the cacheDuration property. * - * @return string|null + * @return \SimpleSAML\XML\Type\DurationValue|null */ - public function getCacheDuration(): ?string + public function getCacheDuration(): ?DurationValue { return $this->cacheDuration; } @@ -95,15 +140,15 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getId() !== null) { - $e->setAttribute('ID', $this->getId()); + $e->setAttribute('ID', $this->getId()->getValue()); } if ($this->getValidUntil() !== null) { - $e->setAttribute('validUntil', $this->getValidUntil()->format(C::DATETIME_FORMAT)); + $e->setAttribute('validUntil', $this->getValidUntil()->getValue()); } if ($this->getCacheDuration() !== null) { - $e->setAttribute('cacheDuration', $this->getCacheDuration()); + $e->setAttribute('cacheDuration', $this->getCacheDuration()->getValue()); } $extensions = $this->getExtensions(); diff --git a/src/XML/md/AbstractRoleDescriptor.php b/src/XML/md/AbstractRoleDescriptor.php index cbd7c6fa57..59c9b0f1c1 100644 --- a/src/XML/md/AbstractRoleDescriptor.php +++ b/src/XML/md/AbstractRoleDescriptor.php @@ -4,24 +4,18 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\ExtensionPointInterface; -use SimpleSAML\SAML2\XML\ExtensionPointTrait; -use SimpleSAML\XML\Attribute as XMLAttribute; +use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue, StringValue}; use function array_pop; -use function count; -use function implode; /** * Class representing a SAML2 RoleDescriptor element. @@ -43,13 +37,16 @@ abstract class AbstractRoleDescriptor extends AbstractRoleDescriptorType impleme /** * Initialize a md:RoleDescriptor from scratch. * - * @param string $type + * @param \SimpleSAML\XML\Type\QNameValue $type * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor * An array of KeyDescriptor elements. Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -59,13 +56,13 @@ abstract class AbstractRoleDescriptor extends AbstractRoleDescriptorType impleme * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( - protected string $type, + protected QNameValue $type, array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptor = [], ?Organization $organization = null, array $contactPerson = [], @@ -89,9 +86,9 @@ public function __construct( /** * Return the xsi:type value corresponding this element. * - * @return string + * @return \SimpleSAML\XML\Type\QNameValue */ - public function getXsiType(): string + public function getXsiType(): QNameValue { return $this->type; } @@ -111,32 +108,17 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, C::NS_MD, InvalidDOMElementException::class); Assert::true( $xml->hasAttributeNS(C::NS_XSI, 'type'), - 'Missing required xsi:type in element.', + 'Missing required xsi:type in element.', SchemaViolationException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); - Assert::validQName($type, SchemaViolationException::class); - - // first, try to resolve the type to a full namespaced version - $qname = explode(':', $type, 2); - if (count($qname) === 2) { - list($prefix, $element) = $qname; - } else { - $prefix = null; - list($element) = $qname; - } - $ns = $xml->lookupNamespaceUri($prefix); - $type = ($ns === null) ? $element : implode(':', [$ns, $element]); + $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); if ($handler === null) { // we don't have a handler, proceed with unknown RoleDescriptor - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - Assert::nullOrValidDateTime($validUntil); + $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( @@ -157,12 +139,12 @@ public static function fromXML(DOMElement $xml): static return new UnknownRoleDescriptor( new Chunk($xml), $type, - preg_split('/[\s]+/', trim($protocols)), - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + preg_split('/[\s]+/', trim($protocols->getValue())), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), array_pop($extensions), - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), KeyDescriptor::getChildrenOfClass($xml), array_pop($orgs), ContactPerson::getChildrenOfClass($xml), @@ -178,21 +160,4 @@ public static function fromXML(DOMElement $xml): static return $handler::fromXML($xml); } - - - /** - * Convert this RoleDescriptor to XML. - * - * @param \DOMElement|null $parent The element we are converting to XML. - * @return \DOMElement The XML element after adding the data corresponding to this RoleDescriptor. - */ - public function toUnsignedXML(?DOMElement $parent = null): DOMElement - { - $e = parent::toUnsignedXML($parent); - - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); - $type->toXML($e); - - return $e; - } } diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index d54c88cb0e..a5f1bdcc13 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -4,13 +4,14 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XML\XsNamespace as NS; use function implode; @@ -33,11 +34,14 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument * Initialize a RoleDescriptor. * * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -48,11 +52,11 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument */ public function __construct( protected array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - protected ?string $errorURL = null, + protected ?SAMLAnyURIValue $errorURL = null, protected array $keyDescriptor = [], protected ?Organization $organization = null, protected array $contact = [], @@ -65,7 +69,6 @@ public function __construct( 'At least one protocol must be supported by this ' . static::NS_PREFIX . ':' . static::getLocalName() . '.', ); SAMLAssert::allValidURI($protocolSupportEnumeration, SchemaViolationException::class); - SAMLAssert::nullOrValidURI($errorURL, SchemaViolationException::class); Assert::maxCount($contact, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf( $contact, @@ -88,9 +91,9 @@ public function __construct( /** * Collect the value of the errorURL property. * - * @return string|null + * @return \SimpleSAML\SAML2\XML\SAMLAnyURIValue|null */ - public function getErrorURL(): ?string + public function getErrorURL(): ?SAMLAnyURIValue { return $this->errorURL; } @@ -152,7 +155,7 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement $e->setAttribute('protocolSupportEnumeration', implode(' ', $this->getProtocolSupportEnumeration())); if ($this->getErrorURL() !== null) { - $e->setAttribute('errorURL', $this->getErrorURL()); + $e->setAttribute('errorURL', $this->getErrorURL()->getValue()); } foreach ($this->getKeyDescriptor() as $kd) { diff --git a/src/XML/md/AbstractSSODescriptor.php b/src/XML/md/AbstractSSODescriptor.php index 19196fdfb0..44fe7ca6bd 100644 --- a/src/XML/md/AbstractSSODescriptor.php +++ b/src/XML/md/AbstractSSODescriptor.php @@ -4,11 +4,12 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; +use SimpleSAML\XML\Type\{IDValue, DurationValue}; /** * Class representing SAML 2 SSODescriptorType. @@ -21,11 +22,14 @@ abstract class AbstractSSODescriptor extends AbstractRoleDescriptorType * Initialize a RoleDescriptor. * * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptors An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -43,11 +47,11 @@ abstract class AbstractSSODescriptor extends AbstractRoleDescriptorType */ public function __construct( array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptors = [], ?Organization $organization = null, array $contacts = [], diff --git a/src/XML/md/AbstractSignedMdElement.php b/src/XML/md/AbstractSignedMdElement.php index 428c377869..11cac83037 100644 --- a/src/XML/md/AbstractSignedMdElement.php +++ b/src/XML/md/AbstractSignedMdElement.php @@ -5,10 +5,8 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\SAML2\XML\SignableElementTrait; -use SimpleSAML\SAML2\XML\SignedElementTrait; -use SimpleSAML\XMLSecurity\XML\SignableElementInterface; -use SimpleSAML\XMLSecurity\XML\SignedElementInterface; +use SimpleSAML\SAML2\XML\{SignableElementTrait, SignedElementTrait}; +use SimpleSAML\XMLSecurity\XML\{SignableElementInterface, SignedElementInterface}; use function method_exists; @@ -76,6 +74,7 @@ public function toXML(?DOMElement $parent = null): DOMElement } $e = $this->toUnsignedXML($parent); + // This is a dirty hack, but if we add the xsi-type on AbstractRoleDescriptor we cannot // get the tests to pass because the attribute-order is messed up. This has something // to do with the fact that toUnsignedXML's recursive nature. @@ -83,7 +82,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:' . static::getXsiTypePrefix(), - static::getXsiTypeNamespaceURI(), + static::getXsiTypeNamespaceURI()->getValue(), ); } diff --git a/src/XML/md/AdditionalMetadataLocation.php b/src/XML/md/AdditionalMetadataLocation.php index 7b7c50393b..0db99da22a 100644 --- a/src/XML/md/AdditionalMetadataLocation.php +++ b/src/XML/md/AdditionalMetadataLocation.php @@ -5,14 +5,10 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\URIElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function trim; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing SAML 2 metadata AdditionalMetadataLocation element. @@ -22,35 +18,43 @@ final class AdditionalMetadataLocation extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; /** * Create a new instance of AdditionalMetadataLocation * - * @param string $namespace - * @param string $location + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $namespace + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location */ public function __construct( - protected string $namespace, - string $location, + protected SAMLAnyURIValue $namespace, + protected SAMLAnyURIValue $location, ) { - SAMLAssert::validURI($namespace); - $this->setContent($location); } /** * Collect the value of the namespace-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getNamespace(): string + public function getNamespace(): SAMLAnyURIValue { return $this->namespace; } + /** + * Collect the value of the location-property + * + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue + */ + public function getLocation(): SAMLAnyURIValue + { + return $this->location; + } + + /** * Initialize an AdditionalMetadataLocation element. * @@ -67,9 +71,10 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AdditionalMetadataLocation', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AdditionalMetadataLocation::NS, InvalidDOMElementException::class); - $namespace = self::getAttribute($xml, 'namespace'); - - return new static($namespace, trim($xml->textContent)); + return new static( + self::getAttribute($xml, 'namespace', SAMLAnyURIValue::class), + SAMLAnyURIValue::fromString($xml->textContent), + ); } @@ -82,8 +87,8 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); - $e->setAttribute('namespace', $this->getNamespace()); + $e->textContent = $this->getLocation()->getValue(); + $e->setAttribute('namespace', $this->getNamespace()->getValue()); return $e; } diff --git a/src/XML/md/AffiliateMember.php b/src/XML/md/AffiliateMember.php index b1d1f8485d..af960d3274 100644 --- a/src/XML/md/AffiliateMember.php +++ b/src/XML/md/AffiliateMember.php @@ -4,10 +4,9 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing AffiliateMember. @@ -17,27 +16,8 @@ final class AffiliateMember extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } - - - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - SAMLAssert::validEntityID($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = EntityIDValue::class; } diff --git a/src/XML/md/AffiliationDescriptor.php b/src/XML/md/AffiliationDescriptor.php index 5502dd0745..ee9399775a 100644 --- a/src/XML/md/AffiliationDescriptor.php +++ b/src/XML/md/AffiliationDescriptor.php @@ -4,16 +4,13 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XMLSecurity\XML\ds\Signature; @@ -35,28 +32,29 @@ final class AffiliationDescriptor extends AbstractMetadataDocument implements Sc /** * Generic constructor for SAML metadata documents. * - * @param string $affiliationOwnerId The ID of the owner of this affiliation. + * @param \SimpleSAML\SAML2\Type\EntityIDValue $affiliationOwnerId The ID of the owner of this affiliation. * @param \SimpleSAML\SAML2\XML\md\AffiliateMember[] $affiliateMember * A non-empty array of members of this affiliation. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor * An optional array of KeyDescriptors. Defaults to an empty array. * @param list<\SimpleSAML\XML\Attribute> $namespacedAttribute */ public function __construct( - protected string $affiliationOwnerId, + protected EntityIDValue $affiliationOwnerId, protected array $affiliateMember, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, protected array $keyDescriptor = [], array $namespacedAttribute = [], ) { - SAMLAssert::validEntityID($affiliationOwnerId); Assert::notEmpty($affiliateMember, 'List of affiliated members must not be empty.'); Assert::maxCount($affiliateMember, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($affiliateMember, AffiliateMember::class); @@ -72,9 +70,9 @@ public function __construct( /** * Collect the value of the affiliationOwnerId-property * - * @return string + * @return \SimpleSAML\SAML2\Type\EntityIDValue */ - public function getAffiliationOwnerId(): string + public function getAffiliationOwnerId(): EntityIDValue { return $this->affiliationOwnerId; } @@ -120,13 +118,10 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AffiliationDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AffiliationDescriptor::NS, InvalidDOMElementException::class); - $owner = self::getAttribute($xml, 'affiliationOwnerID'); + $owner = self::getAttribute($xml, 'affiliationOwnerID', EntityIDValue::class); $members = AffiliateMember::getChildrenOfClass($xml); $keyDescriptors = KeyDescriptor::getChildrenOfClass($xml); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -154,9 +149,9 @@ public static function fromXML(DOMElement $xml): static $afd = new static( $owner, $members, - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, $keyDescriptors, self::getAttributesNSFromXML($xml), @@ -180,7 +175,7 @@ public static function fromXML(DOMElement $xml): static public function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); - $e->setAttribute('affiliationOwnerID', $this->getAffiliationOwnerId()); + $e->setAttribute('affiliationOwnerID', $this->getAffiliationOwnerId()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/md/ArtifactResolutionService.php b/src/XML/md/ArtifactResolutionService.php index 64d80e9b93..be74851d67 100644 --- a/src/XML/md/ArtifactResolutionService.php +++ b/src/XML/md/ArtifactResolutionService.php @@ -4,9 +4,10 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\Assert\Assert; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; /** * A class implementing the md:ArtifactResolutionService element. @@ -23,22 +24,22 @@ final class ArtifactResolutionService extends AbstractIndexedEndpointType implem * * This is an endpoint with one restriction: it cannot contain a ResponseLocation. * - * @param int $index - * @param string $binding - * @param string $location - * @param bool|null $isDefault - * @param string|null $unused + * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location + * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $unused * @param list<\SimpleSAML\XML\Attribute> $attributes * @param array $children * * @throws \SimpleSAML\Assert\AssertionFailedException */ public function __construct( - int $index, - string $binding, - string $location, - ?bool $isDefault = null, - ?string $unused = null, + UnsignedShortValue $index, + SAMLAnyURIValue $binding, + SAMLAnyURIValue $location, + ?BooleanValue $isDefault = null, + ?SAMLAnyURIValue $unused = null, array $children = [], array $attributes = [], ) { diff --git a/src/XML/md/AssertionConsumerService.php b/src/XML/md/AssertionConsumerService.php index b234a0b3ae..090f347459 100644 --- a/src/XML/md/AssertionConsumerService.php +++ b/src/XML/md/AssertionConsumerService.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class implementing the md:AssertionConsumerService element. diff --git a/src/XML/md/AttributeAuthorityDescriptor.php b/src/XML/md/AttributeAuthorityDescriptor.php index 694b1a6946..3bca4ee036 100644 --- a/src/XML/md/AttributeAuthorityDescriptor.php +++ b/src/XML/md/AttributeAuthorityDescriptor.php @@ -4,17 +4,14 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function preg_split; @@ -39,11 +36,11 @@ final class AttributeAuthorityDescriptor extends AbstractRoleDescriptorType impl * @param \SimpleSAML\SAML2\XML\md\NameIDFormat[] $nameIDFormat * @param \SimpleSAML\SAML2\XML\md\AttributeProfile[] $attributeProfile * @param \SimpleSAML\SAML2\XML\saml\Attribute[] $attribute - * @param string|null $ID - * @param \DateTimeImmutable|null $validUntil - * @param string|null $cacheDuration + * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions - * @param string|null $errorURL + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contact @@ -56,11 +53,11 @@ public function __construct( protected array $nameIDFormat = [], protected array $attributeProfile = [], protected array $attribute = [], - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, ?Organization $organization = null, array $keyDescriptor = [], array $contact = [], @@ -178,9 +175,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AttributeAuthorityDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeAuthorityDescriptor::NS, InvalidDOMElementException::class); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); + $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); $attrServices = AttributeService::getChildrenOfClass($xml); Assert::notEmpty( @@ -220,16 +215,16 @@ public static function fromXML(DOMElement $xml): static $authority = new static( $attrServices, - preg_split('/[\s]+/', trim($protocols)), + preg_split('/[\s]+/', $protocols->getValue()), $assertIDReqServices, $nameIDFormats, $attrProfiles, $attributes, - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), !empty($orgs) ? $orgs[0] : null, KeyDescriptor::getChildrenOfClass($xml), ContactPerson::getChildrenOfClass($xml), diff --git a/src/XML/md/AttributeConsumingService.php b/src/XML/md/AttributeConsumingService.php index 44bd1535bf..994782e645 100644 --- a/src/XML/md/AttributeConsumingService.php +++ b/src/XML/md/AttributeConsumingService.php @@ -5,14 +5,13 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; -use function strval; +use function var_export; /** * Class representing SAML 2 Metadata AttributeConsumingService element. @@ -28,17 +27,17 @@ final class AttributeConsumingService extends AbstractMdElement implements Schem /** * AttributeConsumingService constructor. * - * @param int $index + * @param \SimpleSAML\XML\Type\UnsignedShort $index * @param \SimpleSAML\SAML2\XML\md\ServiceName[] $serviceName * @param \SimpleSAML\SAML2\XML\md\RequestedAttribute[] $requestedAttribute - * @param bool|null $isDefault + * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault * @param \SimpleSAML\SAML2\XML\md\ServiceDescription[] $serviceDescription */ public function __construct( - int $index, + UnsignedShortValue $index, protected array $serviceName, protected array $requestedAttribute, - ?bool $isDefault = null, + ?BooleanValue $isDefault = null, protected array $serviceDescription = [], ) { Assert::maxCount($serviceName, C::UNBOUNDED_LIMIT); @@ -93,7 +92,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AttributeConsumingService', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeConsumingService::NS, InvalidDOMElementException::class); - $index = self::getIntegerAttribute($xml, 'index'); $names = ServiceName::getChildrenOfClass($xml); Assert::minCount( $names, @@ -107,10 +105,10 @@ public static function fromXML(DOMElement $xml): static $requestedAttrs = RequestedAttribute::getChildrenOfClass($xml); return new static( - $index, + self::getAttribute($xml, 'index', UnsignedShortValue::class), $names, $requestedAttrs, - self::getOptionalBooleanAttribute($xml, 'isDefault', null), + self::getOptionalAttribute($xml, 'isDefault', BooleanValue::class, null), $descriptions, ); } @@ -158,12 +156,10 @@ public function getRequestedAttribute(): array public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('index', strval($this->getIndex())); + $e->setAttribute('index', $this->getIndex()->getValue()); - if ($this->getIsDefault() === true) { - $e->setAttribute('isDefault', 'true'); - } elseif ($this->getIsDefault() === false) { - $e->setAttribute('isDefault', 'false'); + if ($this->getIsDefault() !== null) { + $e->setAttribute('isDefault', var_export($this->getIsDefault()->toBoolean(), true)); } foreach ($this->getServiceName() as $name) { diff --git a/src/XML/md/AttributeProfile.php b/src/XML/md/AttributeProfile.php index 71043af2f9..85cb0409d8 100644 --- a/src/XML/md/AttributeProfile.php +++ b/src/XML/md/AttributeProfile.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing AttributeProfile. @@ -16,14 +16,8 @@ final class AttributeProfile extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/md/AttributeService.php b/src/XML/md/AttributeService.php index c0626f728e..43d60cafe9 100644 --- a/src/XML/md/AttributeService.php +++ b/src/XML/md/AttributeService.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * AttributeService elements of type EndpointType diff --git a/src/XML/md/AuthnAuthorityDescriptor.php b/src/XML/md/AuthnAuthorityDescriptor.php index 77cd1bfe38..5951a19c46 100644 --- a/src/XML/md/AuthnAuthorityDescriptor.php +++ b/src/XML/md/AuthnAuthorityDescriptor.php @@ -4,15 +4,13 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function preg_split; @@ -34,11 +32,11 @@ final class AuthnAuthorityDescriptor extends AbstractRoleDescriptorType implemen * @param array $protocolSupportEnumeration * @param array $assertionIDRequestService * @param array $nameIDFormat - * @param string|null $ID - * @param \DateTimeImmutable|null $validUntil - * @param string|null $cacheDuration + * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions - * @param string|null $errorURL + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization * @param array $keyDescriptor * @param array $contact @@ -49,11 +47,11 @@ public function __construct( array $protocolSupportEnumeration, protected array $assertionIDRequestService = [], protected array $nameIDFormat = [], - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, ?Organization $organization = null, array $keyDescriptor = [], array $contact = [], @@ -147,9 +145,6 @@ public static function fromXML(DOMElement $xml): static $assertionIDRequestServices = AssertionIDRequestService::getChildrenOfClass($xml); $nameIDFormats = NameIDFormat::getChildrenOfClass($xml); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -176,14 +171,14 @@ public static function fromXML(DOMElement $xml): static $authority = new static( $authnQueryServices, - preg_split('/[\s]+/', trim($protocols)), + preg_split('/[\s]+/', trim($protocols->getValue())), $assertionIDRequestServices, $nameIDFormats, - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), !empty($orgs) ? $orgs[0] : null, KeyDescriptor::getChildrenOfClass($xml), ContactPerson::getChildrenOfClass($xml), diff --git a/src/XML/md/Company.php b/src/XML/md/Company.php index 0800fdd7db..97ade90bf3 100644 --- a/src/XML/md/Company.php +++ b/src/XML/md/Company.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing Company. @@ -16,14 +16,8 @@ final class Company extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/ContactPerson.php b/src/XML/md/ContactPerson.php index a1b340a854..de7215fbbe 100644 --- a/src/XML/md/ContactPerson.php +++ b/src/XML/md/ContactPerson.php @@ -5,23 +5,22 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\{EmailAddressValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\XsNamespace as NS; use function array_change_key_case; use function array_filter; use function array_key_exists; use function array_keys; +use function array_map; use function array_pop; use function count; @@ -57,7 +56,7 @@ final class ContactPerson extends AbstractMdElement implements /** * ContactPerson constructor. * - * @param string $contactType + * @param \SimpleSAML\SAML2\SAMLStringValue $contactType * @param \SimpleSAML\SAML2\XML\md\Company|null $company * @param \SimpleSAML\SAML2\XML\md\GivenName|null $givenName * @param \SimpleSAML\SAML2\XML\md\SurName|null $surName @@ -67,7 +66,7 @@ final class ContactPerson extends AbstractMdElement implements * @param list<\SimpleSAML\XML\Attribute> $namespacedAttribute */ public function __construct( - protected string $contactType, + protected SAMLStringValue $contactType, protected ?Company $company = null, protected ?GivenName $givenName = null, protected ?SurName $surName = null, @@ -76,7 +75,7 @@ public function __construct( protected array $telephoneNumber = [], array $namespacedAttribute = [], ) { - Assert::oneOf($contactType, self::CONTACT_TYPES); + Assert::oneOf($contactType->getValue(), self::CONTACT_TYPES); Assert::maxCount($emailAddress, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($emailAddress, EmailAddress::class); Assert::maxCount($telephoneNumber, C::UNBOUNDED_LIMIT); @@ -90,9 +89,9 @@ public function __construct( /** * Collect the value of the contactType-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLStringValue */ - public function getContactType(): string + public function getContactType(): SAMLStringValue { return $this->contactType; } @@ -171,7 +170,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'ContactPerson', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ContactPerson::NS, InvalidDOMElementException::class); - $contactType = self::getAttribute($xml, 'contactType'); + $contactType = self::getAttribute($xml, 'contactType', SAMLStringValue::class); $company = Company::getChildrenOfClass($xml); Assert::maxCount($company, 1, 'More than one Company in md:ContactPerson'); @@ -212,7 +211,7 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('contactType', $this->getContactType()); + $e->setAttribute('contactType', $this->getContactType()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); @@ -246,13 +245,17 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['contactType'], - $data['Company'] ?? null, - $data['GivenName'] ?? null, - $data['SurName'] ?? null, + SAMLStringValue::fromString($data['contactType']), + $data['Company'] !== null ? new Company(SAMLStringValue::fromString($data['Company'])) : null, + $data['GivenName'] !== null ? new GivenName(SAMLStringValue::fromString($data['GivenName'])) : null, + $data['SurName'] !== null ? new SurName(SAMLStringValue::fromString($data['SurName'])) : null, $data['Extensions'] ?? null, - $data['EmailAddress'] ?? [], - $data['TelephoneNumber'] ?? [], + $data['EmailAddress'] !== null + ? array_map([EmailAddress::class, 'fromArray'], [$data['EmailAddress']]) + : [], + $data['TelephoneNumber'] !== null + ? array_map([TelephoneNumber::class, 'fromArray'], [$data['TelephoneNumber']]) + : [], $data['attributes'] ?? [], ); } @@ -292,24 +295,24 @@ private static function processArrayContents(array $data): array if (array_key_exists('company', $data)) { Assert::string($data['company'], ArrayValidationException::class); - $retval['Company'] = new Company($data['company']); + $retval['Company'] = $data['company']; } if (array_key_exists('givenname', $data)) { Assert::string($data['givenname'], ArrayValidationException::class); - $retval['GivenName'] = new GivenName($data['givenname']); + $retval['GivenName'] = $data['givenname']; } if (array_key_exists('surname', $data)) { Assert::string($data['surname'], ArrayValidationException::class); - $retval['SurName'] = new SurName($data['surname']); + $retval['SurName'] = $data['surname']; } if (array_key_exists('emailaddress', $data)) { Assert::isArray($data['emailaddress'], ArrayValidationException::class); Assert::allString($data['emailaddress'], ArrayValidationException::class); foreach ($data['emailaddress'] as $email) { - $retval['EmailAddress'][] = new EmailAddress($email); + $retval['EmailAddress'][] = $email; } } @@ -317,7 +320,7 @@ private static function processArrayContents(array $data): array Assert::isArray($data['telephonenumber'], ArrayValidationException::class); Assert::allString($data['telephonenumber'], ArrayValidationException::class); foreach ($data['telephonenumber'] as $telephone) { - $retval['TelephoneNumber'][] = new TelephoneNumber($telephone); + $retval['TelephoneNumber'][] = $telephone; } } @@ -346,10 +349,10 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = [ - 'ContactType' => $this->getContactType(), - 'Company' => $this->getCompany()?->getContent(), - 'GivenName' => $this->getGivenName()?->getContent(), - 'SurName' => $this->getSurName()?->getContent(), + 'ContactType' => $this->getContactType()->getValue(), + 'Company' => $this->getCompany()?->getContent()->getValue(), + 'GivenName' => $this->getGivenName()?->getContent()->getValue(), + 'SurName' => $this->getSurName()?->getContent()->getValue(), 'EmailAddress' => [], 'TelephoneNumber' => [], 'Extensions' => $this->Extensions?->getList(), diff --git a/src/XML/md/EmailAddress.php b/src/XML/md/EmailAddress.php index c342fa5e38..0b651b33c5 100644 --- a/src/XML/md/EmailAddress.php +++ b/src/XML/md/EmailAddress.php @@ -4,17 +4,18 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\EmailAddressValue; +use SimpleSAML\XML\{ + ArrayizableElementInterface, + SchemaValidatableElementInterface, + SchemaValidatableElementTrait, + TypedTextContentTrait, +}; use function array_key_first; use function preg_filter; -use function preg_replace; -use function trim; /** * Class implementing EmailAddress. @@ -26,60 +27,10 @@ final class EmailAddress extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait { - StringElementTrait::validateContent as baseValidateContent; - } - - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } - - - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - $this->baseValidateContent($content); - Assert::email($content); - } + use TypedTextContentTrait; - - /** - * Sanitize the content of the element. - * - * @param string $content The unsanitized textContent - * @throws \Exception on failure - * @return string - */ - protected function sanitizeContent(string $content): string - { - return trim(preg_replace('/^(mailto:)+/i', '', $content)); - } - - - /** - * Set the content of the element. - * - * @param string $content The value to go in the XML textContent - */ - protected function setContent(string $content): void - { - $sanitized = $this->sanitizeContent($content); - $this->validateContent($sanitized); - - // Store the email address without mailto: URI - $this->content = $sanitized; - } + /** @var string */ + public const TEXTCONTENT_TYPE = EmailAddressValue::class; /** @@ -89,7 +40,7 @@ protected function setContent(string $content): void */ public function getContent(): string { - return preg_filter('/^/', 'mailto:', $this->content); + return preg_filter('/^/', 'mailto:', $this->content->getValue()); } @@ -104,7 +55,9 @@ public static function fromArray(array $data): static Assert::allString($data, ArrayValidationException::class); $index = array_key_first($data); - return new static($data[$index]); + return new static( + EmailAddressValue::fromString($data[$index]), + ); } diff --git a/src/XML/md/EncryptionMethod.php b/src/XML/md/EncryptionMethod.php index 6116d02bdf..6fe8f3369e 100644 --- a/src/XML/md/EncryptionMethod.php +++ b/src/XML/md/EncryptionMethod.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XMLSecurity\XML\xenc\AbstractEncryptionMethod; /** diff --git a/src/XML/md/EntitiesDescriptor.php b/src/XML/md/EntitiesDescriptor.php index 62ad6fea24..f6e42f18bb 100644 --- a/src/XML/md/EntitiesDescriptor.php +++ b/src/XML/md/EntitiesDescriptor.php @@ -4,18 +4,22 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, PublicationPath, RegistrationInfo}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; +use function count; +use function array_filter; +use function array_merge; +use function array_values; + /** * Class representing SAML 2 EntitiesDescriptor element. * @@ -31,19 +35,19 @@ final class EntitiesDescriptor extends AbstractMetadataDocument implements Schem * * @param \SimpleSAML\SAML2\XML\md\EntityDescriptor[] $entityDescriptors * @param \SimpleSAML\SAML2\XML\md\EntitiesDescriptor[] $entitiesDescriptors - * @param string|null $Name - * @param string|null $ID - * @param \DateTimeImmutable|null $validUntil - * @param string|null $cacheDuration + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $Name + * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions */ public function __construct( protected array $entityDescriptors = [], protected array $entitiesDescriptors = [], - protected ?string $Name = null, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + protected ?SAMLStringValue $Name = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, ) { Assert::true( @@ -56,10 +60,110 @@ public function __construct( Assert::allIsInstanceOf($entitiesDescriptors, EntitiesDescriptor::class); Assert::allIsInstanceOf($entityDescriptors, EntityDescriptor::class); + if ($extensions !== null) { + /** + * When a element appears in the element of a + * element it applies to all descendant and + * elements. That is to say, this is equivalent to putting an identical + * on every descendant . When used in this + * manner, descendant and elements MUST + * NOT contain a element in their element. + */ + $toplevel_regInfo = array_values(array_filter($extensions->getList(), function ($ext) { + return $ext instanceof RegistrationInfo; + })); + + /** + * The element SHOULD only be used on the root element of a metadata document. + */ + $toplevel_pubInfo = array_values(array_filter($extensions->getList(), function ($ext) { + return $ext instanceof PublicationInfo; + })); + + /** + * When a element appears in the element of a + * element it applies to all descendant and + * elements. That is to say, this is equivalent to putting an identical + * on every descendant and . + * When used in this manner, descendant and + * elements MUST NOT contain a element in their element. + */ + $toplevel_pubPath = array_values(array_filter($extensions->getList(), function ($ext) { + return $ext instanceof PublicationPath; + })); + + if (count($toplevel_regInfo) > 0 || count($toplevel_pubInfo) > 0 || count($toplevel_pubPath)) { + $nestedExtensions = []; + foreach (array_merge($entityDescriptors, $entitiesDescriptors) as $ed) { + $nestedExtensions = array_merge($nestedExtensions, $this->getRecursiveExtensions($ed)); + } + + if (count($toplevel_regInfo) > 0) { + $nested_regInfo = array_values(array_filter($nestedExtensions, function ($ext) { + return $ext instanceof RegistrationInfo; + })); + + Assert::count( + $nested_regInfo, + 0, + " already set at top-level.", + ProtocolViolationException::class, + ); + } + + if (count($toplevel_pubInfo) > 0) { + $nested_pubInfo = array_values(array_filter($nestedExtensions, function ($ext) { + return $ext instanceof PublicationInfo; + })); + + Assert::count( + $nested_pubInfo, + 0, + " already set at top-level.", + ProtocolViolationException::class, + ); + } + + if (count($toplevel_pubPath) > 0) { + $nested_pubPath = array_values(array_filter($nestedExtensions, function ($ext) { + return $ext instanceof PublicationPath; + })); + + Assert::count( + $nested_pubPath, + 0, + " already set at top-level.", + ProtocolViolationException::class, + ); + } + } + } + parent::__construct($ID, $validUntil, $cacheDuration, $extensions); } + /** + * Get all extensions from all nested entity/entities descriptors + */ + private function getRecursiveExtensions(EntityDescriptor|EntitiesDescriptor $descriptor): array + { + $extensions = []; + if ($descriptor->getExtensions() !== null) { + $extensions = $descriptor->getExtensions()->getList(); + + if ($descriptor instanceof EntitiesDescriptor) { + $eds = array_merge($descriptor->getEntitiesDescriptors(), $descriptor->getEntityDescriptors()); + foreach ($eds as $ed) { + $extensions = array_merge($extensions, $descriptor->getRecursiveExtensions($ed)); + } + } + } + + return $extensions; + } + + /** * Get the EntitiesDescriptor children objects * @@ -85,9 +189,9 @@ public function getEntityDescriptors(): array /** * Collect the value of the Name property. * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getName(): ?string + public function getName(): ?SAMLStringValue { return $this->Name; } @@ -109,9 +213,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'EntitiesDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, EntitiesDescriptor::NS, InvalidDOMElementException::class); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -139,10 +240,10 @@ public static function fromXML(DOMElement $xml): static $entities = new static( EntityDescriptor::getChildrenOfClass($xml), EntitiesDescriptor::getChildrenOfClass($xml), - self::getOptionalAttribute($xml, 'Name', null), - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getOptionalAttribute($xml, 'Name', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, ); @@ -165,8 +266,8 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); - if ($this->Name !== null) { - $e->setAttribute('Name', $this->Name); + if ($this->getName() !== null) { + $e->setAttribute('Name', $this->getName()->getValue()); } foreach ($this->getEntitiesDescriptors() as $entitiesDescriptor) { diff --git a/src/XML/md/EntityDescriptor.php b/src/XML/md/EntityDescriptor.php index fcf5122a71..edfd328d70 100644 --- a/src/XML/md/EntityDescriptor.php +++ b/src/XML/md/EntityDescriptor.php @@ -4,17 +4,14 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XMLSecurity\XML\ds\Signature; @@ -38,10 +35,12 @@ final class EntityDescriptor extends AbstractMetadataDocument implements SchemaV /** * Initialize an EntitiyDescriptor. * - * @param string $entityId The entityID of the entity described by this descriptor. - * @param string|null $id The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validify for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\SAML2\Type\EntityIDValue $entityId The entityID of the entity described by this descriptor. + * @param \SimpleSAML\XML\Type\IDValue|null $id The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validify for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. * @param \SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType[] $roleDescriptor An array of role descriptors. * @param \SimpleSAML\SAML2\XML\md\AffiliationDescriptor|null $affiliationDescriptor An affiliation descriptor to @@ -55,10 +54,10 @@ final class EntityDescriptor extends AbstractMetadataDocument implements SchemaV * @throws \Exception */ public function __construct( - protected string $entityId, - ?string $id = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + protected EntityIDValue $entityId, + ?IDValue $id = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, protected array $roleDescriptor = [], protected ?AffiliationDescriptor $affiliationDescriptor = null, @@ -72,7 +71,6 @@ public function __construct( 'Must have either one of the RoleDescriptors or an AffiliationDescriptor in EntityDescriptor.', ProtocolViolationException::class, ); - SAMLAssert::validEntityID($entityId); Assert::maxCount($roleDescriptor, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf( $roleDescriptor, @@ -116,16 +114,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'EntityDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, EntityDescriptor::NS, InvalidDOMElementException::class); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); - $extensions = Extensions::getChildrenOfClass($xml); Assert::maxCount($extensions, 1, 'Only one md:Extensions element is allowed.', TooManyElementsException::class); $signature = Signature::getChildrenOfClass($xml); Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.', TooManyElementsException::class); - $entityID = self::getAttribute($xml, 'entityID'); $roleDescriptors = []; $affiliationDescriptor = null; $organization = null; @@ -192,10 +186,10 @@ public static function fromXML(DOMElement $xml): static ); $entity = new static( - $entityID, - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getAttribute($xml, 'entityID', EntityIDValue::class), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, $roleDescriptors, $affiliationDescriptor, @@ -217,10 +211,9 @@ public static function fromXML(DOMElement $xml): static /** * Collect the value of the entityID property. * - * @return string - * @throws \SimpleSAML\Assert\AssertionFailedException + * @return \SimpleSAML\SAML2\Type\EntityIDValue */ - public function getEntityId(): string + public function getEntityId(): EntityIDValue { return $this->entityId; } @@ -290,7 +283,7 @@ public function getAdditionalMetadataLocation(): array public function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); - $e->setAttribute('entityID', $this->getEntityId()); + $e->setAttribute('entityID', $this->getEntityId()->getValue()); foreach ($this->getAttributesNS() as $attr) { $attr->toXML($e); diff --git a/src/XML/md/Extensions.php b/src/XML/md/Extensions.php index 26af56fe41..9f79ad38c0 100644 --- a/src/XML/md/Extensions.php +++ b/src/XML/md/Extensions.php @@ -5,28 +5,33 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\alg\AbstractAlgElement as ALG; -use SimpleSAML\SAML2\XML\alg\DigestMethod; -use SimpleSAML\SAML2\XML\alg\SigningMethod; +use SimpleSAML\SAML2\XML\alg\{ + AbstractAlgElement as ALG, + DigestMethod, + SigningMethod, +}; use SimpleSAML\SAML2\XML\emd\RepublishRequest; use SimpleSAML\SAML2\XML\ExtensionsTrait; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; use SimpleSAML\SAML2\XML\init\RequestInitiator; use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; -use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement as MDRPI; -use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; -use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; -use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; -use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement as MDUI; -use SimpleSAML\SAML2\XML\mdui\DiscoHints; -use SimpleSAML\SAML2\XML\mdui\UIInfo; +use SimpleSAML\SAML2\XML\mdrpi\{ + AbstractMdrpiElement as MDRPI, + PublicationInfo, + PublicationPath, + RegistrationInfo, +}; +use SimpleSAML\SAML2\XML\mdui\{ + AbstractMduiElement as MDUI, + DiscoHints, + UIInfo, +}; use SimpleSAML\SAML2\XML\shibmd\Scope; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_key_exists; diff --git a/src/XML/md/GivenName.php b/src/XML/md/GivenName.php index 8d9e606ef9..8be023402c 100644 --- a/src/XML/md/GivenName.php +++ b/src/XML/md/GivenName.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing GivenName. @@ -16,14 +16,8 @@ final class GivenName extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/IDPSSODescriptor.php b/src/XML/md/IDPSSODescriptor.php index 265b37ab95..bb94364b87 100644 --- a/src/XML/md/IDPSSODescriptor.php +++ b/src/XML/md/IDPSSODescriptor.php @@ -4,19 +4,18 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{BooleanValue, DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function preg_split; +use function var_export; /** * Class representing SAML 2 IDPSSODescriptor. @@ -33,16 +32,16 @@ final class IDPSSODescriptor extends AbstractSSODescriptor implements SchemaVali * * @param \SimpleSAML\SAML2\XML\md\SingleSignOnService[] $singleSignOnService * @param string[] $protocolSupportEnumeration - * @param bool|null $wantAuthnRequestsSigned + * @param \SimpleSAML\XML\Type\BooleanValue|null $wantAuthnRequestsSigned * @param \SimpleSAML\SAML2\XML\md\NameIDMappingService[] $nameIDMappingService * @param \SimpleSAML\SAML2\XML\md\AssertionIDRequestService[] $assertionIDRequestService * @param \SimpleSAML\SAML2\XML\md\AttributeProfile[] $attributeProfile * @param \SimpleSAML\SAML2\XML\saml\Attribute[] $attribute - * @param string|null $ID - * @param \DateTimeImmutable|null $validUntil - * @param string|null $cacheDuration + * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions - * @param string|null $errorURL + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contact @@ -54,16 +53,16 @@ final class IDPSSODescriptor extends AbstractSSODescriptor implements SchemaVali public function __construct( protected array $singleSignOnService, array $protocolSupportEnumeration, - protected ?bool $wantAuthnRequestsSigned = null, + protected ?BooleanValue $wantAuthnRequestsSigned = null, protected array $nameIDMappingService = [], protected array $assertionIDRequestService = [], protected array $attributeProfile = [], protected array $attribute = [], - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptor = [], ?Organization $organization = null, array $contact = [], @@ -121,9 +120,9 @@ public function __construct( /** * Collect the value of the WantAuthnRequestsSigned-property * - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function wantAuthnRequestsSigned(): ?bool + public function wantAuthnRequestsSigned(): ?BooleanValue { return $this->wantAuthnRequestsSigned; } @@ -203,8 +202,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, IDPSSODescriptor::NS, InvalidDOMElementException::class); $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( @@ -232,17 +229,17 @@ public static function fromXML(DOMElement $xml): static $idpssod = new static( SingleSignOnService::getChildrenOfClass($xml), - preg_split('/[\s]+/', trim($protocols)), - self::getOptionalBooleanAttribute($xml, 'WantAuthnRequestsSigned', null), + preg_split('/[\s]+/', trim($protocols->getValue())), + self::getOptionalAttribute($xml, 'WantAuthnRequestsSigned', BooleanValue::class, null), NameIDMappingService::getChildrenOfClass($xml), AssertionIDRequestService::getChildrenOfClass($xml), AttributeProfile::getChildrenOfClass($xml), Attribute::getChildrenOfClass($xml), - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), KeyDescriptor::getChildrenOfClass($xml), !empty($orgs) ? $orgs[0] : null, ContactPerson::getChildrenOfClass($xml), @@ -270,8 +267,11 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); - if (is_bool($this->wantAuthnRequestsSigned)) { - $e->setAttribute('WantAuthnRequestsSigned', $this->wantAuthnRequestsSigned ? 'true' : 'false'); + if ($this->wantAuthnRequestsSigned() !== null) { + $e->setAttribute( + 'WantAuthnRequestsSigned', + var_export($this->wantAuthnRequestsSigned()->toBoolean(), true), + ); } foreach ($this->getSingleSignOnService() as $ep) { diff --git a/src/XML/md/IndexedElementTrait.php b/src/XML/md/IndexedElementTrait.php index 9caca86502..ba2d8c6a48 100644 --- a/src/XML/md/IndexedElementTrait.php +++ b/src/XML/md/IndexedElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\Assert\Assert; +use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; /** * Trait adding methods to handle elements that can be indexed. @@ -16,24 +16,24 @@ trait IndexedElementTrait /** * The index for this endpoint. * - * @var int + * @var \SimpleSAML\XML\Type\UnsignedShortValue */ - protected int $index; + protected UnsignedShortValue $index; /** * Whether this endpoint is the default. * - * @var bool|null + * @var \SimpleSAML\XML\Type\BooleanValue|null */ - protected ?bool $isDefault = null; + protected ?BooleanValue $isDefault = null; /** * Collect the value of the index property. * - * @return int + * @return \SimpleSAML\XML\Type\UnsignedShortValue */ - public function getIndex(): int + public function getIndex(): UnsignedShortValue { return $this->index; } @@ -42,12 +42,10 @@ public function getIndex(): int /** * Set the value of the index property. * - * @param int $index - * @throws \SimpleSAML\Assert\AssertionFailedException + * @param \SimpleSAML\XML\Type\UnsignedShortValue $index */ - protected function setIndex(int $index): void + protected function setIndex(UnsignedShortValue $index): void { - Assert::range($index, 0, 65535); $this->index = $index; } @@ -55,9 +53,9 @@ protected function setIndex(int $index): void /** * Collect the value of the isDefault property. * - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function getIsDefault(): ?bool + public function getIsDefault(): ?BooleanValue { return $this->isDefault; } @@ -66,9 +64,9 @@ public function getIsDefault(): ?bool /** * Set the value of the isDefault property. * - * @param bool|null $flag + * @param \SimpleSAML\XML\Type\BooleanValue|null $flag */ - protected function setIsDefault(?bool $flag): void + protected function setIsDefault(?BooleanValue $flag): void { $this->isDefault = $flag; } diff --git a/src/XML/md/KeyDescriptor.php b/src/XML/md/KeyDescriptor.php index e3d80c0867..3f43f5d41f 100644 --- a/src/XML/md/KeyDescriptor.php +++ b/src/XML/md/KeyDescriptor.php @@ -5,15 +5,15 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\KeyTypesValue; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use function array_pop; + /** * Class representing a KeyDescriptor element. * @@ -28,19 +28,14 @@ final class KeyDescriptor extends AbstractMdElement implements SchemaValidatable * KeyDescriptor constructor. * * @param \SimpleSAML\XMLSecurity\XML\ds\KeyInfo $keyInfo - * @param string|null $use + * @param \SimpleSAML\SAML2\XML\md\KeyTypesValue|null $use * @param \SimpleSAML\SAML2\XML\md\EncryptionMethod[] $encryptionMethod */ public function __construct( protected KeyInfo $keyInfo, - protected ?string $use = null, + protected ?KeyTypesValue $use = null, protected array $encryptionMethod = [], ) { - Assert::nullOrOneOf( - $use, - ['encryption', 'signing'], - 'The "use" attribute of a KeyDescriptor can only be "encryption" or "signing".', - ); Assert::maxCount($encryptionMethod, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($encryptionMethod, EncryptionMethod::class); } @@ -49,9 +44,9 @@ public function __construct( /** * Collect the value of the use property. * - * @return string|null + * @return \SimpleSAML\SAML2\XML\saml\KeyTypesValue|null */ - public function getUse(): ?string + public function getUse(): ?KeyTypesValue { return $this->use; } @@ -97,23 +92,13 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'KeyDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, KeyDescriptor::NS, InvalidDOMElementException::class); - $keyInfoElements = KeyInfo::getChildrenOfClass($xml); - Assert::minCount( - $keyInfoElements, - 1, - 'No ds:KeyInfo in the KeyDescriptor.', - MissingElementException::class, - ); - Assert::maxCount( - $keyInfoElements, - 1, - 'More than one ds:KeyInfo in the KeyDescriptor.', - TooManyElementsException::class, - ); + $keyInfo = KeyInfo::getChildrenOfClass($xml); + Assert::minCount($keyInfo, 1, 'No ds:KeyInfo in the KeyDescriptor.', MissingElementException::class); + Assert::maxCount($keyInfo, 1, 'Too many ds:KeyInfo in the KeyDescriptor.', TooManyElementsException::class); return new static( - $keyInfoElements[0], - self::getOptionalAttribute($xml, 'use', null), + array_pop($keyInfo), + self::getOptionalAttribute($xml, 'use', KeyTypesValue::class, null), EncryptionMethod::getChildrenOfClass($xml), ); } @@ -130,7 +115,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getUse() !== null) { - $e->setAttribute('use', $this->getUse()); + $e->setAttribute('use', $this->getUse()->getValue()); } $this->getKeyInfo()->toXML($e); diff --git a/src/XML/md/KeyTypesEnum.php b/src/XML/md/KeyTypesEnum.php new file mode 100644 index 0000000000..a00f673149 --- /dev/null +++ b/src/XML/md/KeyTypesEnum.php @@ -0,0 +1,11 @@ +setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/md/NameIDMappingService.php b/src/XML/md/NameIDMappingService.php index 58b75fa5c8..7742e5c405 100644 --- a/src/XML/md/NameIDMappingService.php +++ b/src/XML/md/NameIDMappingService.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\Assert\Assert; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing an md:NameIDMappingService element. @@ -23,22 +23,23 @@ final class NameIDMappingService extends AbstractEndpointType implements SchemaV * * This is an endpoint with one restriction: it cannot contain a ResponseLocation. * - * @param string $binding - * @param string $location - * @param string|null $unused + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $unused * @param array $attributes * @throws \SimpleSAML\Assert\AssertionFailedException */ public function __construct( - string $binding, - string $location, - ?string $unused = null, + SAMLAnyURIValue $binding, + SAMLAnyURIValue $location, + ?SAMLAnyURIValue $unused = null, array $attributes = [], ) { Assert::null( $unused, 'The \'ResponseLocation\' attribute must be omitted for md:NameIDMappingService.', ); + parent::__construct($binding, $location, null, $attributes); } } diff --git a/src/XML/md/Organization.php b/src/XML/md/Organization.php index dbf9ade176..b40a25529a 100644 --- a/src/XML/md/Organization.php +++ b/src/XML/md/Organization.php @@ -5,19 +5,14 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\XsNamespace as NS; use function array_change_key_case; diff --git a/src/XML/md/OrganizationDisplayName.php b/src/XML/md/OrganizationDisplayName.php index a30e057005..0c30847624 100644 --- a/src/XML/md/OrganizationDisplayName.php +++ b/src/XML/md/OrganizationDisplayName.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * A localized name representing an organization's name for display purposes. diff --git a/src/XML/md/OrganizationName.php b/src/XML/md/OrganizationName.php index 7891505fd4..bd1d7e5303 100644 --- a/src/XML/md/OrganizationName.php +++ b/src/XML/md/OrganizationName.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * A localized name representing an organization's name. diff --git a/src/XML/md/OrganizationURL.php b/src/XML/md/OrganizationURL.php index fd02103137..17db0c4918 100644 --- a/src/XML/md/OrganizationURL.php +++ b/src/XML/md/OrganizationURL.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * A localized name representing an organization's url. diff --git a/src/XML/md/PDPDescriptor.php b/src/XML/md/PDPDescriptor.php index 52d537e037..80278d21a2 100644 --- a/src/XML/md/PDPDescriptor.php +++ b/src/XML/md/PDPDescriptor.php @@ -4,15 +4,13 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function preg_split; @@ -34,11 +32,11 @@ final class PDPDescriptor extends AbstractRoleDescriptorType implements SchemaVa * @param string[] $protocolSupportEnumeration * @param \SimpleSAML\SAML2\XML\md\AssertionIDRequestService[] $assertionIDRequestService * @param \SimpleSAML\SAML2\XML\md\NameIDFormat[] $nameIDFormat - * @param string|null $ID - * @param \DateTimeImmutable|null $validUntil - * @param string|null $cacheDuration + * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions - * @param string|null $errorURL + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptors * @param \SimpleSAML\SAML2\XML\md\ContactPerson[] $contacts @@ -49,11 +47,11 @@ public function __construct( array $protocolSupportEnumeration, protected array $assertionIDRequestService = [], protected array $nameIDFormat = [], - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, ?Organization $organization = null, array $keyDescriptors = [], array $contacts = [], @@ -142,8 +140,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, PDPDescriptor::NS, InvalidDOMElementException::class); $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( @@ -166,14 +162,14 @@ public static function fromXML(DOMElement $xml): static $pdp = new static( AuthzService::getChildrenOfClass($xml), - preg_split('/[\s]+/', trim($protocols)), + preg_split('/[\s]+/', trim($protocols->getValue())), AssertionIDRequestService::getChildrenOfClass($xml), NameIDFormat::getChildrenOfClass($xml), - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), !empty($orgs) ? $orgs[0] : null, KeyDescriptor::getChildrenOfClass($xml), ContactPerson::getChildrenOfClass($xml), diff --git a/src/XML/md/RequestedAttribute.php b/src/XML/md/RequestedAttribute.php index 3d106a647c..b7771de68d 100644 --- a/src/XML/md/RequestedAttribute.php +++ b/src/XML/md/RequestedAttribute.php @@ -5,12 +5,12 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\Exception\InvalidDOMElementException; - -use function is_bool; +use SimpleSAML\XML\Type\BooleanValue; /** * Class representing SAML 2 metadata RequestedAttribute. @@ -32,17 +32,17 @@ final class RequestedAttribute extends Attribute /** * RequestedAttribute constructor. * - * @param string $Name - * @param bool|null $isRequired - * @param string|null $NameFormat - * @param string|null $FriendlyName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $Name + * @param \SimpleSAML\XML\Type\BooleanValue|null $isRequired + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $NameFormat + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $FriendlyName * @param \SimpleSAML\SAML2\XML\saml\AttributeValue[] $AttributeValues */ public function __construct( - string $Name, - protected ?bool $isRequired = null, - ?string $NameFormat = null, - ?string $FriendlyName = null, + SAMLStringValue $Name, + protected ?BooleanValue $isRequired = null, + ?SAMLAnyURIValue $NameFormat = null, + ?SAMLStringValue $FriendlyName = null, array $AttributeValues = [], ) { parent::__construct($Name, $NameFormat, $FriendlyName, $AttributeValues); @@ -52,9 +52,9 @@ public function __construct( /** * Collect the value of the isRequired-property * - * @return bool|null + * @return \SimpleSAML\SAML2\Type\BooleanValue|null */ - public function getIsRequired(): ?bool + public function getIsRequired(): ?BooleanValue { return $this->isRequired; } @@ -77,10 +77,10 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, RequestedAttribute::NS, InvalidDOMElementException::class); return new static( - self::getAttribute($xml, 'Name'), - self::getOptionalBooleanAttribute($xml, 'isRequired', null), - self::getOptionalAttribute($xml, 'NameFormat', null), - self::getOptionalAttribute($xml, 'FriendlyName', null), + self::getAttribute($xml, 'Name', SAMLStringValue::class), + self::getOptionalAttribute($xml, 'isRequired', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'NameFormat', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'FriendlyName', SAMLStringValue::class, null), AttributeValue::getChildrenOfClass($xml), ); } @@ -96,8 +96,8 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = parent::toXML($parent); - if (is_bool($this->getIsRequired())) { - $e->setAttribute('isRequired', $this->getIsRequired() ? 'true' : 'false'); + if ($this->getIsRequired()?->toBoolean() !== null) { + $e->setAttribute('isRequired', $this->getIsRequired()->toBoolean() ? 'true' : 'false'); } return $e; diff --git a/src/XML/md/SPSSODescriptor.php b/src/XML/md/SPSSODescriptor.php index cf53aa0041..a494e1df44 100644 --- a/src/XML/md/SPSSODescriptor.php +++ b/src/XML/md/SPSSODescriptor.php @@ -4,20 +4,18 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{BooleanValue, DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_filter; -use function is_bool; use function preg_split; +use function var_export; /** * Class representing SAML 2 SPSSODescriptor. @@ -34,14 +32,14 @@ final class SPSSODescriptor extends AbstractSSODescriptor implements SchemaValid * * @param array<\SimpleSAML\SAML2\XML\md\AssertionConsumerService> $assertionConsumerService * @param string[] $protocolSupportEnumeration - * @param bool|null $authnRequestsSigned - * @param bool|null $wantAssertionsSigned + * @param \SimpleSAML\XML\Type\BooleanValue|null $authnRequestsSigned + * @param \SimpleSAML\XML\Type\BooleanValue|null $wantAssertionsSigned * @param array<\SimpleSAML\SAML2\XML\md\AttributeConsumingService> $attributeConsumingService - * @param string|null $ID - * @param \DateTimeImmutable|null $validUntil - * @param string|null $cacheDuration + * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions - * @param string|null $errorURL + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param array<\SimpleSAML\SAML2\XML\md\KeyDescriptor> $keyDescriptors * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization * @param array<\SimpleSAML\SAML2\XML\md\ContactPerson> $contacts @@ -53,14 +51,14 @@ final class SPSSODescriptor extends AbstractSSODescriptor implements SchemaValid public function __construct( protected array $assertionConsumerService, array $protocolSupportEnumeration, - protected ?bool $authnRequestsSigned = null, - protected ?bool $wantAssertionsSigned = null, + protected ?BooleanValue $authnRequestsSigned = null, + protected ?BooleanValue $wantAssertionsSigned = null, protected array $attributeConsumingService = [], - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptors = [], ?Organization $organization = null, array $contacts = [], @@ -106,7 +104,7 @@ public function __construct( array_filter( $attributeConsumingService, function (AttributeConsumingService $acs) { - return $acs->getIsDefault() === true; + return $acs->getIsDefault()?->toBoolean() === true; }, ), 1, @@ -118,9 +116,9 @@ function (AttributeConsumingService $acs) { /** * Collect the value of the AuthnRequestsSigned-property * - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function getAuthnRequestsSigned(): ?bool + public function getAuthnRequestsSigned(): ?BooleanValue { return $this->authnRequestsSigned; } @@ -129,9 +127,9 @@ public function getAuthnRequestsSigned(): ?bool /** * Collect the value of the WantAssertionsSigned-property * - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function getWantAssertionsSigned(): ?bool + public function getWantAssertionsSigned(): ?BooleanValue { return $this->wantAssertionsSigned; } @@ -177,9 +175,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'SPSSODescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SPSSODescriptor::NS, InvalidDOMElementException::class); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); + $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( @@ -207,15 +203,15 @@ public static function fromXML(DOMElement $xml): static $spssod = new static( AssertionConsumerService::getChildrenOfClass($xml), - preg_split('/[\s]+/', trim($protocols)), - self::getOptionalBooleanAttribute($xml, 'AuthnRequestsSigned', null), - self::getOptionalBooleanAttribute($xml, 'WantAssertionsSigned', null), + preg_split('/[\s]+/', trim($protocols->getValue())), + self::getOptionalAttribute($xml, 'AuthnRequestsSigned', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'WantAssertionsSigned', BooleanValue::class, null), AttributeConsumingService::getChildrenOfClass($xml), - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), KeyDescriptor::getChildrenOfClass($xml), !empty($orgs) ? $orgs[0] : null, ContactPerson::getChildrenOfClass($xml), @@ -244,12 +240,12 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); - if (is_bool($this->getAuthnRequestsSigned())) { - $e->setAttribute('AuthnRequestsSigned', $this->getAuthnRequestsSigned() ? 'true' : 'false'); + if ($this->getAuthnRequestsSigned() !== null) { + $e->setAttribute('AuthnRequestsSigned', var_export($this->getAuthnRequestsSigned()->toBoolean(), true)); } - if (is_bool($this->getWantAssertionsSigned())) { - $e->setAttribute('WantAssertionsSigned', $this->getWantAssertionsSigned() ? 'true' : 'false'); + if ($this->getWantAssertionsSigned() !== null) { + $e->setAttribute('WantAssertionsSigned', var_export($this->getWantAssertionsSigned()->toBoolean(), true)); } foreach ($this->getAssertionConsumerService() as $ep) { diff --git a/src/XML/md/ServiceDescription.php b/src/XML/md/ServiceDescription.php index f749c6ac93..f10807683a 100644 --- a/src/XML/md/ServiceDescription.php +++ b/src/XML/md/ServiceDescription.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * A localized name representing a service's description. diff --git a/src/XML/md/ServiceName.php b/src/XML/md/ServiceName.php index 58f0cf3fd6..6c3f98e3b0 100644 --- a/src/XML/md/ServiceName.php +++ b/src/XML/md/ServiceName.php @@ -4,8 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * A localized name representing a service's name. diff --git a/src/XML/md/SingleSignOnService.php b/src/XML/md/SingleSignOnService.php index ad4b8d9519..fcb4464866 100644 --- a/src/XML/md/SingleSignOnService.php +++ b/src/XML/md/SingleSignOnService.php @@ -4,9 +4,10 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\Assert\Assert; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing an md:SingleSignOnService element. @@ -23,21 +24,22 @@ final class SingleSignOnService extends AbstractEndpointType implements SchemaVa * * This is an endpoint with one restriction: it cannot contain a ResponseLocation. * - * @param string $binding - * @param string $location - * @param string|null $unused + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $unused * @param array $attributes * @throws \SimpleSAML\Assert\AssertionFailedException */ public function __construct( - string $binding, - string $location, - ?string $unused = null, + SAMLAnyURIValue $binding, + SAMLAnyURIValue $location, + ?SAMLAnyURIValue $unused = null, array $attributes = [], ) { Assert::null( $unused, 'The \'ResponseLocation\' attribute must be omitted for md:SingleSignOnService.', + ProtocolViolationException::class, ); parent::__construct($binding, $location, null, $attributes); } diff --git a/src/XML/md/SurName.php b/src/XML/md/SurName.php index d1ec826cc5..f2a3143a77 100644 --- a/src/XML/md/SurName.php +++ b/src/XML/md/SurName.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing SurName. @@ -16,14 +16,8 @@ final class SurName extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/TelephoneNumber.php b/src/XML/md/TelephoneNumber.php index 2eca6e176f..9734d09c21 100644 --- a/src/XML/md/TelephoneNumber.php +++ b/src/XML/md/TelephoneNumber.php @@ -4,12 +4,15 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\{ + ArrayizableElementInterface, + SchemaValidatableElementInterface, + SchemaValidatableElementTrait, + TypedTextContentTrait, +}; use function array_key_first; @@ -23,16 +26,10 @@ final class TelephoneNumber extends AbstractMdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; - + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; /** @@ -46,7 +43,9 @@ public static function fromArray(array $data): static Assert::allString($data, ArrayValidationException::class); $index = array_key_first($data); - return new static($data[$index]); + return new static( + SAMLStringValue::fromString($data[$index]), + ); } @@ -57,6 +56,6 @@ public static function fromArray(array $data): static */ public function toArray(): array { - return [$this->getContent()]; + return [$this->getContent()->getValue()]; } } diff --git a/src/XML/md/UnknownRoleDescriptor.php b/src/XML/md/UnknownRoleDescriptor.php index ce55c7b6e8..47518534da 100644 --- a/src/XML/md/UnknownRoleDescriptor.php +++ b/src/XML/md/UnknownRoleDescriptor.php @@ -4,9 +4,10 @@ namespace SimpleSAML\SAML2\XML\md; -use DateTimeImmutable; use DOMElement; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue}; /** * Class representing unknown RoleDescriptors. @@ -19,13 +20,16 @@ final class UnknownRoleDescriptor extends AbstractRoleDescriptor * Initialize an unknown RoleDescriptor. * * @param \SimpleSAML\XML\Chunk $chunk The whole RoleDescriptor element as a chunk object. - * @param string $type + * @param \SimpleSAML\XML\Type\QNameValue $type * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptors An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -36,13 +40,13 @@ final class UnknownRoleDescriptor extends AbstractRoleDescriptor */ protected function __construct( protected Chunk $chunk, - string $type, + QNameValue $type, array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptors = [], ?Organization $organization = null, array $contacts = [], diff --git a/src/XML/mdattr/EntityAttributes.php b/src/XML/mdattr/EntityAttributes.php index d486a04b3e..01d979d454 100644 --- a/src/XML/mdattr/EntityAttributes.php +++ b/src/XML/mdattr/EntityAttributes.php @@ -5,16 +5,12 @@ namespace SimpleSAML\SAML2\XML\mdattr; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeStatement; -use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\{Assertion, Attribute, AttributeStatement, NameID}; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_filter; use function array_merge; @@ -80,7 +76,7 @@ public function __construct( ); Assert::isEmpty( - $subject?->getSubjectConfirmation(), + $subject->getSubjectConfirmation(), 'Every inside a must NOT contain any SubjectConfirmation', ProtocolViolationException::class, ); @@ -94,7 +90,7 @@ public function __construct( ProtocolViolationException::class, ); Assert::same( - $nameId?->getFormat(), + $nameId?->getFormat()->getValue(), C::NAMEID_ENTITY, sprintf('The NameID format must be %s', C::NAMEID_ENTITY), ProtocolViolationException::class, diff --git a/src/XML/mdrpi/Publication.php b/src/XML/mdrpi/Publication.php index cacff19637..985a86bd64 100644 --- a/src/XML/mdrpi/Publication.php +++ b/src/XML/mdrpi/Publication.php @@ -4,19 +4,13 @@ namespace SimpleSAML\SAML2\XML\mdrpi; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function preg_replace; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class for handling the mdrpi:Publication element. @@ -34,25 +28,24 @@ final class Publication extends AbstractMdrpiElement implements /** * Create/parse a mdrpi:PublicationInfo element. * - * @param string $publisher - * @param \DateTimeImmutable|null $creationInstant - * @param string|null $publicationId + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $publisher + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $creationInstant + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $publicationId */ public function __construct( - protected string $publisher, - protected ?DateTimeImmutable $creationInstant = null, - protected ?string $publicationId = null, + protected SAMLStringValue $publisher, + protected ?SAMLDateTimeValue $creationInstant = null, + protected ?SAMLStringValue $publicationId = null, ) { - Assert::nullOrSame($creationInstant?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); } /** * Collect the value of the publisher-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLStringValue */ - public function getPublisher(): string + public function getPublisher(): SAMLStringValue { return $this->publisher; } @@ -61,9 +54,9 @@ public function getPublisher(): string /** * Collect the value of the creationInstant-property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getCreationInstant(): ?DateTimeImmutable + public function getCreationInstant(): ?SAMLDateTimeValue { return $this->creationInstant; } @@ -72,9 +65,9 @@ public function getCreationInstant(): ?DateTimeImmutable /** * Collect the value of the publicationId-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getPublicationId(): ?string + public function getPublicationId(): ?SAMLStringValue { return $this->publicationId; } @@ -96,19 +89,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'Publication', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Publication::NS, InvalidDOMElementException::class); - $publisher = self::getAttribute($xml, 'publisher'); - $creationInstant = self::getOptionalAttribute($xml, 'creationInstant', null); - - // 2.2.1: Time values MUST be expressed in the UTC timezone using the 'Z' timezone identifier - if ($creationInstant !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $creationInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $creationInstant, 1); - - SAMLAssert::validDateTime($creationInstant, ProtocolViolationException::class); - $creationInstant = new DateTimeImmutable($creationInstant); - } - - $publicationId = self::getOptionalAttribute($xml, 'publicationId', null); + $publisher = self::getAttribute($xml, 'publisher', SAMLStringValue::class); + $creationInstant = self::getOptionalAttribute($xml, 'creationInstant', SAMLDateTimeValue::class, null); + $publicationId = self::getOptionalAttribute($xml, 'publicationId', SAMLStringValue::class, null); return new static($publisher, $creationInstant, $publicationId); } @@ -123,14 +106,14 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('publisher', $this->getPublisher()); + $e->setAttribute('publisher', $this->getPublisher()->getValue()); if ($this->getCreationInstant() !== null) { - $e->setAttribute('creationInstant', $this->getCreationInstant()->format(C::DATETIME_FORMAT)); + $e->setAttribute('creationInstant', $this->getCreationInstant()->getValue()); } if ($this->getPublicationId() !== null) { - $e->setAttribute('publicationId', $this->getPublicationId()); + $e->setAttribute('publicationId', $this->getPublicationId()->getValue()); } return $e; @@ -148,9 +131,9 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['publisher'], - $data['creationInstant'] ?? null, - $data['publicationId'] ?? null, + SAMLStringValue::fromString($data['publisher']), + $data['creationInstant'] !== null ? SAMLDateTimeValue::fromString($data['creationInstant']) : null, + $data['publicationId'] !== null ? SAMLStringValue::fromString($data['publicationId']) : null, ); } @@ -178,8 +161,8 @@ private static function processArrayContents(array $data): array if (array_key_exists('creationinstant', $data)) { Assert::string($data['creationinstant'], ArrayValidationException::class); - SAMLAssert::validDateTime($data['creationinstant'], ArrayValidationException::class); - $retval['creationInstant'] = new DateTimeImmutable($data['creationinstant']); + Assert::validSAMLDateTime($data['creationinstant'], ArrayValidationException::class); + $retval['creationInstant'] = $data['creationinstant']; } if (array_key_exists('publicationid', $data)) { @@ -199,14 +182,14 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = []; - $data['publisher'] = $this->getPublisher(); + $data['publisher'] = $this->getPublisher()->getValue(); if ($this->getCreationInstant() !== null) { - $data['creationInstant'] = $this->getCreationInstant()->format(C::DATETIME_FORMAT); + $data['creationInstant'] = $this->getCreationInstant()->getValue(); } if ($this->getPublicationId() !== null) { - $data['publicationId'] = $this->getPublicationId(); + $data['publicationId'] = $this->getPublicationId()->getValue(); } return $data; diff --git a/src/XML/mdrpi/PublicationInfo.php b/src/XML/mdrpi/PublicationInfo.php index f3656103fc..d5b929acdb 100644 --- a/src/XML/mdrpi/PublicationInfo.php +++ b/src/XML/mdrpi/PublicationInfo.php @@ -4,21 +4,17 @@ namespace SimpleSAML\SAML2\XML\mdrpi; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_change_key_case; use function array_keys; -use function preg_replace; /** * Class for handling the mdrpi:PublicationInfo element. @@ -36,18 +32,17 @@ final class PublicationInfo extends AbstractMdrpiElement implements /** * Create/parse a mdrpi:PublicationInfo element. * - * @param string $publisher - * @param \DateTimeImmutable|null $creationInstant - * @param string|null $publicationId + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $publisher + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $creationInstant + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $publicationId * @param \SimpleSAML\SAML2\XML\mdrpi\UsagePolicy[] $usagePolicy */ public function __construct( - protected string $publisher, - protected ?DateTimeImmutable $creationInstant = null, - protected ?string $publicationId = null, + protected SAMLStringValue $publisher, + protected ?SAMLDateTimeValue $creationInstant = null, + protected ?SAMLStringValue $publicationId = null, protected array $usagePolicy = [], ) { - Assert::nullOrSame($creationInstant?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); Assert::maxCount($usagePolicy, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($usagePolicy, UsagePolicy::class); @@ -73,9 +68,9 @@ function ($up) { /** * Collect the value of the publisher-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLStringValue */ - public function getPublisher(): string + public function getPublisher(): SAMLStringValue { return $this->publisher; } @@ -84,9 +79,9 @@ public function getPublisher(): string /** * Collect the value of the creationInstant-property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getCreationInstant(): ?DateTimeImmutable + public function getCreationInstant(): ?SAMLDateTimeValue { return $this->creationInstant; } @@ -95,9 +90,9 @@ public function getCreationInstant(): ?DateTimeImmutable /** * Collect the value of the publicationId-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getPublicationId(): ?string + public function getPublicationId(): ?SAMLStringValue { return $this->publicationId; } @@ -130,19 +125,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'PublicationInfo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, PublicationInfo::NS, InvalidDOMElementException::class); - $publisher = self::getAttribute($xml, 'publisher'); - $creationInstant = self::getOptionalAttribute($xml, 'creationInstant', null); - - // 2.2.1: Time values MUST be expressed in the UTC timezone using the 'Z' timezone identifier - if ($creationInstant !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $creationInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $creationInstant, 1); - - SAMLAssert::validDateTime($creationInstant, ProtocolViolationException::class); - $creationInstant = new DateTimeImmutable($creationInstant); - } - - $publicationId = self::getOptionalAttribute($xml, 'publicationId', null); + $publisher = self::getAttribute($xml, 'publisher', SAMLStringValue::class); + $creationInstant = self::getOptionalAttribute($xml, 'creationInstant', SAMLDateTimeValue::class, null); + $publicationId = self::getOptionalAttribute($xml, 'publicationId', SAMLStringValue::class, null); $UsagePolicy = UsagePolicy::getChildrenOfClass($xml); return new static($publisher, $creationInstant, $publicationId, $UsagePolicy); @@ -158,14 +143,14 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('publisher', $this->getPublisher()); + $e->setAttribute('publisher', $this->getPublisher()->getValue()); if ($this->getCreationInstant() !== null) { - $e->setAttribute('creationInstant', $this->getCreationInstant()->format(C::DATETIME_FORMAT)); + $e->setAttribute('creationInstant', $this->getCreationInstant()->getValue()); } if ($this->getPublicationId() !== null) { - $e->setAttribute('publicationId', $this->getPublicationId()); + $e->setAttribute('publicationId', $this->getPublicationId()->getValue()); } foreach ($this->getUsagePolicy() as $up) { @@ -187,9 +172,9 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['publisher'], - $data['creationInstant'] ?? null, - $data['publicationId'] ?? null, + SAMLStringValue::fromString($data['publisher']), + $data['creationInstant'] !== null ? SAMLDateTimeValue::fromString($data['creationInstant']) : null, + $data['publicationId'] !== null ? SAMLStringValue::fromString($data['publicationId']) : null, $data['UsagePolicy'] ?? [], ); } @@ -218,8 +203,8 @@ private static function processArrayContents(array $data): array if (array_key_exists('creationinstant', $data)) { Assert::string($data['creationinstant'], ArrayValidationException::class); - SAMLAssert::validDateTime($data['creationinstant'], ArrayValidationException::class); - $retval['creationInstant'] = new DateTimeImmutable($data['creationinstant']); + Assert::validSAMLDateTime($data['creationinstant'], ArrayValidationException::class); + $retval['creationInstant'] = $data['creationinstant']; } if (array_key_exists('publicationid', $data)) { @@ -246,14 +231,14 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = []; - $data['publisher'] = $this->getPublisher(); + $data['publisher'] = $this->getPublisher()->getValue(); if ($this->getCreationInstant() !== null) { - $data['creationInstant'] = $this->getCreationInstant()->format(C::DATETIME_FORMAT); + $data['creationInstant'] = $this->getCreationInstant()->getValue(); } if ($this->getPublicationId() !== null) { - $data['publicationId'] = $this->getPublicationId(); + $data['publicationId'] = $this->getPublicationId()->getValue(); } if (!empty($this->getUsagePolicy())) { diff --git a/src/XML/mdrpi/PublicationPath.php b/src/XML/mdrpi/PublicationPath.php index 756109c1be..f71336fa4f 100644 --- a/src/XML/mdrpi/PublicationPath.php +++ b/src/XML/mdrpi/PublicationPath.php @@ -5,13 +5,12 @@ namespace SimpleSAML\SAML2\XML\mdrpi; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class for handling the mdrpi:PublicationPath element. diff --git a/src/XML/mdrpi/RegistrationInfo.php b/src/XML/mdrpi/RegistrationInfo.php index 24fe1d700d..976203157d 100644 --- a/src/XML/mdrpi/RegistrationInfo.php +++ b/src/XML/mdrpi/RegistrationInfo.php @@ -4,19 +4,14 @@ namespace SimpleSAML\SAML2\XML\mdrpi; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function preg_replace; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class for handling the mdrpi:RegistrationInfo element. @@ -34,16 +29,15 @@ final class RegistrationInfo extends AbstractMdrpiElement implements /** * Create/parse a mdrpi:RegistrationInfo element. * - * @param string $registrationAuthority - * @param \DateTimeImmutable|null $registrationInstant + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $registrationAuthority + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $registrationInstant * @param \SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy[] $registrationPolicy */ public function __construct( - protected string $registrationAuthority, - protected ?DateTimeImmutable $registrationInstant = null, + protected SAMLStringValue $registrationAuthority, + protected ?SAMLDateTimeValue $registrationInstant = null, protected array $registrationPolicy = [], ) { - Assert::nullOrSame($registrationInstant?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); Assert::maxCount($registrationPolicy, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($registrationPolicy, RegistrationPolicy::class); @@ -69,9 +63,9 @@ function ($rp) { /** * Collect the value of the RegistrationAuthority property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLStringValue */ - public function getRegistrationAuthority(): string + public function getRegistrationAuthority(): SAMLStringValue { return $this->registrationAuthority; } @@ -80,9 +74,9 @@ public function getRegistrationAuthority(): string /** * Collect the value of the registrationInstant property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getRegistrationInstant(): ?DateTimeImmutable + public function getRegistrationInstant(): ?SAMLDateTimeValue { return $this->registrationInstant; } @@ -115,17 +109,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'RegistrationInfo', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RegistrationInfo::NS, InvalidDOMElementException::class); - $registrationAuthority = self::getAttribute($xml, 'registrationAuthority'); - $registrationInstant = self::getOptionalAttribute($xml, 'registrationInstant', null); - - // 2.1.1: Time values MUST be expressed in the UTC timezone using the 'Z' timezone identifier - if ($registrationInstant !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $registrationInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $registrationInstant, 1); - - SAMLAssert::validDateTime($registrationInstant, ProtocolViolationException::class); - $registrationInstant = new DateTimeImmutable($registrationInstant); - } + $registrationAuthority = self::getAttribute($xml, 'registrationAuthority', SAMLStringValue::class); + $registrationInstant = self::getOptionalAttribute($xml, 'registrationInstant', SAMLDateTimeValue::class, null); $RegistrationPolicy = RegistrationPolicy::getChildrenOfClass($xml); return new static($registrationAuthority, $registrationInstant, $RegistrationPolicy); @@ -141,10 +126,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('registrationAuthority', $this->getRegistrationAuthority()); + $e->setAttribute('registrationAuthority', $this->getRegistrationAuthority()->getValue()); if ($this->getRegistrationInstant() !== null) { - $e->setAttribute('registrationInstant', $this->getRegistrationInstant()->format(C::DATETIME_FORMAT)); + $e->setAttribute('registrationInstant', $this->getRegistrationInstant()->getValue()); } foreach ($this->getRegistrationPolicy() as $rp) { @@ -166,8 +151,8 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['registrationAuthority'], - $data['registrationInstant'] ?? null, + SAMLStringValue::fromString($data['registrationAuthority']), + $data['registrationInstant'] !== null ? SAMLDateTimeValue::fromString($data['registrationInstant']) : null, $data['RegistrationPolicy'] ?? [], ); } @@ -196,8 +181,8 @@ private static function processArrayContents(array $data): array if (array_key_exists('registrationinstant', $data)) { Assert::string($data['registrationinstant'], ArrayValidationException::class); - SAMLAssert::validDateTime($data['registrationinstant'], ArrayValidationException::class); - $retval['registrationInstant'] = new DateTimeImmutable($data['registrationinstant']); + Assert::validSAMLDateTime($data['registrationinstant'], ArrayValidationException::class); + $retval['registrationInstant'] = $data['registrationinstant']; } if (array_key_exists('registrationpolicy', $data)) { @@ -219,10 +204,10 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = []; - $data['registrationAuthority'] = $this->getRegistrationAuthority(); + $data['registrationAuthority'] = $this->getRegistrationAuthority()->getValue(); if ($this->getRegistrationInstant() !== null) { - $data['registrationInstant'] = $this->getRegistrationInstant()->format(C::DATETIME_FORMAT); + $data['registrationInstant'] = $this->getRegistrationInstant()->getValue(); } if (!empty($this->getRegistrationPolicy())) { diff --git a/src/XML/mdui/DiscoHints.php b/src/XML/mdui/DiscoHints.php index e33097ced7..83f71ef9f6 100644 --- a/src/XML/mdui/DiscoHints.php +++ b/src/XML/mdui/DiscoHints.php @@ -5,17 +5,15 @@ namespace SimpleSAML\SAML2\XML\mdui; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Utils\XPath; +use SimpleSAML\SAML2\Type\{CIDRValue, DomainValue, GeolocationValue}; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; -use SimpleSAML\XML\SerializableElementInterface; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, SerializableElementInterface}; use SimpleSAML\XML\XsNamespace as NS; use function array_filter; @@ -116,10 +114,10 @@ public function addChild(Chunk $child): void */ public function isEmptyElement(): bool { - return empty($this->elements) - && empty($this->ipHint) - && empty($this->domainHint) - && empty($this->geolocationHint); + return empty($this->getElements()) + && empty($this->getIPHint()) + && empty($this->getDomainHint()) + && empty($this->getGeolocationHint()); } @@ -140,13 +138,7 @@ public static function fromXML(DOMElement $xml): static $IPHint = IPHint::getChildrenOfClass($xml); $DomainHint = DomainHint::getChildrenOfClass($xml); $GeolocationHint = GeolocationHint::getChildrenOfClass($xml); - $children = []; - - /** @var \DOMElement[] $nodes */ - $nodes = XPath::xpQuery($xml, "./*[namespace-uri()!='" . DiscoHints::NS . "']", XPath::getXPath($xml)); - foreach ($nodes as $node) { - $children[] = new Chunk($node); - } + $children = self::getChildElementsFromXML($xml); return new static($children, $IPHint, $DomainHint, $GeolocationHint); } @@ -231,7 +223,9 @@ private static function processArrayContents(array $data): array Assert::isArray($data['iphint'], ArrayValidationException::class); Assert::allString($data['iphint'], ArrayValidationException::class); foreach ($data['iphint'] as $hint) { - $retval['IPHint'][] = new IPHint($hint); + $retval['IPHint'][] = new IPHint( + CIDRValue::fromString($hint), + ); } } @@ -239,7 +233,9 @@ private static function processArrayContents(array $data): array Assert::isArray($data['domainhint'], ArrayValidationException::class); Assert::allString($data['domainhint'], ArrayValidationException::class); foreach ($data['domainhint'] as $hint) { - $retval['DomainHint'][] = new DomainHint($hint); + $retval['DomainHint'][] = new DomainHint( + DomainValue::fromString($hint), + ); } } @@ -247,7 +243,9 @@ private static function processArrayContents(array $data): array Assert::isArray($data['geolocationhint'], ArrayValidationException::class); Assert::allString($data['geolocationhint'], ArrayValidationException::class); foreach ($data['geolocationhint'] as $hint) { - $retval['GeolocationHint'][] = new GeolocationHint($hint); + $retval['GeolocationHint'][] = new GeolocationHint( + GeolocationValue::fromString($hint), + ); } } diff --git a/src/XML/mdui/DomainHint.php b/src/XML/mdui/DomainHint.php index 715f9f2cf9..a488ddf570 100644 --- a/src/XML/mdui/DomainHint.php +++ b/src/XML/mdui/DomainHint.php @@ -4,17 +4,9 @@ namespace SimpleSAML\SAML2\XML\mdui; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Exception\InvalidArgumentException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function filter_var; -use function preg_replace; -use function rtrim; -use function sprintf; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing DomainHint. @@ -24,46 +16,8 @@ final class DomainHint extends AbstractMduiElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; - - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } - - - /** - * Sanitize the content of the element. - * - * @param string $content The unsanitized textContent - * @throws \Exception on failure - * @return string - */ - protected function sanitizeContent(string $content): string - { - // Remove prefixed schema and/or trailing whitespace + forward slashes - return rtrim(preg_replace('#^http[s]?://#i', '', $content), " \n\r\t\v\x00/"); - } - - - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - $sanitizedContent = $this->sanitizeContent($content); - Assert::notWhitespaceOnly($sanitizedContent, ProtocolViolationException::class); + use TypedTextContentTrait; - if (!filter_var($sanitizedContent, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) { - throw new InvalidArgumentException(sprintf('DomainHint is not a valid hostname; %s', $sanitizedContent)); - } - } + /** @var string */ + public const TEXTCONTENT_TYPE = DomainValue::class; } diff --git a/src/XML/mdui/GeolocationHint.php b/src/XML/mdui/GeolocationHint.php index c72a5e05e0..684fcd00c8 100644 --- a/src/XML/mdui/GeolocationHint.php +++ b/src/XML/mdui/GeolocationHint.php @@ -4,12 +4,9 @@ namespace SimpleSAML\SAML2\XML\mdui; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\GeolocationValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing GeolocationHint. @@ -19,62 +16,8 @@ final class GeolocationHint extends AbstractMduiElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } - - - /** - * Set the content of the element. - * - * @param string $content The value to go in the XML textContent - */ - protected function setContent(string $content): void - { - $sanitized = $this->sanitizeContent($content); - $this->validateContent($sanitized); - - // Store the email address with any whitespace removed - $this->content = $sanitized; - } - - - /** - * Sanitize the content of the element. - * - * @param string $content The unsanitized textContent - * @throws \Exception on failure - * @return string - */ - protected function sanitizeContent(string $content): string - { - return preg_replace('/\s+/', '', $content); - } - - - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - Assert::notWhitespaceOnly($content, ProtocolViolationException::class); - // Assert::regex( - // $content, - // '/^geo:([-+]?\d+(?:\.\d+)?),([-+]?\d+(?:\.\d+)?)(?:\?z=(\d{1,2}))?$/', - // 'Content is not a valid geolocation: %s' - // ); - // The regex above is incomplete, so for now we only test for a valid URI - SAMLAssert::validURI($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = GeolocationValue::class; } diff --git a/src/XML/mdui/IPHint.php b/src/XML/mdui/IPHint.php index 18a039813d..eb8a17d54d 100644 --- a/src/XML/mdui/IPHint.php +++ b/src/XML/mdui/IPHint.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\mdui; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\CIDRValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class implementing IPHint. @@ -16,14 +16,9 @@ final class IPHint extends AbstractMduiElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = CIDRValue::class; } diff --git a/src/XML/mdui/Keywords.php b/src/XML/mdui/Keywords.php index 7c302bd3dd..38ce3d7f05 100644 --- a/src/XML/mdui/Keywords.php +++ b/src/XML/mdui/Keywords.php @@ -5,18 +5,16 @@ namespace SimpleSAML\SAML2\XML\mdui; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Type\ListOfStringsValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; -use function explode; -use function implode; -use function rtrim; /** * Class for handling the Keywords metadata extensions for login and discovery user interface @@ -29,59 +27,38 @@ final class Keywords extends AbstractMduiElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; + use TypedTextContentTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = ListOfStringsValue::class; + /** * Initialize a Keywords. * - * @param string $lang - * @param string[] $keywords + * @param \SimpleSAML\XML\Type\LanguageValue $lang + * @param \SimpleSAML\SAML2\Type\ListOfStringsValue $keywords */ public function __construct( - protected string $lang, - protected array $keywords = [], + protected LanguageValue $lang, + ListOfStringsValue $keywords, ) { - Assert::maxCount($keywords, C::UNBOUNDED_LIMIT); - Assert::allNotContains($keywords, '+', 'Keywords may not contain a "+" character.'); + $this->setContent($keywords); } /** * Collect the value of the lang-property * - * @return string + * @return \SimpleSAML\XML\Type\LanguageValue */ - public function getLanguage(): string + public function getLanguage(): LanguageValue { return $this->lang; } - /** - * Collect the value of the Keywords-property - * - * @return string[] - */ - public function getKeywords(): array - { - return $this->keywords; - } - - - /** - * Add the value to the Keywords-property - * - * @param string $keyword - * - * @throws \SimpleSAML\Assert\AssertionFailedException if the keyword contains a `+` - */ - public function addKeyword(string $keyword): void - { - Assert::notContains($keyword, '+', 'Keyword may not contain a "+" character.'); - $this->keywords[] = $keyword; - } - - /** * Convert XML into a Keywords * @@ -99,8 +76,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, Keywords::NS, InvalidDOMElementException::class); Assert::stringNotEmpty($xml->textContent, 'Missing value for Keywords.'); - $lang = self::getAttribute($xml, 'xml:lang'); - $Keywords = explode('+', $xml->textContent); + $lang = self::getAttribute($xml, 'xml:lang', LanguageValue::class); + $Keywords = ListOfStringsValue::fromString($xml->textContent); return new static($lang, $Keywords); } @@ -117,8 +94,8 @@ public function toXML(?DOMElement $parent = null): DOMElement { /** @psalm-var \DOMDocument $e->ownerDocument */ $e = $this->instantiateParentElement($parent); - $e->setAttribute('xml:lang', $this->getLanguage()); - $e->textContent = rtrim(implode('+', $this->getKeywords())); + $e->setAttribute('xml:lang', $this->getLanguage()->getValue()); + $e->textContent = $this->getContent()->getValue(); return $e; } @@ -135,10 +112,12 @@ public static function fromArray(array $data): static Assert::notEmpty($data, ArrayValidationException::class); Assert::count($data, 1, ArrayValidationException::class); - $lang = array_key_first($data); - $keywords = $data[$lang]; + $lang = LanguageValue::fromString(array_key_first($data)); + $keywords = $data[$lang->getValue()]; + + Assert::allNotContains($keywords, '+', ProtocolViolationException::class); - return new static($lang, $keywords); + return new static($lang, ListOfStringsValue::fromArray($keywords)); } @@ -149,6 +128,6 @@ public static function fromArray(array $data): static */ public function toArray(): array { - return [$this->getLanguage() => $this->getKeywords()]; + return [$this->getLanguage()->getValue() => $this->getContent()->toArray()]; } } diff --git a/src/XML/mdui/Logo.php b/src/XML/mdui/Logo.php index 2c553d3564..c73129a418 100644 --- a/src/XML/mdui/Logo.php +++ b/src/XML/mdui/Logo.php @@ -5,21 +5,14 @@ namespace SimpleSAML\SAML2\XML\mdui; use DOMElement; -use InvalidArgumentException; -use SimpleSAML\Assert\Assert; -//use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\StringElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function filter_var; -use function strval; -use function substr; -use function trim; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class for handling the Logo metadata extensions for login and discovery user interface @@ -32,22 +25,28 @@ final class Logo extends AbstractMduiElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + + /** @var string */ + private static string $scheme_regex = '/^(data|http[s]?[:])/i'; /** * Initialize a Logo. * - * @param string $url - * @param int $height - * @param int $width - * @param string|null $lang + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $url + * @param \SimpleSAML\XML\Type\PositiveIntegerValue $height + * @param \SimpleSAML\XML\Type\PositiveIntegerValue $width + * @param \SimpleSAML\XML\Type\LanguageValue|null $lang */ public function __construct( - protected string $url, - protected int $height, - protected int $width, - protected ?string $lang = null, + SAMLAnyURIValue $url, + protected PositiveIntegerValue $height, + protected PositiveIntegerValue $width, + protected ?LanguageValue $lang = null, ) { $this->setContent($url); } @@ -62,21 +61,17 @@ public function __construct( */ protected function validateContent(string $content): void { - // NOTE: we override the validateContent from the trait to be able to be less restrictive - // SAMLAssert::validURI($content, SchemaViolationException::class); - Assert::notWhitespaceOnly($content, ProtocolViolationException::class); - if (!filter_var(trim($content), FILTER_VALIDATE_URL) && substr(trim($content), 0, 5) !== 'data:') { - throw new InvalidArgumentException('mdui:Logo is not a valid URL.'); - } + Assert::validURI($content, SchemaViolationException::class); + Assert::regex(self::$scheme_regex, $content, ProtocolViolationException::class); } /** * Collect the value of the lang-property * - * @return string|null + * @return \SimpleSAML\XML\Type\LanguageValue|null */ - public function getLanguage(): ?string + public function getLanguage(): ?LanguageValue { return $this->lang; } @@ -85,9 +80,9 @@ public function getLanguage(): ?string /** * Collect the value of the height-property * - * @return int + * @return \SimpleSAML\XML\Type\PositiveIntegerValue */ - public function getHeight(): int + public function getHeight(): PositiveIntegerValue { return $this->height; } @@ -96,9 +91,9 @@ public function getHeight(): int /** * Collect the value of the width-property * - * @return int + * @return \SimpleSAML\XML\Type\PositiveIntegerValue */ - public function getWidth(): int + public function getWidth(): PositiveIntegerValue { return $this->width; } @@ -121,10 +116,10 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, Logo::NS, InvalidDOMElementException::class); Assert::stringNotEmpty($xml->textContent, 'Missing url value for Logo.'); - $Url = $xml->textContent; - $Width = self::getIntegerAttribute($xml, 'width'); - $Height = self::getIntegerAttribute($xml, 'height'); - $lang = self::getOptionalAttribute($xml, 'xml:lang', null); + $Url = SAMLAnyURIValue::fromString($xml->textContent); + $Width = self::getAttribute($xml, 'width', PositiveIntegerValue::class); + $Height = self::getAttribute($xml, 'height', PositiveIntegerValue::class); + $lang = self::getOptionalAttribute($xml, 'xml:lang', LanguageValue::class, null); return new static($Url, $Height, $Width, $lang); } @@ -139,12 +134,12 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); - $e->setAttribute('height', strval($this->getHeight())); - $e->setAttribute('width', strval($this->getWidth())); + $e->textContent = $this->getContent()->getValue(); + $e->setAttribute('height', $this->getHeight()->getValue()); + $e->setAttribute('width', $this->getWidth()->getValue()); if ($this->getLanguage() !== null) { - $e->setAttribute('xml:lang', $this->getLanguage()); + $e->setAttribute('xml:lang', $this->getLanguage()->getValue()); } return $e; @@ -161,7 +156,12 @@ public static function fromArray(array $data): static { $data = self::processArrayContents($data); - return new static($data['url'], $data['height'], $data['width'], $data['lang'] ?? null); + return new static( + SAMLAnyURIValue::fromString($data['url']), + PositiveIntegerValue::fromInteger($data['height']), + PositiveIntegerValue::fromInteger($data['width']), + $data['lang'] !== null ? LanguageValue::fromString($data['lang']) : null, + ); } @@ -217,12 +217,12 @@ private static function processArrayContents(array $data): array */ public function toArray(): array { - $lang = $this->getLanguage(); + $lang = $this->getLanguage()?->getValue(); return [ - 'url' => $this->getContent(), - 'width' => $this->getWidth(), - 'height' => $this->getHeight(), + 'url' => $this->getContent()->getValue(), + 'width' => $this->getWidth()->toInteger(), + 'height' => $this->getHeight()->toInteger(), ] + (isset($lang) ? ['lang' => $lang] : []); } } diff --git a/src/XML/mdui/UIInfo.php b/src/XML/mdui/UIInfo.php index 0d1e82c317..073cedbe23 100644 --- a/src/XML/mdui/UIInfo.php +++ b/src/XML/mdui/UIInfo.php @@ -5,18 +5,14 @@ namespace SimpleSAML\SAML2\XML\mdui; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Utils\XPath; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; -use SimpleSAML\XML\SerializableElementInterface; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, SerializableElementInterface}; use SimpleSAML\XML\XsNamespace as NS; use function array_filter; @@ -222,13 +218,13 @@ public function addChild(Chunk $child): void */ public function isEmptyElement(): bool { - return empty($this->displayName) - && empty($this->description) - && empty($this->informationURL) - && empty($this->privacyStatementURL) - && empty($this->keywords) - && empty($this->logo) - && empty($this->elements); + return empty($this->getDisplayName()) + && empty($this->getDescription()) + && empty($this->getInformationURL()) + && empty($this->getPrivacyStatementURL()) + && empty($this->getKeywords()) + && empty($this->getLogo()) + && empty($this->getElements()); } @@ -282,14 +278,7 @@ public static function fromXML(DOMElement $xml): static $PrivacyStatementURL = PrivacyStatementURL::getChildrenOfClass($xml); $Keywords = Keywords::getChildrenOfClass($xml); $Logo = Logo::getChildrenOfClass($xml); - $children = []; - - /** @var \DOMElement $node */ - foreach (XPath::xpQuery($xml, './*', XPath::getXPath($xml)) as $node) { - if ($node->namespaceURI !== UIInfo::NS) { - $children[] = new Chunk($node); - } - } + $children = self::getChildElementsFromXML($xml); return new static( $DisplayName, diff --git a/src/XML/saml/AbstractBaseID.php b/src/XML/saml/AbstractBaseID.php index f32d54c69d..b086abf777 100644 --- a/src/XML/saml/AbstractBaseID.php +++ b/src/XML/saml/AbstractBaseID.php @@ -8,21 +8,16 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\EncryptableElementTrait; -use SimpleSAML\SAML2\XML\ExtensionPointInterface; -use SimpleSAML\SAML2\XML\ExtensionPointTrait; +use SimpleSAML\SAML2\XML\{EncryptableElementTrait, ExtensionPointInterface, ExtensionPointTrait}; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\QNameValue; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; -use function count; -use function explode; - /** * SAML BaseID data type. * @@ -45,23 +40,23 @@ abstract class AbstractBaseID extends AbstractBaseIDType implements /** * Initialize a saml:BaseID from scratch * - * @param string $type - * @param string|null $NameQualifier - * @param string|null $SPNameQualifier + * @param \SimpleSAML\XML\Type\QNameValue $type + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier */ protected function __construct( - protected string $type, - ?string $NameQualifier = null, - ?string $SPNameQualifier = null, + protected QNameValue $type, + ?SAMLStringValue $NameQualifier = null, + ?SAMLStringValue $SPNameQualifier = null, ) { parent::__construct($NameQualifier, $SPNameQualifier); } /** - * @inheritDoc + * @return \SimpleSAML\XML\Type\QNameValue */ - public function getXsiType(): string + public function getXsiType(): QNameValue { return $this->type; } @@ -86,19 +81,7 @@ public static function fromXML(DOMElement $xml): static SchemaViolationException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); - Assert::validQName($type, SchemaViolationException::class); - - // first, try to resolve the type to a full namespaced version - $qname = explode(':', $type, 2); - if (count($qname) === 2) { - list($prefix, $element) = $qname; - } else { - $prefix = null; - list($element) = $qname; - } - $ns = $xml->lookupNamespaceUri($prefix); - $type = ($ns === null) ? $element : implode(':', [$ns, $element]); + $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); @@ -107,8 +90,8 @@ public static function fromXML(DOMElement $xml): static return new UnknownID( new Chunk($xml), $type, - self::getOptionalAttribute($xml, 'NameQualifier', null), - self::getOptionalAttribute($xml, 'SPNameQualifier', null), + self::getOptionalAttribute($xml, 'NameQualifier', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'SPNameQualifier', SAMLStringValue::class, null), ); } @@ -133,18 +116,18 @@ public function toXML(?DOMElement $parent = null): DOMElement $e->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:' . static::getXsiTypePrefix(), - static::getXsiTypeNamespaceURI(), + static::getXsiTypeNamespaceURI()->getValue(), ); $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); $type->toXML($e); if ($this->getNameQualifier() !== null) { - $e->setAttribute('NameQualifier', $this->getNameQualifier()); + $e->setAttribute('NameQualifier', $this->getNameQualifier()->getValue()); } if ($this->getSPNameQualifier() !== null) { - $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()); + $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue()); } return $e; diff --git a/src/XML/saml/AbstractBaseIDType.php b/src/XML/saml/AbstractBaseIDType.php index 6e0536c680..d6c11c6964 100644 --- a/src/XML/saml/AbstractBaseIDType.php +++ b/src/XML/saml/AbstractBaseIDType.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLStringValue; /** * SAML BaseID data type. @@ -20,16 +21,16 @@ abstract class AbstractBaseIDType extends AbstractSamlElement implements BaseIde /** * Initialize a saml:BaseIDAbstractType from scratch * - * @param string|null $NameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier * The security or administrative domain that qualifies the identifier. * This attribute provides a means to federate identifiers from disparate user stores without collision. - * @param string|null $SPNameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier * Further qualifies an identifier with the name of a service provider or affiliation of providers. This * attribute provides an additional means to federate identifiers on the basis of the relying party or parties. */ protected function __construct( - protected ?string $NameQualifier = null, - protected ?string $SPNameQualifier = null, + protected ?SAMLStringValue $NameQualifier = null, + protected ?SAMLStringValue $SPNameQualifier = null, ) { Assert::nullOrNotWhitespaceOnly($NameQualifier); Assert::nullOrNotWhitespaceOnly($SPNameQualifier); @@ -47,11 +48,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getNameQualifier() !== null) { - $e->setAttribute('NameQualifier', $this->getNameQualifier()); + $e->setAttribute('NameQualifier', $this->getNameQualifier()->getValue()); } if ($this->getSPNameQualifier() !== null) { - $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()); + $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue()); } return $e; diff --git a/src/XML/saml/AbstractCondition.php b/src/XML/saml/AbstractCondition.php index 2bdd801928..750f718aa7 100644 --- a/src/XML/saml/AbstractCondition.php +++ b/src/XML/saml/AbstractCondition.php @@ -8,17 +8,12 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\ExtensionPointInterface; -use SimpleSAML\SAML2\XML\ExtensionPointTrait; +use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function count; -use function explode; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\QNameValue; /** * SAML Condition data type. @@ -40,18 +35,18 @@ abstract class AbstractCondition extends AbstractConditionType implements /** * Initialize a custom saml:Condition element. * - * @param string $type + * @param \SimpleSAML\XML\Type\QNameValue $type */ protected function __construct( - protected string $type, + protected QNameValue $type, ) { } /** - * @inheritDoc + * @return \SimpleSAML\XML\Type\QNameValue */ - public function getXsiType(): string + public function getXsiType(): QNameValue { return $this->type; } @@ -76,19 +71,7 @@ public static function fromXML(DOMElement $xml): static SchemaViolationException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); - Assert::validQName($type, SchemaViolationException::class); - - // first, try to resolve the type to a full namespaced version - $qname = explode(':', $type, 2); - if (count($qname) === 2) { - list($prefix, $element) = $qname; - } else { - $prefix = null; - list($element) = $qname; - } - $ns = $xml->lookupNamespaceUri($prefix); - $type = ($ns === null) ? $element : implode(':', [$ns, $element]); + $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); @@ -118,7 +101,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:' . static::getXsiTypePrefix(), - static::getXsiTypeNamespaceURI(), + static::getXsiTypeNamespaceURI()->getValue(), ); $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); diff --git a/src/XML/saml/AbstractStatement.php b/src/XML/saml/AbstractStatement.php index 4883e7c320..9db76f9731 100644 --- a/src/XML/saml/AbstractStatement.php +++ b/src/XML/saml/AbstractStatement.php @@ -8,17 +8,12 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\ExtensionPointInterface; -use SimpleSAML\SAML2\XML\ExtensionPointTrait; +use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function count; -use function explode; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\QNameValue; /** * Class implementing the extension point. @@ -40,18 +35,18 @@ abstract class AbstractStatement extends AbstractStatementType implements /** * Initialize a custom saml:Statement element. * - * @param string $type + * @param \SimpleSAML\XML\Type\QNameValue $type */ protected function __construct( - protected string $type, + protected QNameValue $type, ) { } /** - * @inheritDoc + * @return \SimpleSAML\XML\Type\QNameValue */ - public function getXsiType(): string + public function getXsiType(): QNameValue { return $this->type; } @@ -76,19 +71,7 @@ public static function fromXML(DOMElement $xml): static SchemaViolationException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); - Assert::validQName($type, SchemaViolationException::class); - - // first, try to resolve the type to a full namespaced version - $qname = explode(':', $type, 2); - if (count($qname) === 2) { - list($prefix, $element) = $qname; - } else { - $prefix = null; - list($element) = $qname; - } - $ns = $xml->lookupNamespaceUri($prefix); - $type = ($ns === null) ? $element : implode(':', [$ns, $element]); + $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); @@ -118,7 +101,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e->setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:' . static::getXsiTypePrefix(), - static::getXsiTypeNamespaceURI(), + static::getXsiTypeNamespaceURI()->getValue(), ); $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); diff --git a/src/XML/saml/Action.php b/src/XML/saml/Action.php index 7621ad65a3..69cae0aae1 100644 --- a/src/XML/saml/Action.php +++ b/src/XML/saml/Action.php @@ -5,10 +5,12 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\StringElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\TypedTextContentTrait; + +use function strval; /** * Class representing SAML2 Action @@ -17,21 +19,23 @@ */ final class Action extends AbstractSamlElement { - use StringElementTrait; + use TypedTextContentTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; /** * Initialize an Action. * - * @param string $namespace This attribute was marked REQUIRED in the 2012 SAML errata (E36) - * @param string $content + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $namespace + * NOTE: This attribute was marked REQUIRED in the 2012 SAML errata (E36) + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $content */ public function __construct( - protected string $namespace, - string $content, + protected SAMLAnyURIValue $namespace, + SAMLStringValue $content, ) { - SAMLAssert::validURI($namespace); - $this->setContent($content); } @@ -39,9 +43,9 @@ public function __construct( /** * Collect the value of the namespace-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getNamespace(): string + public function getNamespace(): SAMLAnyURIValue { return $this->namespace; } @@ -62,8 +66,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, Action::NS, InvalidDOMElementException::class); return new self( - self::getAttribute($xml, 'Namespace'), - $xml->textContent, + self::getAttribute($xml, 'Namespace', SAMLAnyURIValue::class), + SAMLStringValue::fromString($xml->textContent), ); } @@ -78,8 +82,8 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Namespace', $this->getNamespace()); - $e->textContent = $this->getContent(); + $e->setAttribute('Namespace', strval($this->getNamespace())); + $e->textContent = strval($this->getContent()); return $e; } diff --git a/src/XML/saml/Advice.php b/src/XML/saml/Advice.php index 28f221f8a7..6a8a7cced0 100644 --- a/src/XML/saml/Advice.php +++ b/src/XML/saml/Advice.php @@ -5,13 +5,10 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{ExtendableElementTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\XsNamespace as NS; /** diff --git a/src/XML/saml/Assertion.php b/src/XML/saml/Assertion.php index 224a27b5f5..a3f320ba86 100644 --- a/src/XML/saml/Assertion.php +++ b/src/XML/saml/Assertion.php @@ -4,31 +4,26 @@ namespace SimpleSAML\SAML2\XML\saml; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\EncryptableElementTrait; -use SimpleSAML\SAML2\XML\SignableElementTrait; -use SimpleSAML\SAML2\XML\SignedElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; -use SimpleSAML\XML\Utils\Random as RandomUtils; +use SimpleSAML\SAML2\XML\{EncryptableElementTrait, SignableElementTrait, SignedElementTrait}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\ds\Signature; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; -use SimpleSAML\XMLSecurity\XML\SignableElementInterface; -use SimpleSAML\XMLSecurity\XML\SignedElementInterface; +use SimpleSAML\XMLSecurity\XML\{SignableElementInterface, SignedElementInterface}; use function array_filter; use function array_merge; use function array_pop; use function array_values; +use function strval; /** * Class representing a SAML 2 assertion. @@ -67,29 +62,26 @@ final class Assertion extends AbstractSamlElement implements * Assertion constructor. * * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer - * @param string|null $id - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Subject|null $subject * @param \SimpleSAML\SAML2\XML\saml\Conditions|null $conditions * @param \SimpleSAML\SAML2\XML\saml\AbstractStatementType[] $statements */ public function __construct( protected Issuer $issuer, - protected DateTimeImmutable $issueInstant, - protected ?string $id = null, + protected SAMLDateTimeValue $issueInstant, + protected IDValue $id, protected ?Subject $subject = null, protected ?Conditions $conditions = null, protected array $statements = [], ) { - Assert::same($issueInstant->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); - Assert::nullOrValidNCName($id); // Covers the empty string Assert::true( $subject || !empty($statements), "Either a or some statement must be present in a ", ); Assert::maxCount($statements, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($statements, AbstractStatementType::class); - Assert::nullOrNotWhitespaceOnly($id); } @@ -151,14 +143,10 @@ public function getStatements(): array /** * Retrieve the identifier of this assertion. * - * @return string The identifier of this assertion. + * @return \SimpleSAML\XML\Type\IDValue The identifier of this assertion. */ - public function getId(): string + public function getId(): IDValue { - if ($this->id === null) { - return (new RandomUtils())->generateId(); - } - return $this->id; } @@ -166,9 +154,9 @@ public function getId(): string /** * Retrieve the issue timestamp of this assertion. * - * @return \DateTimeImmutable The issue timestamp of this assertion, as an UNIX timestamp. + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue The issue timestamp of this assertion, as an UNIX timestamp. */ - public function getIssueInstant(): DateTimeImmutable + public function getIssueInstant(): SAMLDateTimeValue { return $this->issueInstant; } @@ -252,17 +240,10 @@ public static function fromXML(DOMElement $xml): static { Assert::same($xml->localName, 'Assertion', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Assertion::NS, InvalidDOMElementException::class); - Assert::same(self::getAttribute($xml, 'Version'), '2.0', 'Unsupported version: %s'); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); $issuer = Issuer::getChildrenOfClass($xml); Assert::minCount($issuer, 1, 'Missing in assertion.', MissingElementException::class); @@ -293,8 +274,8 @@ public static function fromXML(DOMElement $xml): static $assertion = new static( array_pop($issuer), - $issueInstant, - $id, + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), + self::getAttribute($xml, 'ID', IDValue::class), array_pop($subject), array_pop($conditions), array_merge($authnStatement, $attrStatement, $statements), @@ -321,8 +302,8 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); $e->setAttribute('Version', '2.0'); - $e->setAttribute('ID', $this->getId()); - $e->setAttribute('IssueInstant', $this->getIssueInstant()->format(C::DATETIME_FORMAT)); + $e->setAttribute('ID', strval($this->getId())); + $e->setAttribute('IssueInstant', strval($this->getIssueInstant())); $this->getIssuer()->toXML($e); $this->getSubject()?->toXML($e); diff --git a/src/XML/saml/AssertionIDRef.php b/src/XML/saml/AssertionIDRef.php index 514f8b13ed..77d1fbd735 100644 --- a/src/XML/saml/AssertionIDRef.php +++ b/src/XML/saml/AssertionIDRef.php @@ -4,11 +4,9 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\NCNameValue; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing a saml:AssertionIDRef element. @@ -18,30 +16,8 @@ final class AssertionIDRef extends AbstractSamlElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait { - StringElementTrait::validateContent as baseValidateContent; - } + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } - - - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - $this->baseValidateContent($content); - Assert::validNCName($content, SchemaViolationException::class); - } + /** @var string */ + public const TEXTCONTENT_TYPE = NCNameValue::class; } diff --git a/src/XML/saml/AssertionURIRef.php b/src/XML/saml/AssertionURIRef.php index 16634123f8..1afa94808f 100644 --- a/src/XML/saml/AssertionURIRef.php +++ b/src/XML/saml/AssertionURIRef.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\SAML2\XML\URIElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing a saml:AssertionURIRef element. @@ -16,14 +16,8 @@ final class AssertionURIRef extends AbstractSamlElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/Attribute.php b/src/XML/saml/Attribute.php index 969fdb52ae..a5018ae33d 100644 --- a/src/XML/saml/Attribute.php +++ b/src/XML/saml/Attribute.php @@ -7,15 +7,17 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\EncryptableElementTrait; use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; +use function strval; + /** * Class representing SAML 2 Attribute. * @@ -37,35 +39,35 @@ class Attribute extends AbstractSamlElement implements /** * Initialize an Attribute. * - * @param string $name - * @param string|null $nameFormat - * @param string|null $friendlyName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $name + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $nameFormat + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $friendlyName * @param \SimpleSAML\SAML2\XML\saml\AttributeValue[] $attributeValue * @param list<\SimpleSAML\XML\Attribute> $namespacedAttribute */ public function __construct( - protected string $name, - protected ?string $nameFormat = null, - protected ?string $friendlyName = null, + protected SAMLStringValue $name, + protected ?SAMLAnyURIValue $nameFormat = null, + protected ?SAMLStringValue $friendlyName = null, protected array $attributeValue = [], array $namespacedAttribute = [], ) { - Assert::notWhitespaceOnly($name, 'Cannot specify an empty name for an Attribute.'); - Assert::nullOrValidURI($nameFormat); - Assert::nullOrNotWhitespaceOnly($friendlyName, 'FriendlyName cannot be an empty string.'); Assert::maxCount($attributeValue, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($attributeValue, AttributeValue::class, 'Invalid AttributeValue.'); - if ($nameFormat === C::NAMEFORMAT_URI) { - Assert::validURI( - $name, - sprintf("Attribute name `%s` does not match its declared format `%s`", $name, $nameFormat), - ); - } elseif ($nameFormat === C::NAMEFORMAT_BASIC) { - Assert::validNCName( - $name, - sprintf("Attribute name `%s` does not match its declared format `%s`", $name, $nameFormat), - ); + switch (strval($nameFormat)) { + case C::NAMEFORMAT_URI: + Assert::validURI( + strval($name), + sprintf("Attribute name `%s` does not match its declared format `%s`", $name, $nameFormat), + ); + break; + case C::NAMEFORMAT_BASIC: + Assert::validNCName( + strval($name), + sprintf("Attribute name `%s` does not match its declared format `%s`", $name, $nameFormat), + ); + break; } $this->setAttributesNS($namespacedAttribute); @@ -75,9 +77,9 @@ public function __construct( /** * Collect the value of the Name-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLStringValue */ - public function getName(): string + public function getName(): SAMLStringValue { return $this->name; } @@ -86,9 +88,9 @@ public function getName(): string /** * Collect the value of the NameFormat-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null */ - public function getNameFormat(): ?string + public function getNameFormat(): ?SAMLAnyURIValue { return $this->nameFormat; } @@ -97,9 +99,9 @@ public function getNameFormat(): ?string /** * Collect the value of the FriendlyName-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getFriendlyName(): ?string + public function getFriendlyName(): ?SAMLStringValue { return $this->friendlyName; } @@ -141,9 +143,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, Attribute::NS, InvalidDOMElementException::class); return new static( - self::getAttribute($xml, 'Name'), - self::getOptionalAttribute($xml, 'NameFormat', null), - self::getOptionalAttribute($xml, 'FriendlyName', null), + self::getAttribute($xml, 'Name', SAMLStringValue::class), + self::getOptionalAttribute($xml, 'NameFormat', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'FriendlyName', SAMLStringValue::class, null), AttributeValue::getChildrenOfClass($xml), self::getAttributesNSFromXML($xml), ); @@ -159,14 +161,14 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Name', $this->getName()); + $e->setAttribute('Name', strval($this->getName())); if ($this->getNameFormat() !== null) { - $e->setAttribute('NameFormat', $this->getNameFormat()); + $e->setAttribute('NameFormat', strval($this->getNameFormat())); } if ($this->getFriendlyName() !== null) { - $e->setAttribute('FriendlyName', $this->getFriendlyName()); + $e->setAttribute('FriendlyName', strval($this->getFriendlyName())); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/saml/AttributeStatement.php b/src/XML/saml/AttributeStatement.php index 070d516371..d1becb4632 100644 --- a/src/XML/saml/AttributeStatement.php +++ b/src/XML/saml/AttributeStatement.php @@ -5,11 +5,10 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing a SAML2 AttributeStatement diff --git a/src/XML/saml/AttributeValue.php b/src/XML/saml/AttributeValue.php index 1bded8dd48..abf1ea0918 100644 --- a/src/XML/saml/AttributeValue.php +++ b/src/XML/saml/AttributeValue.php @@ -12,8 +12,7 @@ use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function class_exists; use function explode; diff --git a/src/XML/saml/Audience.php b/src/XML/saml/Audience.php index 30b56494f6..713066a7d6 100644 --- a/src/XML/saml/Audience.php +++ b/src/XML/saml/Audience.php @@ -4,10 +4,9 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\URIElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing a saml:Audience element. @@ -17,27 +16,8 @@ final class Audience extends AbstractSamlElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } - - - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - SAMLAssert::validEntityID($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AudienceRestriction.php b/src/XML/saml/AudienceRestriction.php index ba2f3bd76b..1a5a09efc4 100644 --- a/src/XML/saml/AudienceRestriction.php +++ b/src/XML/saml/AudienceRestriction.php @@ -5,12 +5,10 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * SAML AudienceRestriction data type. diff --git a/src/XML/saml/AuthenticatingAuthority.php b/src/XML/saml/AuthenticatingAuthority.php index 2fabef4275..1f2d52ed25 100644 --- a/src/XML/saml/AuthenticatingAuthority.php +++ b/src/XML/saml/AuthenticatingAuthority.php @@ -4,10 +4,9 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\URIElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing a saml:AuthenticatingAuthority element. @@ -17,27 +16,8 @@ final class AuthenticatingAuthority extends AbstractSamlElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } - - - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - SAMLAssert::validEntityID($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = EntityIDValue::class; } diff --git a/src/XML/saml/AuthnContext.php b/src/XML/saml/AuthnContext.php index 4591db1caa..9b71c7549f 100644 --- a/src/XML/saml/AuthnContext.php +++ b/src/XML/saml/AuthnContext.php @@ -5,15 +5,11 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDecl, AuthnContextDeclRef}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_pop; use function is_null; diff --git a/src/XML/saml/AuthnContextClassRef.php b/src/XML/saml/AuthnContextClassRef.php index 7f87207567..ecebd4600e 100644 --- a/src/XML/saml/AuthnContextClassRef.php +++ b/src/XML/saml/AuthnContextClassRef.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\SAML2\XML\URIElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing SAML2 AuthnContextClassRef @@ -16,14 +16,8 @@ final class AuthnContextClassRef extends AbstractSamlElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AuthnContextDecl.php b/src/XML/saml/AuthnContextDecl.php index ca8adfdf0a..3af15a86a1 100644 --- a/src/XML/saml/AuthnContextDecl.php +++ b/src/XML/saml/AuthnContextDecl.php @@ -5,13 +5,15 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XML\{ + ExtendableAttributesTrait, + ExtendableElementTrait, + SchemaValidatableElementInterface, + SchemaValidatableElementTrait, + XsNamespace as NS, +}; /** * Class representing SAML2 AuthnContextDecl diff --git a/src/XML/saml/AuthnContextDeclRef.php b/src/XML/saml/AuthnContextDeclRef.php index a8983b35b4..4f1728380c 100644 --- a/src/XML/saml/AuthnContextDeclRef.php +++ b/src/XML/saml/AuthnContextDeclRef.php @@ -4,9 +4,8 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\SAML2\XML\URIElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, TypedTextContentTrait}; /** * Class representing SAML2 AuthnContextDeclRef @@ -16,14 +15,8 @@ final class AuthnContextDeclRef extends AbstractSamlElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AuthnStatement.php b/src/XML/saml/AuthnStatement.php index fb5bf84609..4d31b39646 100644 --- a/src/XML/saml/AuthnStatement.php +++ b/src/XML/saml/AuthnStatement.php @@ -4,20 +4,13 @@ namespace SimpleSAML\SAML2\XML\saml; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_pop; -use function preg_replace; /** * Class representing a SAML2 AuthnStatement @@ -33,20 +26,18 @@ final class AuthnStatement extends AbstractStatementType implements SchemaValida * Initialize an AuthnStatement. * * @param \SimpleSAML\SAML2\XML\saml\AuthnContext $authnContext - * @param \DateTimeImmutable $authnInstant - * @param \DateTimeImmutable|null $sessionNotOnOrAfter - * @param string|null $sessionIndex + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $authnInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $sessionNotOnOrAfter + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $sessionIndex * @param \SimpleSAML\SAML2\XML\saml\SubjectLocality|null $subjectLocality */ public function __construct( protected AuthnContext $authnContext, - protected DateTimeImmutable $authnInstant, - protected ?DateTimeImmutable $sessionNotOnOrAfter = null, - protected ?string $sessionIndex = null, + protected SAMLDateTimeValue $authnInstant, + protected ?SAMLDateTimeValue $sessionNotOnOrAfter = null, + protected ?SAMLStringValue $sessionIndex = null, protected ?SubjectLocality $subjectLocality = null, ) { - Assert::same($authnInstant->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); - Assert::nullOrSame($sessionNotOnOrAfter?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); Assert::nullOrNotWhitespaceOnly($sessionIndex); } @@ -65,9 +56,9 @@ public function getAuthnContext(): AuthnContext /** * Collect the value of the AuthnInstant-property * - * @return \DateTimeImmutable + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue */ - public function getAuthnInstant(): DateTimeImmutable + public function getAuthnInstant(): SAMLDateTimeValue { return $this->authnInstant; } @@ -76,9 +67,9 @@ public function getAuthnInstant(): DateTimeImmutable /** * Collect the value of the sessionNotOnOrAfter-property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getSessionNotOnOrAfter(): ?DateTimeImmutable + public function getSessionNotOnOrAfter(): ?SAMLDateTimeValue { return $this->sessionNotOnOrAfter; } @@ -87,9 +78,9 @@ public function getSessionNotOnOrAfter(): ?DateTimeImmutable /** * Collect the value of the sessionIndex-property * - * @return ?string + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getSessionIndex(): ?string + public function getSessionIndex(): ?SAMLStringValue { return $this->sessionIndex; } @@ -137,29 +128,13 @@ public static function fromXML(DOMElement $xml): static TooManyElementsException::class, ); - $authnInstant = self::getAttribute($xml, 'AuthnInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $authnInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $authnInstant, 1); - - SAMLAssert::validDateTime($authnInstant, ProtocolViolationException::class); - $authnInstant = new DateTimeImmutable($authnInstant); - - $sessionNotOnOrAfter = self::getOptionalAttribute($xml, 'SessionNotOnOrAfter', null); - if ($sessionNotOnOrAfter !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $sessionNotOnOrAfter = preg_replace('/([.][0-9]+Z)$/', 'Z', $sessionNotOnOrAfter, 1); - - SAMLAssert::validDateTime($sessionNotOnOrAfter, ProtocolViolationException::class); - $sessionNotOnOrAfter = new DateTimeImmutable($sessionNotOnOrAfter); - } - $subjectLocality = SubjectLocality::getChildrenOfClass($xml); return new static( array_pop($authnContext), - $authnInstant, - $sessionNotOnOrAfter, - self::getOptionalAttribute($xml, 'SessionIndex', null), + self::getAttribute($xml, 'AuthnInstant', SAMLDateTimeValue::class), + self::getOptionalAttribute($xml, 'SessionNotOnOrAfter', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'SessionIndex', SAMLStringValue::class, null), array_pop($subjectLocality), ); } @@ -181,14 +156,14 @@ public function toXML(?DOMElement $parent = null): DOMElement $this->getAuthnContext()->toXML($e); - $e->setAttribute('AuthnInstant', $this->getAuthnInstant()->format(C::DATETIME_FORMAT)); + $e->setAttribute('AuthnInstant', $this->getAuthnInstant()->getValue()); if ($this->getSessionIndex() !== null) { - $e->setAttribute('SessionIndex', $this->getSessionIndex()); + $e->setAttribute('SessionIndex', $this->getSessionIndex()->getValue()); } if ($this->getSessionNotOnOrAfter() !== null) { - $e->setAttribute('SessionNotOnOrAfter', $this->getSessionNotOnOrAfter()->format(C::DATETIME_FORMAT)); + $e->setAttribute('SessionNotOnOrAfter', $this->getSessionNotOnOrAfter()->getValue()); } return $e; diff --git a/src/XML/saml/AuthzDecisionStatement.php b/src/XML/saml/AuthzDecisionStatement.php index edd130a502..4869227dfd 100644 --- a/src/XML/saml/AuthzDecisionStatement.php +++ b/src/XML/saml/AuthzDecisionStatement.php @@ -5,17 +5,19 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\Decision; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{ + InvalidDOMElementException, + MissingElementException, + SchemaViolationException, + TooManyElementsException, +}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\AnyURIValue; use ValueError; use function array_pop; @@ -34,18 +36,18 @@ final class AuthzDecisionStatement extends AbstractStatementType implements Sche /** * Initialize an AuthzDecisionStatement. * - * @param string $resource + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $resource * @param \SimpleSAML\SAML2\XML\Decision $decision * @param \SimpleSAML\SAML2\XML\saml\Action[] $action * @param \SimpleSAML\SAML2\XML\saml\Evidence|null $evidence */ public function __construct( - protected string $resource, + // Uses the base AnyURIValue because the SAML-specification allows this attribute to be an empty string + protected AnyURIValue $resource, protected Decision $decision, protected array $action, protected ?Evidence $evidence = null, ) { - SAMLAssert::validURI($resource); Assert::maxCount($action, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($action, Action::class, SchemaViolationException::class); } @@ -54,9 +56,9 @@ public function __construct( /** * Collect the value of the resource-property * - * @return string + * @return \SimpleSAML\XML\Type\AnyURIValue */ - public function getResource(): string + public function getResource(): AnyURIValue { return $this->resource; } @@ -128,15 +130,15 @@ public static function fromXML(DOMElement $xml): static TooManyElementsException::class, ); - $decision = self::getAttribute($xml, 'Decision'); + $decision = self::getAttribute($xml, 'Decision', SAMLStringValue::class); try { - $decision = Decision::from($decision); + $decision = Decision::from($decision->getValue()); } catch (ValueError) { throw new ProtocolViolationException(sprintf('Unknown value \'%s\' for Decision attribute.', $decision)); } return new static( - self::getAttribute($xml, 'Resource'), + self::getAttribute($xml, 'Resource', AnyURIValue::class), $decision, $action, array_pop($evidence), @@ -154,7 +156,7 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Resource', $this->getResource()); + $e->setAttribute('Resource', $this->getResource()->getValue()); $e->setAttribute('Decision', $this->getDecision()->value); foreach ($this->getAction() as $action) { diff --git a/src/XML/saml/BaseIdentifierInterface.php b/src/XML/saml/BaseIdentifierInterface.php index d054270fd9..c577c660b3 100644 --- a/src/XML/saml/BaseIdentifierInterface.php +++ b/src/XML/saml/BaseIdentifierInterface.php @@ -4,6 +4,8 @@ namespace SimpleSAML\SAML2\XML\saml; +use SimpleSAML\SAML2\Type\SAMLStringValue; + /** * Interface for BaseID objects. * @@ -14,15 +16,15 @@ interface BaseIdentifierInterface extends IdentifierInterface /** * Get the value of the NameQualifier attribute of an identifier. * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getNameQualifier(): ?string; + public function getNameQualifier(): ?SAMLStringValue; /** * Get the value of the SPNameQualifier attribute of an identifier. * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getSPNameQualifier(): ?string; + public function getSPNameQualifier(): ?SAMLStringValue; } diff --git a/src/XML/saml/Conditions.php b/src/XML/saml/Conditions.php index 5e6b9c18b9..fc6a372ab5 100644 --- a/src/XML/saml/Conditions.php +++ b/src/XML/saml/Conditions.php @@ -4,15 +4,13 @@ namespace SimpleSAML\SAML2\XML\saml; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_pop; @@ -29,23 +27,21 @@ final class Conditions extends AbstractSamlElement implements SchemaValidatableE /** * Initialize a Conditions element. * - * @param \DateTimeImmutable|null $notBefore - * @param \DateTimeImmutable|null $notOnOrAfter + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notBefore + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notOnOrAfter * @param \SimpleSAML\SAML2\XML\saml\AbstractCondition[] $condition * @param \SimpleSAML\SAML2\XML\saml\AudienceRestriction[] $audienceRestriction * @param \SimpleSAML\SAML2\XML\saml\OneTimeUse|null $oneTimeUse * @param \SimpleSAML\SAML2\XML\saml\ProxyRestriction|null $proxyRestriction */ public function __construct( - protected ?DateTimeImmutable $notBefore = null, - protected ?DateTimeImmutable $notOnOrAfter = null, + protected ?SAMLDateTimeValue $notBefore = null, + protected ?SAMLDateTimeValue $notOnOrAfter = null, protected array $condition = [], protected array $audienceRestriction = [], protected ?OneTimeUse $oneTimeUse = null, protected ?ProxyRestriction $proxyRestriction = null, ) { - Assert::nullOrSame($notBefore?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); - Assert::nullOrSame($notOnOrAfter?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); Assert::maxCount($condition, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($condition, AbstractCondition::class); Assert::maxCount($audienceRestriction, C::UNBOUNDED_LIMIT); @@ -56,9 +52,9 @@ public function __construct( /** * Collect the value of the notBefore-property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getNotBefore(): ?DateTimeImmutable + public function getNotBefore(): ?SAMLDateTimeValue { return $this->notBefore; } @@ -67,9 +63,9 @@ public function getNotBefore(): ?DateTimeImmutable /** * Collect the value of the notOnOrAfter-property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getNotOnOrAfter(): ?DateTimeImmutable + public function getNotOnOrAfter(): ?SAMLDateTimeValue { return $this->notOnOrAfter; } @@ -126,12 +122,12 @@ public function getProxyRestriction(): ?ProxyRestriction */ public function isEmptyElement(): bool { - return empty($this->notBefore) - && empty($this->notOnOrAfter) - && empty($this->condition) - && empty($this->audienceRestriction) - && empty($this->oneTimeUse) - && empty($this->proxyRestriction); + return empty($this->getNotBefore()) + && empty($this->getNotOnOrAfter()) + && empty($this->getCondition()) + && empty($this->getAudienceRestriction()) + && empty($this->getOneTimeUse()) + && empty($this->getProxyRestriction()); } @@ -149,22 +145,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'Conditions', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Conditions::NS, InvalidDOMElementException::class); - $notBefore = self::getOptionalAttribute($xml, 'NotBefore', null); - if ($notBefore !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $notBefore = preg_replace('/([.][0-9]+Z)$/', 'Z', $notBefore, 1); - - SAMLAssert::validDateTime($notBefore, ProtocolViolationException::class); - } - - $notOnOrAfter = self::getOptionalAttribute($xml, 'NotOnOrAfter', null); - if ($notOnOrAfter !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $notOnOrAfter = preg_replace('/([.][0-9]+Z)$/', 'Z', $notOnOrAfter, 1); - - SAMLAssert::validDateTime($notOnOrAfter, ProtocolViolationException::class); - } - $condition = AbstractCondition::getChildrenOfClass($xml); $audienceRestriction = AudienceRestriction::getChildrenOfClass($xml); $oneTimeUse = OneTimeUse::getChildrenOfClass($xml); @@ -184,8 +164,8 @@ public static function fromXML(DOMElement $xml): static ); return new static( - $notBefore !== null ? new DateTimeImmutable($notBefore) : null, - $notOnOrAfter !== null ? new DateTimeImmutable($notOnOrAfter) : null, + self::getOptionalAttribute($xml, 'NotBefore', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'NotOnOrAfter', SAMLDateTimeValue::class, null), $condition, $audienceRestriction, array_pop($oneTimeUse), @@ -205,11 +185,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getNotBefore() !== null) { - $e->setAttribute('NotBefore', $this->getNotBefore()->format(C::DATETIME_FORMAT)); + $e->setAttribute('NotBefore', $this->getNotBefore()->getValue()); } if ($this->getNotOnOrAfter() !== null) { - $e->setAttribute('NotOnOrAfter', $this->getNotOnOrAfter()->format(C::DATETIME_FORMAT)); + $e->setAttribute('NotOnOrAfter', $this->getNotOnOrAfter()->getValue()); } foreach ($this->getCondition() as $condition) { diff --git a/src/XML/saml/EncryptedAssertion.php b/src/XML/saml/EncryptedAssertion.php index 93f310b226..63caf3dfb1 100644 --- a/src/XML/saml/EncryptedAssertion.php +++ b/src/XML/saml/EncryptedAssertion.php @@ -5,9 +5,7 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\XML\EncryptedElementTrait; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{DOMDocumentFactory, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface; diff --git a/src/XML/saml/EncryptedAttribute.php b/src/XML/saml/EncryptedAttribute.php index 308bed61b5..ce38395006 100644 --- a/src/XML/saml/EncryptedAttribute.php +++ b/src/XML/saml/EncryptedAttribute.php @@ -5,9 +5,7 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\XML\EncryptedElementTrait; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{DOMDocumentFactory, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface; diff --git a/src/XML/saml/EncryptedID.php b/src/XML/saml/EncryptedID.php index dbb947ccb3..6d3746dda7 100644 --- a/src/XML/saml/EncryptedID.php +++ b/src/XML/saml/EncryptedID.php @@ -6,10 +6,12 @@ use InvalidArgumentException; use SimpleSAML\SAML2\XML\EncryptedElementTrait; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; -use SimpleSAML\XML\SerializableElementInterface; +use SimpleSAML\XML\{ + DOMDocumentFactory, + SchemaValidatableElementInterface, + SchemaValidatableElementTrait, + SerializableElementInterface, +}; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface; diff --git a/src/XML/saml/Evidence.php b/src/XML/saml/Evidence.php index 37915d5041..a07e6beb90 100644 --- a/src/XML/saml/Evidence.php +++ b/src/XML/saml/Evidence.php @@ -5,12 +5,10 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing a saml:Evidence element. diff --git a/src/XML/saml/IDNameQualifiersTrait.php b/src/XML/saml/IDNameQualifiersTrait.php index c321a2370b..4bb945f651 100644 --- a/src/XML/saml/IDNameQualifiersTrait.php +++ b/src/XML/saml/IDNameQualifiersTrait.php @@ -4,6 +4,8 @@ namespace SimpleSAML\SAML2\XML\saml; +use SimpleSAML\SAML2\Type\SAMLStringValue; + /** * SAML IDNameQualifier attribute group. * @@ -14,9 +16,9 @@ trait IDNameQualifiersTrait /** * Collect the value of the NameQualifier-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getNameQualifier(): ?string + public function getNameQualifier(): ?SAMLStringValue { return $this->NameQualifier; } @@ -25,9 +27,9 @@ public function getNameQualifier(): ?string /** * Collect the value of the SPNameQualifier-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getSPNameQualifier(): ?string + public function getSPNameQualifier(): ?SAMLStringValue { return $this->SPNameQualifier; } diff --git a/src/XML/saml/Issuer.php b/src/XML/saml/Issuer.php index 56472f0b41..2738ed1ca4 100644 --- a/src/XML/saml/Issuer.php +++ b/src/XML/saml/Issuer.php @@ -4,11 +4,11 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing the saml:Issuer element. @@ -23,18 +23,18 @@ final class Issuer extends NameIDType implements SchemaValidatableElementInterfa /** * Initialize a saml:Issuer * - * @param string $value - * @param string|null $NameQualifier - * @param string|null $SPNameQualifier - * @param string|null $Format - * @param string|null $SPProvidedID + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $value + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $Format + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPProvidedID */ public function __construct( - string $value, - ?string $NameQualifier = null, - ?string $SPNameQualifier = null, - ?string $Format = null, - ?string $SPProvidedID = null, + SAMLStringValue $value, + ?SAMLStringValue $NameQualifier = null, + ?SAMLStringValue $SPNameQualifier = null, + ?SAMLAnyURIValue $Format = null, + ?SAMLStringValue $SPProvidedID = null, ) { /** * The format of this NameIDType. @@ -57,13 +57,13 @@ public function __construct( * From saml-core-2.0-os 8.3.6, when the entity Format is used: "The NameQualifier, SPNameQualifier, and * SPProvidedID attributes MUST be omitted." */ - if ($Format === C::NAMEID_ENTITY || $Format === null) { + if ($Format === null || $Format->getValue() === C::NAMEID_ENTITY) { Assert::allNull( [$NameQualifier, $SPNameQualifier, $SPProvidedID], 'Illegal combination of attributes being used', ); - SamlAssert::validEntityID($value); + Assert::validEntityID($value->getValue(), ProtocolViolationException::class); } parent::__construct($value, $NameQualifier, $SPNameQualifier, $Format, $SPProvidedID); diff --git a/src/XML/saml/NameID.php b/src/XML/saml/NameID.php index 18b55b7db5..4976a1c83b 100644 --- a/src/XML/saml/NameID.php +++ b/src/XML/saml/NameID.php @@ -4,12 +4,12 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\XML\EncryptableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; @@ -34,48 +34,53 @@ final class NameID extends NameIDType implements /** * Initialize a saml:NameID * - * @param string $value - * @param string|null $NameQualifier - * @param string|null $SPNameQualifier - * @param string|null $Format - * @param string|null $SPProvidedID + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $value + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $Format + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPProvidedID */ public function __construct( - string $value, - ?string $NameQualifier = null, - ?string $SPNameQualifier = null, - ?string $Format = null, - ?string $SPProvidedID = null, + SAMLStringValue $value, + ?SAMLStringValue $NameQualifier = null, + ?SAMLStringValue $SPNameQualifier = null, + ?SAMLAnyURIValue $Format = null, + ?SAMLStringValue $SPProvidedID = null, ) { - switch ($Format) { - case C::NAMEID_EMAIL_ADDRESS: - Assert::email( - $value, - "The content %s of the NameID was not in the format specified by the Format attribute", - ); - break; - case C::NAMEID_ENTITY: - /* 8.3.6: he NameQualifier, SPNameQualifier, and SPProvidedID attributes MUST be omitted. */ - Assert::null($NameQualifier, "Entity Identifier included a disallowed NameQualifier attribute."); - Assert::null($SPNameQualifier, "Entity Identifier included a disallowed SPNameQualifier attribute."); - Assert::null($SPProvidedID, "Entity Identifier included a disallowed SPProvidedID attribute."); - break; - case C::NAMEID_PERSISTENT: - /* 8.3.7: Persistent name identifier values MUST NOT exceed a length of 256 characters. */ - Assert::maxLength( - $value, - 256, - "Persistent name identifier values MUST NOT exceed a length of 256 characters.", - ); - break; - case C::NAMEID_TRANSIENT: - /* 8.3.8: Transient name identifier values MUST NOT exceed a length of 256 characters. */ - Assert::maxLength( - $value, - 256, - "Transient name identifier values MUST NOT exceed a length of 256 characters.", - ); - break; + if ($Format !== null) { + switch ($Format->getValue()) { + case C::NAMEID_EMAIL_ADDRESS: + Assert::email( + $value->getValue(), + "The content %s of the NameID was not in the format specified by the Format attribute", + ); + break; + case C::NAMEID_ENTITY: + /* 8.3.6: the NameQualifier, SPNameQualifier, and SPProvidedID attributes MUST be omitted. */ + Assert::null($NameQualifier, "Entity Identifier included a disallowed NameQualifier attribute."); + Assert::null( + $SPNameQualifier, + "Entity Identifier included a disallowed SPNameQualifier attribute.", + ); + Assert::null($SPProvidedID, "Entity Identifier included a disallowed SPProvidedID attribute."); + break; + case C::NAMEID_PERSISTENT: + /* 8.3.7: Persistent name identifier values MUST NOT exceed a length of 256 characters. */ + Assert::maxLength( + $value->getValue(), + 256, + "Persistent name identifier values MUST NOT exceed a length of 256 characters.", + ); + break; + case C::NAMEID_TRANSIENT: + /* 8.3.8: Transient name identifier values MUST NOT exceed a length of 256 characters. */ + Assert::maxLength( + $value->getValue(), + 256, + "Transient name identifier values MUST NOT exceed a length of 256 characters.", + ); + break; + } } parent::__construct($value, $NameQualifier, $SPNameQualifier, $Format, $SPProvidedID); @@ -101,11 +106,11 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['value'], - $data['NameQualifier'] ?? null, - $data['SPNameQualifier'] ?? null, - $data['Format'] ?? null, - $data['SPProvidedID'] ?? null, + SAMLStringValue::fromString($data['value']), + $data['NameQualifier'] ? SAMLStringValue::fromString($data['NameQualifier']) : null, + $data['SPNameQualifier'] ? SAMLStringValue::fromString($data['SPNameQualifier']) : null, + $data['Format'] ? SAMLAnyURIValue::fromString($data['Format']) : null, + $data['SPProvidedID'] ? SAMLStringValue::fromString($data['SPProvidedID']) : null, ); } @@ -170,11 +175,11 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = [ - 'value' => $this->getContent(), - 'Format' => $this->getFormat(), - 'NameQualifier' => $this->getNameQualifier(), - 'SPNameQualifier' => $this->getSPNameQualifier(), - 'SPProvidedID' => $this->getSPProvidedID(), + 'value' => $this->getContent()->getValue(), + 'Format' => $this->getFormat()?->getValue(), + 'NameQualifier' => $this->getNameQualifier()?->getValue(), + 'SPNameQualifier' => $this->getSPNameQualifier()?->getValue(), + 'SPProvidedID' => $this->getSPProvidedID()?->getValue(), ]; return array_filter($data); diff --git a/src/XML/saml/NameIDType.php b/src/XML/saml/NameIDType.php index 825b118d53..b108bd844a 100644 --- a/src/XML/saml/NameIDType.php +++ b/src/XML/saml/NameIDType.php @@ -5,10 +5,12 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\StringElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\TypedTextContentTrait; + +use function strval; /** * SAML NameIDType abstract data type. @@ -19,30 +21,28 @@ abstract class NameIDType extends AbstractSamlElement implements IdentifierInterface { use IDNameQualifiersTrait; - use StringElementTrait; + use TypedTextContentTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; /** * Initialize a saml:NameIDType from scratch * - * @param string $value - * @param string|null $Format - * @param string|null $SPProvidedID - * @param string|null $NameQualifier - * @param string|null $SPNameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $value + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $Format + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPProvidedID + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier */ protected function __construct( - string $value, - protected ?string $NameQualifier = null, - protected ?string $SPNameQualifier = null, - protected ?string $Format = null, - protected ?string $SPProvidedID = null, + SAMLStringValue|SAMLAnyURIValue $value, + protected ?SAMLStringValue $NameQualifier = null, + protected ?SAMLStringValue $SPNameQualifier = null, + protected ?SAMLAnyURIValue $Format = null, + protected ?SAMLStringValue $SPProvidedID = null, ) { - SAMLAssert::nullOrValidEntityID($NameQualifier); - SAMLAssert::nullOrValidEntityID($SPNameQualifier); - SAMLAssert::nullOrValidURI($Format); - Assert::nullOrNotWhitespaceOnly($SPProvidedID); - $this->setContent($value); } @@ -50,9 +50,9 @@ protected function __construct( /** * Collect the value of the Format-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null */ - public function getFormat(): ?string + public function getFormat(): ?SAMLAnyURIValue { return $this->Format; } @@ -61,27 +61,14 @@ public function getFormat(): ?string /** * Collect the value of the SPProvidedID-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getSPProvidedID(): ?string + public function getSPProvidedID(): ?SAMLStringValue { return $this->SPProvidedID; } - /** - * Validate the content of the element. - * - * @param string $content The value to go in the XML textContent - * @throws \Exception on failure - * @return void - */ - protected function validateContent(string $content): void - { - Assert::notWhitespaceOnly($content); - } - - /** * Convert XML into an NameID * @@ -96,12 +83,13 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, static::getLocalName(), InvalidDOMElementException::class); Assert::same($xml->namespaceURI, static::NS, InvalidDOMElementException::class); - $NameQualifier = self::getOptionalAttribute($xml, 'NameQualifier', null); - $SPNameQualifier = self::getOptionalAttribute($xml, 'SPNameQualifier', null); - $Format = self::getOptionalAttribute($xml, 'Format', null); - $SPProvidedID = self::getOptionalAttribute($xml, 'SPProvidedID', null); - - return new static($xml->textContent, $NameQualifier, $SPNameQualifier, $Format, $SPProvidedID); + return new static( + SAMLStringValue::fromString($xml->textContent), + self::getOptionalAttribute($xml, 'NameQualifier', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'SPNameQualifier', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'Format', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'SPProvidedID', SAMLStringValue::class, null), + ); } @@ -114,24 +102,24 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); + $e->textContent = strval($this->getContent()); if ($this->getNameQualifier() !== null) { - $e->setAttribute('NameQualifier', $this->getNameQualifier()); + $e->setAttribute('NameQualifier', $this->getNameQualifier()->getValue()); } if ($this->getSPNameQualifier() !== null) { - $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()); + $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue()); } if ($this->getFormat() !== null) { - $e->setAttribute('Format', $this->getFormat()); + $e->setAttribute('Format', $this->getFormat()->getValue()); } if ($this->getSPProvidedID() !== null) { - $e->setAttribute('SPProvidedID', $this->getSPProvidedID()); + $e->setAttribute('SPProvidedID', $this->getSPProvidedID()->getValue()); } - $e->textContent = $this->getContent(); return $e; } } diff --git a/src/XML/saml/OneTimeUse.php b/src/XML/saml/OneTimeUse.php index 79c59feda1..00998e986e 100644 --- a/src/XML/saml/OneTimeUse.php +++ b/src/XML/saml/OneTimeUse.php @@ -5,10 +5,9 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing a saml:OneTimeUse element. diff --git a/src/XML/saml/ProxyRestriction.php b/src/XML/saml/ProxyRestriction.php index 13aa8c2569..a83fdd7918 100644 --- a/src/XML/saml/ProxyRestriction.php +++ b/src/XML/saml/ProxyRestriction.php @@ -5,13 +5,11 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; - -use function strval; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\NonNegativeIntegerValue; /** * @package simplesamlphp/saml2 @@ -25,13 +23,12 @@ final class ProxyRestriction extends AbstractConditionType implements SchemaVali * ProxyRestriction constructor. * * @param \SimpleSAML\SAML2\XML\saml\Audience[] $audience - * @param int|null $count + * @param \SimpleSAML\XML\Type\NonNegativeIntegerValue|null $count */ public function __construct( protected array $audience = [], - protected ?int $count = null, + protected ?NonNegativeIntegerValue $count = null, ) { - Assert::nullOrNatural($count, 'Count must be a non-negative integer.'); Assert::maxCount($audience, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($audience, Audience::class); } @@ -40,9 +37,9 @@ public function __construct( /** * Get the value of the count-attribute. * - * @return int|null + * @return \SimpleSAML\XML\Type\NonNegativeIntegerValue|null */ - public function getCount(): ?int + public function getCount(): ?NonNegativeIntegerValue { return $this->count; } @@ -71,7 +68,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'ProxyRestriction', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ProxyRestriction::NS, InvalidDOMElementException::class); - $count = self::getOptionalIntegerAttribute($xml, 'Count', null); + $count = self::getOptionalAttribute($xml, 'Count', NonNegativeIntegerValue::class, null); $audience = Audience::getChildrenOfClass($xml); return new static($audience, $count); @@ -89,7 +86,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getCount() !== null) { - $e->setAttribute('Count', strval($this->getCount())); + $e->setAttribute('Count', $this->getCount()->getValue()); } foreach ($this->getAudience() as $audience) { diff --git a/src/XML/saml/Subject.php b/src/XML/saml/Subject.php index 47a0d22308..03ab946ab8 100644 --- a/src/XML/saml/Subject.php +++ b/src/XML/saml/Subject.php @@ -5,13 +5,11 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\IdentifierTrait; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing SAML 2 Subject element. diff --git a/src/XML/saml/SubjectConfirmation.php b/src/XML/saml/SubjectConfirmation.php index 1bfeb53bc2..abcdf1bc4e 100644 --- a/src/XML/saml/SubjectConfirmation.php +++ b/src/XML/saml/SubjectConfirmation.php @@ -5,13 +5,11 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\IdentifierTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_pop; @@ -29,16 +27,15 @@ final class SubjectConfirmation extends AbstractSamlElement implements SchemaVal /** * Initialize (and parse) a SubjectConfirmation element. * - * @param string $method + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $method * @param \SimpleSAML\SAML2\XML\saml\IdentifierInterface|null $identifier * @param \SimpleSAML\SAML2\XML\saml\SubjectConfirmationData|null $subjectConfirmationData */ public function __construct( - protected string $method, + protected SAMLAnyURIValue $method, ?IdentifierInterface $identifier = null, protected ?SubjectConfirmationData $subjectConfirmationData = null, ) { - SAMLAssert::validURI($method); $this->setIdentifier($identifier); } @@ -46,9 +43,9 @@ public function __construct( /** * Collect the value of the Method-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getMethod(): string + public function getMethod(): SAMLAnyURIValue { return $this->method; } @@ -83,10 +80,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'SubjectConfirmation', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SubjectConfirmation::NS, InvalidDOMElementException::class); - $Method = self::getAttribute($xml, 'Method'); - $identifier = self::getIdentifierFromXML($xml); $subjectConfirmationData = SubjectConfirmationData::getChildrenOfClass($xml); - Assert::maxCount( $subjectConfirmationData, 1, @@ -95,8 +89,8 @@ public static function fromXML(DOMElement $xml): static ); return new static( - $Method, - $identifier, + self::getAttribute($xml, 'Method', SAMLAnyURIValue::class), + self::getIdentifierFromXML($xml), array_pop($subjectConfirmationData), ); } @@ -111,7 +105,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Method', $this->getMethod()); + $e->setAttribute('Method', $this->getMethod()->getValue()); /** @var \SimpleSAML\XML\SerializableElementInterface|null $identifier */ $identifier = $this->getIdentifier(); diff --git a/src/XML/saml/SubjectConfirmationData.php b/src/XML/saml/SubjectConfirmationData.php index 2260cf60a0..c122511769 100644 --- a/src/XML/saml/SubjectConfirmationData.php +++ b/src/XML/saml/SubjectConfirmationData.php @@ -4,22 +4,18 @@ namespace SimpleSAML\SAML2\XML\saml; -use DateTimeImmutable; use DOMElement; +use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\NCNameValue; use SimpleSAML\XML\XsNamespace as NS; -use function filter_var; -use function is_null; +use function strval; /** * Class representing SAML 2 SubjectConfirmationData element. @@ -43,32 +39,36 @@ final class SubjectConfirmationData extends AbstractSamlElement implements Schem /** * Initialize (and parse) a SubjectConfirmationData element. * - * @param \DateTimeImmutable|null $notBefore - * @param \DateTimeImmutable|null $notOnOrAfter - * @param string|null $recipient - * @param string|null $inResponseTo - * @param string|null $address + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notBefore + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notOnOrAfter + * @param \SimpleSAML\SAML2\Type\EntityIDValue|null $recipient + * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $address * @param \SimpleSAML\XML\SerializableElementInterface[] $children * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( - protected ?DateTimeImmutable $notBefore = null, - protected ?DateTimeImmutable $notOnOrAfter = null, - protected ?string $recipient = null, - protected ?string $inResponseTo = null, - protected ?string $address = null, + protected ?SAMLDateTimeValue $notBefore = null, + protected ?SAMLDateTimeValue $notOnOrAfter = null, + protected ?EntityIDValue $recipient = null, + protected ?NCNameValue $inResponseTo = null, + protected ?SAMLStringValue $address = null, array $children = [], array $namespacedAttributes = [], ) { - Assert::nullOrSame($notBefore?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); - Assert::nullOrSame($notOnOrAfter?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); - Assert::nullOrNotWhitespaceOnly($recipient); - Assert::nullOrValidNCName($inResponseTo); // Covers the empty string - - if (!is_null($address) && !filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) { - Utils::getContainer()->getLogger()->warning( - sprintf('Provided argument (%s) is not a valid IP address.', $address), - ); + if ($address !== null) { + try { + /** + * IPv4 addresses SHOULD be represented in the usual dotted-decimal format (e.g., "1.2.3.4"). + * IPv6 addresses SHOULD be represented as defined by Section 2.2 of IETF RFC 3513 [RFC 3513] + * (e.g., "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210"). + */ + Assert::ip($address->getValue()); + } catch (AssertionFailedException) { + Utils::getContainer()->getLogger()->warning( + sprintf('Provided address (%s) is not a valid IPv4 or IPv6 address.', $address->getValue()), + ); + } } $this->setElements($children); @@ -79,9 +79,9 @@ public function __construct( /** * Collect the value of the NotBefore-property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getNotBefore(): ?DateTimeImmutable + public function getNotBefore(): ?SAMLDateTimeValue { return $this->notBefore; } @@ -90,9 +90,9 @@ public function getNotBefore(): ?DateTimeImmutable /** * Collect the value of the NotOnOrAfter-property * - * @return \DateTimeImmutable|null + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null */ - public function getNotOnOrAfter(): ?DateTimeImmutable + public function getNotOnOrAfter(): ?SAMLDateTimeValue { return $this->notOnOrAfter; } @@ -101,9 +101,9 @@ public function getNotOnOrAfter(): ?DateTimeImmutable /** * Collect the value of the Recipient-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\EntityIDValue|null */ - public function getRecipient(): ?string + public function getRecipient(): ?EntityIDValue { return $this->recipient; } @@ -112,9 +112,9 @@ public function getRecipient(): ?string /** * Collect the value of the InResponseTo-property * - * @return string|null + * @return \SimpleSAML\XML\Type\NCNameValue|null */ - public function getInResponseTo(): ?string + public function getInResponseTo(): ?NCNameValue { return $this->inResponseTo; } @@ -123,9 +123,9 @@ public function getInResponseTo(): ?string /** * Collect the value of the Address-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getAddress(): ?string + public function getAddress(): ?SAMLStringValue { return $this->address; } @@ -138,13 +138,13 @@ public function getAddress(): ?string */ public function isEmptyElement(): bool { - return empty($this->notBefore) - && empty($this->notOnOrAfter) - && empty($this->recipient) - && empty($this->inResponseTo) - && empty($this->address) - && empty($this->elements) - && empty($this->namespacedAttributes); + return empty($this->getNotBefore()) + && empty($this->getNotOnOrAfter()) + && empty($this->getRecipient()) + && empty($this->getInResponseTo()) + && empty($this->getAddress()) + && empty($this->getElements()) + && empty($this->getAttributesNS()); } @@ -166,34 +166,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'SubjectConfirmationData', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SubjectConfirmationData::NS, InvalidDOMElementException::class); - $NotBefore = self::getOptionalAttribute($xml, 'NotBefore', null); - if ($NotBefore !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $NotBefore = preg_replace('/([.][0-9]+Z)$/', 'Z', $NotBefore, 1); - - SAMLAssert::validDateTime($NotBefore, ProtocolViolationException::class); - $NotBefore = new DateTimeImmutable($NotBefore); - } - - $NotOnOrAfter = self::getOptionalAttribute($xml, 'NotOnOrAfter', null); - if ($NotOnOrAfter !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $NotOnOrAfter = preg_replace('/([.][0-9]+Z)$/', 'Z', $NotOnOrAfter, 1); - - SAMLAssert::validDateTime($NotOnOrAfter, ProtocolViolationException::class); - $NotOnOrAfter = new DateTimeImmutable($NotOnOrAfter); - } - - $Recipient = self::getOptionalAttribute($xml, 'Recipient', null); - $InResponseTo = self::getOptionalAttribute($xml, 'InResponseTo', null); - $Address = self::getOptionalAttribute($xml, 'Address', null); - return new static( - $NotBefore, - $NotOnOrAfter, - $Recipient, - $InResponseTo, - $Address, + self::getOptionalAttribute($xml, 'NotBefore', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'NotOnOrAfter', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'Recipient', EntityIDValue::class, null), + self::getOptionalAttribute($xml, 'InResponseTo', NCNameValue::class, null), + self::getOptionalAttribute($xml, 'Address', SAMLStringValue::class, null), self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -211,19 +189,19 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getNotBefore() !== null) { - $e->setAttribute('NotBefore', $this->getNotBefore()->format(C::DATETIME_FORMAT)); + $e->setAttribute('NotBefore', strval($this->getNotBefore())); } if ($this->getNotOnOrAfter() !== null) { - $e->setAttribute('NotOnOrAfter', $this->getNotOnOrAfter()->format(C::DATETIME_FORMAT)); + $e->setAttribute('NotOnOrAfter', strval($this->getNotOnOrAfter())); } if ($this->getRecipient() !== null) { - $e->setAttribute('Recipient', $this->getRecipient()); + $e->setAttribute('Recipient', strval($this->getRecipient())); } if ($this->getInResponseTo() !== null) { - $e->setAttribute('InResponseTo', $this->getInResponseTo()); + $e->setAttribute('InResponseTo', strval($this->getInResponseTo())); } if ($this->getAddress() !== null) { - $e->setAttribute('Address', $this->getAddress()); + $e->setAttribute('Address', strval($this->getAddress())); } foreach ($this->getAttributesNS() as $attr) { diff --git a/src/XML/saml/SubjectLocality.php b/src/XML/saml/SubjectLocality.php index 680f0434d5..dfa91493bb 100644 --- a/src/XML/saml/SubjectLocality.php +++ b/src/XML/saml/SubjectLocality.php @@ -5,10 +5,10 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{DomainValue, SAMLStringValue}; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class representing SAML2 SubjectLocality @@ -23,24 +23,23 @@ final class SubjectLocality extends AbstractSamlElement implements SchemaValidat /** * Initialize an SubjectLocality. * - * @param string|null $address - * @param string|null $dnsName + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $address + * @param \SimpleSAML\SAML2\Type\DomainValue|null $dnsName */ public function __construct( - protected ?string $address = null, - protected ?string $dnsName = null, + protected ?SAMLStringValue $address = null, + protected ?DomainValue $dnsName = null, ) { - Assert::nullOrIp($address, 'Invalid IP address'); - Assert::nullOrNotWhitespaceOnly($dnsName, 'Invalid DNS name'); + Assert::nullOrIp($address?->getValue(), 'Invalid IP address'); } /** * Collect the value of the address-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getAddress(): ?string + public function getAddress(): ?SAMLStringValue { return $this->address; } @@ -49,9 +48,9 @@ public function getAddress(): ?string /** * Collect the value of the dnsName-property * - * @return string|null + * @return \SimpleSAML\SAML2\Type\DomainValue|null */ - public function getDnsName(): ?string + public function getDnsName(): ?DomainValue { return $this->dnsName; } @@ -64,8 +63,8 @@ public function getDnsName(): ?string */ public function isEmptyElement(): bool { - return empty($this->address) - && empty($this->dnsName); + return empty($this->getAddress()) + && empty($this->getDnsName()); } @@ -84,8 +83,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, SubjectLocality::NS, InvalidDOMElementException::class); return new static( - self::getOptionalAttribute($xml, 'Address', null), - self::getOptionalAttribute($xml, 'DNSName', null), + self::getOptionalAttribute($xml, 'Address', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'DNSName', DomainValue::class, null), ); } @@ -101,11 +100,11 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getAddress() !== null) { - $e->setAttribute('Address', $this->getAddress()); + $e->setAttribute('Address', $this->getAddress()->getValue()); } if ($this->getDnsName() !== null) { - $e->setAttribute('DNSName', $this->getDnsName()); + $e->setAttribute('DNSName', $this->getDnsName()->getValue()); } return $e; diff --git a/src/XML/saml/UnknownCondition.php b/src/XML/saml/UnknownCondition.php index e2999da94c..a06b737f3f 100644 --- a/src/XML/saml/UnknownCondition.php +++ b/src/XML/saml/UnknownCondition.php @@ -6,6 +6,7 @@ use DOMElement; use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\Type\QNameValue; /** * Class for unknown conditions. @@ -16,11 +17,11 @@ final class UnknownCondition extends AbstractCondition { /** * @param \SimpleSAML\XML\Chunk $chunk The whole Condition element as a chunk object. - * @param string $type The xsi:type of this condition. + * @param \SimpleSAML\XML\Type\QNameValue $type The xsi:type of this condition. */ public function __construct( protected Chunk $chunk, - string $type, + QNameValue $type, ) { parent::__construct($type); } diff --git a/src/XML/saml/UnknownID.php b/src/XML/saml/UnknownID.php index 122d84c250..6678897046 100644 --- a/src/XML/saml/UnknownID.php +++ b/src/XML/saml/UnknownID.php @@ -5,7 +5,9 @@ namespace SimpleSAML\SAML2\XML\saml; use DOMElement; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\Type\QNameValue; /** * Class for unknown identifiers. @@ -16,15 +18,15 @@ final class UnknownID extends AbstractBaseID { /** * @param \SimpleSAML\XML\Chunk $chunk The whole BaseID element as a chunk object. - * @param string $type The xsi:type of this identifier. - * @param string|null $NameQualifier - * @param string|null $SPNameQualifier + * @param \SimpleSAML\XML\Type\QNameValue $type The xsi:type of this identifier. + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier */ public function __construct( protected Chunk $chunk, - string $type, - ?string $NameQualifier = null, - ?string $SPNameQualifier = null, + QNameValue $type, + ?SAMLStringValue $NameQualifier = null, + ?SAMLStringValue $SPNameQualifier = null, ) { parent::__construct($type, $NameQualifier, $SPNameQualifier); } diff --git a/src/XML/saml/UnknownStatement.php b/src/XML/saml/UnknownStatement.php index 0008fa1bc8..b7bf5913f8 100644 --- a/src/XML/saml/UnknownStatement.php +++ b/src/XML/saml/UnknownStatement.php @@ -6,6 +6,7 @@ use DOMElement; use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\Type\QNameValue; /** * Class for unknown statements. @@ -16,11 +17,11 @@ final class UnknownStatement extends AbstractStatement { /** * @param \SimpleSAML\XML\Chunk $chunk The whole Statement element as a chunk object. - * @param string $type The xsi:type of this statement + * @param \SimpleSAML\XML\Type\QNameValue $type The xsi:type of this statement */ public function __construct( protected Chunk $chunk, - string $type, + QNameValue $type, ) { parent::__construct($type); } diff --git a/src/XML/samlp/AbstractMessage.php b/src/XML/samlp/AbstractMessage.php index b31fc35337..d36fc4a370 100644 --- a/src/XML/samlp/AbstractMessage.php +++ b/src/XML/samlp/AbstractMessage.php @@ -4,20 +4,15 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Utils; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\SignableElementTrait; -use SimpleSAML\SAML2\XML\SignedElementTrait; -use SimpleSAML\XML\Utils\Random as RandomUtils; -use SimpleSAML\XMLSecurity\XML\SignableElementInterface; -use SimpleSAML\XMLSecurity\XML\SignedElementInterface; +use SimpleSAML\SAML2\XML\{SignableElementTrait, SignedElementTrait}; +use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSecurity\XML\{SignableElementInterface, SignedElementInterface}; use function array_pop; @@ -54,29 +49,22 @@ abstract class AbstractMessage extends AbstractSamlpElement implements SignableE * Initialize a message. * * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param \DateTimeImmutable|null $issueInstant - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $issueInstant + * @param \SipmleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * * @throws \Exception */ protected function __construct( + protected IDValue $id, protected ?Issuer $issuer = null, - protected ?string $id = null, - protected string $version = '2.0', - protected ?DateTimeImmutable $issueInstant = null, - protected ?string $destination = null, - protected ?string $consent = null, + protected ?SAMLDateTimeValue $issueInstant = null, + protected ?SAMLAnyURIValue $destination = null, + protected ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { - Assert::nullOrSame($issueInstant?->getTimeZone()->getName(), 'Z', ProtocolViolationException::class); - Assert::nullOrValidNCName($id); // Covers the empty string - Assert::nullOrValidURI($destination); - Assert::nullOrValidURI($consent); - $this->setExtensions($extensions); } @@ -84,40 +72,21 @@ protected function __construct( /** * Retrieve the identifier of this message. * - * @return string The identifier of this message + * @return \SimpleSAML\XML\Type\IDValue The identifier of this message */ - public function getId(): string + public function getId(): IDValue { - if ($this->id === null) { - return (new RandomUtils())->generateId(); - } - return $this->id; } - /** - * Retrieve the version of this message. - * - * @return string The version of this message - */ - public function getVersion(): string - { - return $this->version; - } - - /** * Retrieve the issue timestamp of this message. * - * @return \DateTimeImmutable The issue timestamp of this message, as an UNIX timestamp + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue The issue timestamp of this message, as an UNIX timestamp */ - public function getIssueInstant(): DateTimeImmutable + public function getIssueInstant(): SAMLDateTimeValue { - if ($this->issueInstant === null) { - return Utils::getContainer()->getClock()->now(); - } - return $this->issueInstant; } @@ -125,9 +94,10 @@ public function getIssueInstant(): DateTimeImmutable /** * Retrieve the destination of this message. * - * @return string|null The destination of this message, or NULL if no destination is given + * @return \SimpleSAML\SAML\Type\SAMLAnyURIValue|null The destination of this message, + * or NULL if no destination is given */ - public function getDestination(): ?string + public function getDestination(): ?SAMLAnyURIValue { return $this->destination; } @@ -138,9 +108,9 @@ public function getDestination(): ?string * Most likely (though not required) a value of urn:oasis:names:tc:SAML:2.0:consent. * * @see \SimpleSAML\SAML2\Constants - * @return string|null Consent + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null Consent */ - public function getConsent(): ?string + public function getConsent(): ?SAMLAnyURIValue { return $this->consent; } @@ -210,19 +180,19 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement $root = $this->instantiateParentElement($parent); /* Ugly hack to add another namespace declaration to the root element. */ - $root->setAttributeNS(C::NS_SAML, 'saml:tmp', 'tmp'); - $root->removeAttributeNS(C::NS_SAML, 'tmp'); +// $root->setAttributeNS(C::NS_SAML, 'saml:tmp', 'tmp'); +// $root->removeAttributeNS(C::NS_SAML, 'tmp'); - $root->setAttribute('Version', $this->getVersion()); - $root->setAttribute('ID', $this->getId()); - $root->setAttribute('IssueInstant', $this->getIssueInstant()->format(C::DATETIME_FORMAT)); + $root->setAttribute('Version', '2.0'); + $root->setAttribute('ID', $this->getId()->getValue()); + $root->setAttribute('IssueInstant', $this->getIssueInstant()->getValue()); if ($this->getDestination() !== null) { - $root->setAttribute('Destination', $this->getDestination()); + $root->setAttribute('Destination', $this->getDestination()->getValue()); } - if ($this->getConsent() !== null && $this->getConsent() !== C::CONSENT_UNSPECIFIED) { - $root->setAttribute('Consent', $this->getConsent()); + if ($this->getConsent() !== null && $this->getConsent()->getValue() !== C::CONSENT_UNSPECIFIED) { + $root->setAttribute('Consent', $this->getConsent()->getValue()); } $this->getIssuer()?->toXML($root); diff --git a/src/XML/samlp/AbstractStatusResponse.php b/src/XML/samlp/AbstractStatusResponse.php index 8ff880c910..52b17c5cbc 100644 --- a/src/XML/samlp/AbstractStatusResponse.php +++ b/src/XML/samlp/AbstractStatusResponse.php @@ -4,17 +4,17 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; /** * Base class for all SAML 2 response messages. * - * Implements samlp:StatusResponseType. All of the elements in that type is - * stored in the \SimpleSAML\SAML2\Message class, and this class is therefore more + * Implements samlp:StatusResponseType. All of the elements in that type are + * stored in the \SimpleSAML\SAML2\XML\AbstractMessage class, and this class is therefore more * or less empty. It is included mainly to make it easy to separate requests from * responses. * @@ -25,32 +25,28 @@ abstract class AbstractStatusResponse extends AbstractMessage /** * Constructor for SAML 2 response messages. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param string|null $inResponseTo - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions * * @throws \Exception */ protected function __construct( + IDValue $id, protected Status $status, - DateTimeImmutable $issueInstant, + SAMLDateTimeValue $issueInstant, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - protected ?string $inResponseTo = null, - ?string $destination = null, - ?string $consent = null, + protected ?NCNameValue $inResponseTo = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { - Assert::nullOrValidNCName($inResponseTo); // Covers the empty string - - parent::__construct($issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions); } @@ -61,16 +57,16 @@ protected function __construct( */ public function isSuccess(): bool { - return $this->status->getStatusCode()->getValue() === C::STATUS_SUCCESS; + return strval($this->status->getStatusCode()->getValue()) === C::STATUS_SUCCESS; } /** * Retrieve the ID of the request this is a response to. * - * @return string|null The ID of the request. + * @return \SimpleSAML\XML\Type\NCNameValue|null The ID of the request. */ - public function getInResponseTo(): ?string + public function getInResponseTo(): ?NCNameValue { return $this->inResponseTo; } @@ -98,7 +94,7 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement $e = parent::toUnsignedXML($parent); if ($this->getInResponseTo() !== null) { - $e->setAttribute('InResponseTo', $this->getInResponseTo()); + $e->setAttribute('InResponseTo', $this->getInResponseTo()->getValue()); } $this->getStatus()->toXML($e); diff --git a/src/XML/samlp/AbstractSubjectQuery.php b/src/XML/samlp/AbstractSubjectQuery.php index a7bf87bf9f..689f0b5367 100644 --- a/src/XML/samlp/AbstractSubjectQuery.php +++ b/src/XML/samlp/AbstractSubjectQuery.php @@ -4,11 +4,11 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\XML\saml\{Issuer, Subject}; +use SimpleSAML\XML\Type\IDValue; /** * Base class for SAML 2 subject query messages. @@ -26,26 +26,24 @@ abstract class AbstractSubjectQuery extends AbstractRequest /** * Constructor for SAML 2 response messages. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer - * @param string|null $id - * @param string $version - * @param \DateTimeImmutable $issueInstant - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions */ protected function __construct( + IDValue $id, protected Subject $subject, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?DateTimeImmutable $issueInstant = null, - ?string $destination = null, - ?string $consent = null, + ?SAMLDateTimeValue $issueInstant = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { - parent::__construct($issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions); } diff --git a/src/XML/samlp/Artifact.php b/src/XML/samlp/Artifact.php index 423383ec76..309ab54aff 100644 --- a/src/XML/samlp/Artifact.php +++ b/src/XML/samlp/Artifact.php @@ -4,12 +4,9 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DOMElement; -use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Base64ElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Type\Base64BinaryValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class for SAML artifacts. @@ -18,36 +15,10 @@ */ final class Artifact extends AbstractSamlpElement implements SchemaValidatableElementInterface { - use Base64ElementTrait; use SchemaValidatableElementTrait; + use TypedTextContentTrait; - /** - * Initialize an artifact. - * - * @param string $content - */ - public function __construct( - string $content, - ) { - $this->setContent($content); - } - - - /** - * Convert XML into an Artifact - * - * @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 - { - Assert::same($xml->localName, 'Artifact', InvalidDOMElementException::class); - Assert::same($xml->namespaceURI, Artifact::NS, InvalidDOMElementException::class); - - return new static($xml->textContent); - } + /** @var string */ + public const TEXTCONTENT_TYPE = Base64BinaryValue::class; } diff --git a/src/XML/samlp/ArtifactResolve.php b/src/XML/samlp/ArtifactResolve.php index 5090893e29..5f3fe8a699 100644 --- a/src/XML/samlp/ArtifactResolve.php +++ b/src/XML/samlp/ArtifactResolve.php @@ -4,22 +4,17 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; -use function preg_replace; /** * The Artifact is part of the SAML 2.0 IdP code, and it builds an artifact object. @@ -36,28 +31,26 @@ class ArtifactResolve extends AbstractRequest implements SchemaValidatableElemen /** * Initialize an ArtifactResolve. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Artifact $artifact - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\SAML2\Type\DateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * * @throws \Exception */ final public function __construct( + IDValue $id, protected Artifact $artifact, - DateTimeImmutable $issueInstant, + SAMLDateTimeValue $issueInstant, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $destination = null, - ?string $consent = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { - parent::__construct($issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions); } @@ -88,19 +81,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'ArtifactResolve', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ArtifactResolve::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', $version->getValue(), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', $version->getValue(), '>='), RequestVersionTooHighException::class); $issuer = Issuer::getChildrenOfClass($xml); Assert::maxCount($issuer, 1); @@ -121,13 +104,12 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($artifact, 1, 'Only one samlp:Artifact is allowed.', TooManyElementsException::class); $resolve = new static( + self::getAttribute($xml, 'ID', IDValue::class), $artifact[0], - $issueInstant, + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), array_pop($issuer), - $id, - $version, - self::getOptionalAttribute($xml, 'Destination', null), - self::getOptionalAttribute($xml, 'Consent', null), + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), array_pop($extensions), ); diff --git a/src/XML/samlp/ArtifactResponse.php b/src/XML/samlp/ArtifactResponse.php index cc242c0e32..616186e95b 100644 --- a/src/XML/samlp/ArtifactResponse.php +++ b/src/XML/samlp/ArtifactResponse.php @@ -4,22 +4,18 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; -use function preg_replace; use function version_compare; /** @@ -36,35 +32,32 @@ class ArtifactResponse extends AbstractStatusResponse implements SchemaValidatab /** * Constructor for SAML 2 ArtifactResponse. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param string|null $inResponseTo - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions * @param \SimpleSAML\SAML2\XML\samlp\AbstractMessage|null $message */ final public function __construct( + IDValue $id, Status $status, - DateTimeImmutable $issueInstant, + SAMLDateTimeValue $issueInstant, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $inResponseTo = null, - ?string $destination = null, - ?string $consent = null, + ?NCNameValue $inResponseTo = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, protected ?AbstractMessage $message = null, ) { parent::__construct( + $id, $status, $issueInstant, $issuer, - $id, - $version, $inResponseTo, $destination, $consent, @@ -100,23 +93,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'ArtifactResponse', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, ArtifactResponse::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $inResponseTo = self::getOptionalAttribute($xml, 'InResponseTo', null); - $destination = self::getOptionalAttribute($xml, 'Destination', null); - $consent = self::getOptionalAttribute($xml, 'Consent', null); - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', $version->getValue(), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', $version->getValue(), '>='), RequestVersionTooHighException::class); $issuer = Issuer::getChildrenOfClass($xml); Assert::countBetween($issuer, 0, 1); @@ -155,14 +134,13 @@ public static function fromXML(DOMElement $xml): static ); $response = new static( + self::getAttribute($xml, 'ID', IDValue::class), array_pop($status), - $issueInstant, + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), empty($issuer) ? null : array_pop($issuer), - $id, - $version, - $inResponseTo, - $destination, - $consent, + self::getOptionalAttribute($xml, 'InResponseTo', NCNameValue::class, null), + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), empty($extensions) ? null : array_pop($extensions), $message, ); diff --git a/src/XML/samlp/AssertionIDRequest.php b/src/XML/samlp/AssertionIDRequest.php index 01c4a26420..a846be2a91 100644 --- a/src/XML/samlp/AssertionIDRequest.php +++ b/src/XML/samlp/AssertionIDRequest.php @@ -4,23 +4,18 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\AssertionIDRef; -use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\XML\saml\{AssertionIDRef, Issuer}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; -use function preg_replace; use function version_compare; /** @@ -34,34 +29,31 @@ final class AssertionIDRequest extends AbstractRequest implements SchemaValidata /** * Initialize an AssertionIDRequest. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\AssertionIDRef[] $assertionIDRef * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param \DateTimeImmutable|null $issueInstant - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\DateTimeValue|null $issueInstant + * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException */ public function __construct( + IDValue $id, protected array $assertionIDRef, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?DateTimeImmutable $issueInstant = null, - ?string $destination = null, - ?string $consent = null, + ?SAMLDateTimeValue $issueInstant = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { Assert::maxCount($assertionIDRef, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($assertionIDRef, AssertionIDRef::class, InvalidDOMElementException::class); parent::__construct( - $issuer, $id, - $version, + $issuer, $issueInstant, $destination, $consent, @@ -104,19 +96,9 @@ public static function fromXML(DOMElement $xml): static $issuer = Issuer::getChildrenOfClass($xml); Assert::maxCount($issuer, 1, 'Only one element is allowed.', TooManyElementsException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); $extensions = Extensions::getChildrenOfClass($xml); Assert::maxCount( @@ -135,13 +117,12 @@ public static function fromXML(DOMElement $xml): static ); $request = new static( + self::getAttribute($xml, 'ID', IDValue::class), $assertionIDRef, array_pop($issuer), - $id, - $version, - $issueInstant, - self::getOptionalAttribute($xml, 'Destination', null), - self::getOptionalAttribute($xml, 'Consent', null), + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), array_pop($extensions), ); diff --git a/src/XML/samlp/AttributeQuery.php b/src/XML/samlp/AttributeQuery.php index d2d1c72ff0..2d8d94489d 100644 --- a/src/XML/samlp/AttributeQuery.php +++ b/src/XML/samlp/AttributeQuery.php @@ -4,21 +4,16 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{Attribute, Issuer, Subject}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -47,25 +42,23 @@ class AttributeQuery extends AbstractSubjectQuery implements SchemaValidatableEl /** * Constructor for SAML 2 AttributeQuery. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Attribute[] $attributes * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer - * @param string|null $id - * @param string $version - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions */ final public function __construct( + IDValue $id, Subject $subject, - DateTimeImmutable $issueInstant, + SAMLDateTimeValue $issueInstant, protected array $attributes = [], ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $destination = null, - ?string $consent = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { Assert::maxCount($attributes, C::UNBOUNDED_LIMIT); @@ -74,7 +67,7 @@ final public function __construct( $cache = []; foreach ($attributes as $attribute) { $name = $attribute->getName(); - $nameFormat = $attribute->getNameFormat(); + $nameFormat = $attribute->getNameFormat()?->getValue() ?? C::NAMEFORMAT_UNSPECIFIED; if (isset($cache[$nameFormat])) { Assert::true( @@ -87,7 +80,7 @@ final public function __construct( } unset($cache); - parent::__construct($subject, $issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $subject, $issuer, $issueInstant, $destination, $consent, $extensions); } @@ -122,22 +115,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AttributeQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeQuery::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $destination = self::getOptionalAttribute($xml, 'Destination', null); - $consent = self::getOptionalAttribute($xml, 'Consent', null); - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); $issuer = Issuer::getChildrenOfClass($xml); Assert::countBetween($issuer, 0, 1); @@ -163,14 +143,13 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.', TooManyElementsException::class); $request = new static( + self::getAttribute($xml, 'ID', IDValue::class), array_pop($subject), - $issueInstant, + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), Attribute::getChildrenOfClass($xml), array_pop($issuer), - $id, - $version, - $destination, - $consent, + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), array_pop($extensions), ); diff --git a/src/XML/samlp/AuthnQuery.php b/src/XML/samlp/AuthnQuery.php index 4294033628..d01649c19d 100644 --- a/src/XML/samlp/AuthnQuery.php +++ b/src/XML/samlp/AuthnQuery.php @@ -4,24 +4,18 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{Issuer, Subject}; use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; -use function preg_replace; use function version_compare; /** @@ -37,30 +31,28 @@ final class AuthnQuery extends AbstractSubjectQuery implements SchemaValidatable /** * Constructor for SAML 2 AuthnQuery. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject * @param \SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext|null $requestedAuthnContext - * @param string|null $sessionIndex + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $sessionIndex * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer - * @param string|null $id - * @param string $version - * @param \DateTimeImmutable $issueInstant - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions */ public function __construct( + IDValue $id, Subject $subject, - DateTimeImmutable $issueInstant, + SAMLDateTimeValue $issueInstant, protected ?RequestedAuthnContext $requestedAuthnContext = null, - protected ?string $sessionIndex = null, + protected ?SAMLStringValue $sessionIndex = null, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $destination = null, - ?string $consent = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { - parent::__construct($subject, $issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $subject, $issuer, $issueInstant, $destination, $consent, $extensions); } @@ -78,9 +70,9 @@ public function getRequestedAuthnContext(): ?RequestedAuthnContext /** * Retrieve session index. * - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getSessionIndex(): ?string + public function getSessionIndex(): ?SAMLStringValue { return $this->sessionIndex; } @@ -107,22 +99,8 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->namespaceURI, AuthnQuery::NS, InvalidDOMElementException::class); $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $destination = self::getOptionalAttribute($xml, 'Destination', null); - $consent = self::getOptionalAttribute($xml, 'Consent', null); - $sessionIndex = self::getOptionalAttribute($xml, 'SessionIndex', null); - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + Assert::true(version_compare('2.0', $version->getValue(), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', $version->getValue(), '>='), RequestVersionTooHighException::class); $requestedAuthnContext = RequestedAuthnContext::getChildrenOfClass($xml); @@ -150,15 +128,14 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.', TooManyElementsException::class); $request = new static( + self::getAttribute($xml, 'ID', IDValue::class), array_pop($subject), - $issueInstant, + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), array_pop($requestedAuthnContext), - $sessionIndex, + self::getOptionalAttribute($xml, 'SessionIndex', SAMLStringValue::class, null), array_pop($issuer), - $id, - $version, - $destination, - $consent, + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), array_pop($extensions), ); @@ -183,7 +160,7 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement $sessionIndex = $this->getSessionIndex(); if ($sessionIndex !== null) { - $e->setAttribute('SessionIndex', $sessionIndex); + $e->setAttribute('SessionIndex', $sessionIndex->getValue()); } $this->getRequestedAuthnContext()?->toXML($e); diff --git a/src/XML/samlp/AuthnRequest.php b/src/XML/samlp/AuthnRequest.php index 86476ec420..78905951a4 100644 --- a/src/XML/samlp/AuthnRequest.php +++ b/src/XML/samlp/AuthnRequest.php @@ -4,19 +4,15 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{Conditions, Issuer, Subject}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{BooleanValue, IDValue, UnsignedShortValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -35,49 +31,46 @@ class AuthnRequest extends AbstractRequest implements SchemaValidatableElementIn /** * Constructor for SAML 2 AuthnRequest * - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext|null $requestedAuthnContext * @param \SimpleSAML\SAML2\XML\saml\Subject|null $subject * @param \SimpleSAML\SAML2\XML\samlp\NameIDPolicy|null $nameIdPolicy * @param \SimpleSAML\SAML2\XML\saml\Conditions|null $conditions - * @param bool|null $forceAuthn - * @param bool|null $isPassive - * @param string|null $assertionConsumerServiceURL - * @param int|null $assertionConsumerServiceIndex - * @param string|null $protocolBinding - * @param int|null $attributeConsumingServiceIndex - * @param string|null $providerName + * @param \SimpleSAML\XML\Type\BooleanValue|null $forceAuthn + * @param \SimpleSAML\XML\Type\BooleanValue|null $isPassive + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $assertionConsumerServiceURL + * @param \SimpleSAML\XML\Type\UnsignedShortValue|null $assertionConsumerServiceIndex + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $protocolBinding + * @param \SimpleSAML\XML\Type\UnsignedShortValue|null $attributeConsumingServiceIndex + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $providerName * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions * @param \SimpleSAML\SAML2\XML\samlp\Scoping|null $scoping * @throws \Exception */ final public function __construct( - DateTimeImmutable $issueInstant, + IDValue $id, + SAMLDateTimeValue $issueInstant, protected ?RequestedAuthnContext $requestedAuthnContext = null, protected ?Subject $subject = null, protected ?NameIDPolicy $nameIdPolicy = null, protected ?Conditions $conditions = null, - protected ?bool $forceAuthn = null, - protected ?bool $isPassive = null, - protected ?string $assertionConsumerServiceURL = null, - protected ?int $assertionConsumerServiceIndex = null, - protected ?string $protocolBinding = null, - protected ?int $attributeConsumingServiceIndex = null, - protected ?string $providerName = null, + protected ?BooleanValue $forceAuthn = null, + protected ?BooleanValue $isPassive = null, + protected ?SAMLAnyURIValue $assertionConsumerServiceURL = null, + protected ?UnsignedShortValue $assertionConsumerServiceIndex = null, + protected ?SAMLAnyURIValue $protocolBinding = null, + protected ?UnsignedShortValue $attributeConsumingServiceIndex = null, + protected ?SAMLStringValue $providerName = null, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $destination = null, - ?string $consent = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, protected ?Scoping $scoping = null, ) { - Assert::nullOrNotWhitespaceOnly($providerName); Assert::oneOf( null, [$assertionConsumerServiceURL, $assertionConsumerServiceIndex], @@ -92,12 +85,8 @@ final public function __construct( . ' please specify one or the other.', ProtocolViolationException::class, ); - Assert::nullOrValidURL($assertionConsumerServiceURL); - Assert::nullOrValidURI($protocolBinding); - Assert::nullOrRange($attributeConsumingServiceIndex, 0, 65535); - Assert::nullOrRange($assertionConsumerServiceIndex, 0, 65535); - parent::__construct($issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions); } @@ -143,9 +132,9 @@ public function getNameIdPolicy(): ?NameIDPolicy /** * Retrieve the value of the ForceAuthn attribute. * - * @return bool|null The ForceAuthn attribute. + * @return \SimpleSAML\XML\Type\BooleanValue|null The ForceAuthn attribute. */ - public function getForceAuthn(): ?bool + public function getForceAuthn(): ?BooleanValue { return $this->forceAuthn; } @@ -154,9 +143,9 @@ public function getForceAuthn(): ?bool /** * Retrieve the value of the ProviderName attribute. * - * @return string|null The ProviderName attribute. + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null The ProviderName attribute. */ - public function getProviderName(): ?string + public function getProviderName(): ?SAMLStringValue { return $this->providerName; } @@ -165,9 +154,9 @@ public function getProviderName(): ?string /** * Retrieve the value of the IsPassive attribute. * - * @return bool|null The IsPassive attribute. + * @return \SimpleSAML\XML\Type\BooleanValue|null The IsPassive attribute. */ - public function getIsPassive(): ?bool + public function getIsPassive(): ?BooleanValue { return $this->isPassive; } @@ -176,9 +165,9 @@ public function getIsPassive(): ?bool /** * Retrieve the value of the AssertionConsumerServiceURL attribute. * - * @return string|null The AssertionConsumerServiceURL attribute. + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null The AssertionConsumerServiceURL attribute. */ - public function getAssertionConsumerServiceURL(): ?string + public function getAssertionConsumerServiceURL(): ?SAMLAnyURIValue { return $this->assertionConsumerServiceURL; } @@ -187,9 +176,9 @@ public function getAssertionConsumerServiceURL(): ?string /** * Retrieve the value of the ProtocolBinding attribute. * - * @return string|null The ProtocolBinding attribute. + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null The ProtocolBinding attribute. */ - public function getProtocolBinding(): ?string + public function getProtocolBinding(): ?SAMLAnyURIValue { return $this->protocolBinding; } @@ -198,9 +187,9 @@ public function getProtocolBinding(): ?string /** * Retrieve the value of the AttributeConsumingServiceIndex attribute. * - * @return int|null The AttributeConsumingServiceIndex attribute. + * @return \SimpleSAML\XML\Type\UnsignedShortValue|null The AttributeConsumingServiceIndex attribute. */ - public function getAttributeConsumingServiceIndex(): ?int + public function getAttributeConsumingServiceIndex(): ?UnsignedShortValue { return $this->attributeConsumingServiceIndex; } @@ -209,9 +198,9 @@ public function getAttributeConsumingServiceIndex(): ?int /** * Retrieve the value of the AssertionConsumerServiceIndex attribute. * - * @return int|null The AssertionConsumerServiceIndex attribute. + * @return \SimpleSAML\XML\Type\UnsignedShortValue|null The AssertionConsumerServiceIndex attribute. */ - public function getAssertionConsumerServiceIndex(): ?int + public function getAssertionConsumerServiceIndex(): ?UnsignedShortValue { return $this->assertionConsumerServiceIndex; } @@ -246,30 +235,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AuthnRequest', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnRequest::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); - - $attributeConsumingServiceIndex = self::getOptionalIntegerAttribute( - $xml, - 'AttributeConsumingServiceIndex', - null, - ); - $assertionConsumerServiceIndex = self::getOptionalIntegerAttribute( - $xml, - 'AssertionConsumerServiceIndex', - null, - ); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); $conditions = Conditions::getChildrenOfClass($xml); Assert::maxCount( @@ -321,23 +289,22 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($scoping, 1, 'Only one element is allowed.', TooManyElementsException::class); $request = new static( - $issueInstant, + self::getAttribute($xml, 'ID', IDValue::class), + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), array_pop($requestedAuthnContext), array_pop($subject), array_pop($nameIdPolicy), array_pop($conditions), - self::getOptionalBooleanAttribute($xml, 'ForceAuthn', null), - self::getOptionalBooleanAttribute($xml, 'IsPassive', null), - self::getOptionalAttribute($xml, 'AssertionConsumerServiceURL', null), - $assertionConsumerServiceIndex, - self::getOptionalAttribute($xml, 'ProtocolBinding', null), - $attributeConsumingServiceIndex, - self::getOptionalAttribute($xml, 'ProviderName', null), + self::getOptionalAttribute($xml, 'ForceAuthn', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'IsPassive', BooleanValue::class, null), + self::getOptionalAttribute($xml, 'AssertionConsumerServiceURL', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'AssertionConsumerServiceIndex', UnsignedShortValue::class, null), + self::getOptionalAttribute($xml, 'ProtocolBinding', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'AttributeConsumingServiceIndex', UnsignedShortValue::class, null), + self::getOptionalAttribute($xml, 'ProviderName', SAMLStringValue::class, null), array_pop($issuer), - $id, - $version, - self::getOptionalAttribute($xml, 'Destination', null), - self::getOptionalAttribute($xml, 'Consent', null), + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), array_pop($extensions), array_pop($scoping), ); @@ -363,25 +330,25 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement $e = parent::toUnsignedXML($parent); if ($this->getForceAuthn() === true) { - $e->setAttribute('ForceAuthn', 'true'); + $e->setAttribute('ForceAuthn', strval($this->getForceAuthn())); } if ($this->getProviderName() !== null) { - $e->setAttribute('ProviderName', $this->getProviderName()); + $e->setAttribute('ProviderName', strval($this->getProviderName())); } if ($this->getIsPassive() === true) { - $e->setAttribute('IsPassive', 'true'); + $e->setAttribute('IsPassive', strval($this->getIsPassive())); } if ($this->getAssertionConsumerServiceIndex() !== null) { $e->setAttribute('AssertionConsumerServiceIndex', strval($this->getAssertionConsumerServiceIndex())); } else { if ($this->getAssertionConsumerServiceURL() !== null) { - $e->setAttribute('AssertionConsumerServiceURL', $this->getAssertionConsumerServiceURL()); + $e->setAttribute('AssertionConsumerServiceURL', strval($this->getAssertionConsumerServiceURL())); } if ($this->getProtocolBinding() !== null) { - $e->setAttribute('ProtocolBinding', $this->getProtocolBinding()); + $e->setAttribute('ProtocolBinding', strval($this->getProtocolBinding())); } } diff --git a/src/XML/samlp/AuthzDecisionQuery.php b/src/XML/samlp/AuthzDecisionQuery.php index c76e2bb7d0..3c3e46566a 100644 --- a/src/XML/samlp/AuthzDecisionQuery.php +++ b/src/XML/samlp/AuthzDecisionQuery.php @@ -4,23 +4,20 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\Action; -use SimpleSAML\SAML2\XML\saml\Evidence; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{Action, Evidence, Issuer, Subject}; +use SimpleSAML\XML\Exception\{ + InvalidDOMElementException, + MissingElementException, + SchemaViolationException, + TooManyElementsException, +}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function version_compare; @@ -38,45 +35,42 @@ final class AuthzDecisionQuery extends AbstractSubjectQuery implements SchemaVal /** * Constructor for SAML 2 AuthzDecisionQuery. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject - * @param string $resource + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $resource * @param \SimpleSAML\SAML2\XML\saml\Action[] $action * @param \SimpleSAML\SAML2\XML\saml\Evidence $evidence * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer - * @param string|null $id - * @param string $version - * @param \DateTimeImmutable $issueInstant - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions */ public function __construct( + IDVaLue $id, Subject $subject, - DateTimeImmutable $issueInstant, - protected string $resource, + SAMLDateTimeValue $issueInstant, + protected SAMLAnyURIValue $resource, protected array $action, protected ?Evidence $evidence = null, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $destination = null, - ?string $consent = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { - Assert::validURI($resource); Assert::maxCount($action, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($action, Action::class, SchemaViolationException::class); - parent::__construct($subject, $issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $subject, $issuer, $issueInstant, $destination, $consent, $extensions); } /** * Collect the value of the resource-property * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getResource(): string + public function getResource(): SAMLAnyURIValue { return $this->resource; } @@ -121,22 +115,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AuthzDecisionQuery', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthzDecisionQuery::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $destination = self::getOptionalAttribute($xml, 'Destination', null); - $consent = self::getOptionalAttribute($xml, 'Consent', null); - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', $version->getValue(), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', $version->getValue(), '>='), RequestVersionTooHighException::class); $issuer = Issuer::getChildrenOfClass($xml); Assert::countBetween($issuer, 0, 1); @@ -178,16 +159,15 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.', TooManyElementsException::class); $request = new static( + self::getAttribute($xml, 'ID', IDValue::class), array_pop($subject), - $issueInstant, - self::getAttribute($xml, 'Resource'), + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), + self::getAttribute($xml, 'Resource', SAMLAnyURIValue::class), $action, array_pop($evidence), array_pop($issuer), - $id, - $version, - $destination, - $consent, + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), array_pop($extensions), ); @@ -209,7 +189,7 @@ public static function fromXML(DOMElement $xml): static protected function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); - $e->setAttribute('Resource', $this->getResource()); + $e->setAttribute('Resource', $this->getResource()->getValue()); foreach ($this->getAction() as $action) { $action->toXML($e); diff --git a/src/XML/samlp/Extensions.php b/src/XML/samlp/Extensions.php index 5808ab4aa8..05230e1e61 100644 --- a/src/XML/samlp/Extensions.php +++ b/src/XML/samlp/Extensions.php @@ -5,13 +5,12 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\ExtensionsTrait; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; /** * Class for handling SAML2 extensions. diff --git a/src/XML/samlp/GetComplete.php b/src/XML/samlp/GetComplete.php index 4e7ea75144..d89ceb5f0c 100644 --- a/src/XML/samlp/GetComplete.php +++ b/src/XML/samlp/GetComplete.php @@ -4,13 +4,14 @@ namespace SimpleSAML\SAML2\XML\samlp; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\XML\URIElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; +use function strval; /** * Class representing a samlp:GetComplete element. @@ -20,16 +21,10 @@ final class GetComplete extends AbstractSamlpElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; /** @@ -43,7 +38,9 @@ public static function fromArray(array $data): static Assert::allString($data, ArrayValidationException::class); $index = array_key_first($data); - return new static($data[$index]); + return new static( + SAMLAnyURIValue::fromString($data[$index]), + ); } @@ -54,6 +51,6 @@ public static function fromArray(array $data): static */ public function toArray(): array { - return [$this->getContent()]; + return [strval($this->getContent())]; } } diff --git a/src/XML/samlp/IDPEntry.php b/src/XML/samlp/IDPEntry.php index d835de03ca..fbbed9000f 100644 --- a/src/XML/samlp/IDPEntry.php +++ b/src/XML/samlp/IDPEntry.php @@ -5,12 +5,11 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_change_key_case; use function array_filter; @@ -30,43 +29,40 @@ final class IDPEntry extends AbstractSamlpElement implements SchemaValidatableEl /** * Initialize an IDPEntry element. * - * @param string $providerId - * @param string|null $name - * @param string|null $loc + * @param \SimpleSAML\SAML2\Type\EntityIDValue $providerId + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $name + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $loc */ public function __construct( - protected string $providerId, - protected ?string $name = null, - protected ?string $loc = null, + protected EntityIDValue $providerId, + protected ?SAMLStringValue $name = null, + protected ?SAMLAnyURIValue $loc = null, ) { - SAMLAssert::validEntityID($providerId); - Assert::nullOrNotWhitespaceOnly($name); - SAMLAssert::nullOrValidURI($loc); } /** - * @return string + * @return \SimpleSAML\SAML2\Type\EntityIDValue */ - public function getProviderId(): string + public function getProviderId(): EntityIDValue { return $this->providerId; } /** - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getName(): ?string + public function getName(): ?SAMLStringValue { return $this->name; } /** - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null */ - public function getLoc(): ?string + public function getLoc(): ?SAMLAnyURIValue { return $this->loc; } @@ -88,11 +84,11 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'IDPEntry', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, IDPEntry::NS, InvalidDOMElementException::class); - $providerId = self::getAttribute($xml, 'ProviderID'); - $name = self::getOptionalAttribute($xml, 'Name', null); - $loc = self::getOptionalAttribute($xml, 'Loc', null); - - return new static($providerId, $name, $loc); + return new static( + self::getAttribute($xml, 'ProviderID', EntityIDValue::class), + self::getOptionalAttribute($xml, 'Name', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'Loc', SAMLAnyURIValue::class, null), + ); } @@ -105,14 +101,14 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('ProviderID', $this->getProviderId()); + $e->setAttribute('ProviderID', $this->getProviderId()->getValue()); if ($this->getName() !== null) { - $e->setAttribute('Name', $this->getName()); + $e->setAttribute('Name', $this->getName()->getValue()); } if ($this->getLoc() !== null) { - $e->setAttribute('Loc', $this->getLoc()); + $e->setAttribute('Loc', $this->getLoc()->getValue()); } return $e; @@ -130,9 +126,9 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['ProviderID'], - $data['Name'] ?? null, - $data['Loc'] ?? null, + EntityIDValue::fromString($data['ProviderID']), + $data['Name'] !== null ? SAMLStringValue::fromString($data['Name']) : null, + $data['Loc'] !== null ? SAMLAnyURIValue::fromString($data['Loc']) : null, ); } @@ -186,9 +182,9 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = [ - 'ProviderID' => $this->getProviderID(), - 'Name' => $this->getName(), - 'Loc' => $this->getLoc(), + 'ProviderID' => $this->getProviderID()->getValue(), + 'Name' => $this->getName()?->getValue(), + 'Loc' => $this->getLoc()?->getValue(), ]; return array_filter($data); diff --git a/src/XML/samlp/IDPList.php b/src/XML/samlp/IDPList.php index 2da7c2a4aa..ee2fa1b22a 100644 --- a/src/XML/samlp/IDPList.php +++ b/src/XML/samlp/IDPList.php @@ -5,14 +5,11 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_change_key_case; use function array_filter; diff --git a/src/XML/samlp/LogoutRequest.php b/src/XML/samlp/LogoutRequest.php index d626e08298..e5f0f9eaa3 100644 --- a/src/XML/samlp/LogoutRequest.php +++ b/src/XML/samlp/LogoutRequest.php @@ -4,24 +4,16 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\IdentifierTrait; -use SimpleSAML\SAML2\XML\saml\AbstractBaseID; -use SimpleSAML\SAML2\XML\saml\EncryptedID; -use SimpleSAML\SAML2\XML\saml\IdentifierInterface; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, EncryptedID, IdentifierInterface, Issuer, NameID}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -40,36 +32,34 @@ final class LogoutRequest extends AbstractRequest implements SchemaValidatableEl /** * Constructor for SAML 2 AttributeQuery. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\IdentifierInterface $identifier - * @param \DateTimeImmutable $issueInstant - * @param \DateTimeImmutable|null $notOnOrAfter - * @param string|null $reason + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notOnOrAfter + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $reason * @param \SimpleSAML\SAML2\XML\samlp\SessionIndex[] $sessionIndexes * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * @throws \Exception */ public function __construct( + IDValue $id, IdentifierInterface $identifier, - DateTimeImmutable $issueInstant, - protected ?DateTimeImmutable $notOnOrAfter = null, - protected ?string $reason = null, + SAMLDateTimeValue $issueInstant, + protected ?SAMLDateTimeValue $notOnOrAfter = null, + protected ?SAMLStringValue $reason = null, protected array $sessionIndexes = [], ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $destination = null, - ?string $consent = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { Assert::maxCount($sessionIndexes, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($sessionIndexes, SessionIndex::class); - parent::__construct($issuer, $id, $version, $issueInstant, $destination, $consent, $extensions); + parent::__construct($id, $issuer, $issueInstant, $destination, $consent, $extensions); $this->setIdentifier($identifier); } @@ -78,9 +68,9 @@ public function __construct( /** * Retrieve the expiration time of this request. * - * @return \DateTimeImmutable|null The expiration time of this request. + * @return \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null The expiration time of this request. */ - public function getNotOnOrAfter(): ?DateTimeImmutable + public function getNotOnOrAfter(): ?SAMLDateTimeValue { return $this->notOnOrAfter; } @@ -89,9 +79,9 @@ public function getNotOnOrAfter(): ?DateTimeImmutable /** * Retrieve the reason for this request. * - * @return string|null The reason for this request. + * @return \SimpleSAML\SAML2\Type\StringValue|null The reason for this request. */ - public function getReason(): ?string + public function getReason(): ?SAMLStringValue { return $this->reason; } @@ -129,28 +119,14 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'LogoutRequest', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, LogoutRequest::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string + $id = self::getAttribute($xml, 'ID', IDValue::Class); + $issueInstant = self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class); - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); - - $notOnOrAfter = self::getOptionalAttribute($xml, 'NotOnOrAfter', null); - if ($notOnOrAfter !== null) { - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $notOnOrAfter = preg_replace('/([.][0-9]+Z)$/', 'Z', $notOnOrAfter, 1); - - Assert::validDateTime($notOnOrAfter, ProtocolViolationException::class); - $notOnOrAfter = new DateTimeImmutable($notOnOrAfter); - } + $notOnOrAfter = self::getOptionalAttribute($xml, 'NotOnOrAfter', SAMLDateTimeValue::class, null); $issuer = Issuer::getChildrenOfClass($xml); Assert::countBetween($issuer, 0, 1); @@ -177,16 +153,15 @@ public static function fromXML(DOMElement $xml): static $sessionIndex = SessionIndex::getChildrenOfClass($xml); $request = new static( + $id, $identifier, $issueInstant, $notOnOrAfter, - self::getOptionalAttribute($xml, 'Reason', null), + self::getOptionalAttribute($xml, 'Reason', SAMLStringValue::class, null), $sessionIndex, array_pop($issuer), - $id, - $version, - self::getOptionalAttribute($xml, 'Destination', null), - self::getOptionalAttribute($xml, 'Consent', null), + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), array_pop($extensions), ); @@ -211,11 +186,11 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement $e = parent::toUnsignedXML($parent); if ($this->getNotOnOrAfter() !== null) { - $e->setAttribute('NotOnOrAfter', $this->getNotOnOrAfter()->format(C::DATETIME_FORMAT)); + $e->setAttribute('NotOnOrAfter', $this->getNotOnOrAfter()->getValue()); } if ($this->getReason() !== null) { - $e->setAttribute('Reason', $this->getReason()); + $e->setAttribute('Reason', $this->getReason()->getValue()); } /** @var \SimpleSAML\XML\SerializableElementInterface $identifier */ diff --git a/src/XML/samlp/LogoutResponse.php b/src/XML/samlp/LogoutResponse.php index 54e76df384..d6ffea9650 100644 --- a/src/XML/samlp/LogoutResponse.php +++ b/src/XML/samlp/LogoutResponse.php @@ -4,20 +4,18 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; -use function preg_replace; +use function strval; /** * Class for SAML 2 LogoutResponse messages. @@ -32,35 +30,32 @@ final class LogoutResponse extends AbstractStatusResponse implements SchemaValid /** * Constructor for SAML 2 LogoutResponse. * + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param string|null $inResponseTo - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions * * @throws \Exception */ public function __construct( + IDValue $id, Status $status, - DateTimeImmutable $issueInstant, + SAMLDateTimeValue $issueInstant, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $inResponseTo = null, - ?string $destination = null, - ?string $consent = null, + ?NCNameValue $inResponseTo = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, ) { parent::__construct( + $id, $status, $issueInstant, $issuer, - $id, - $version, $inResponseTo, $destination, $consent, @@ -85,19 +80,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'LogoutResponse', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, LogoutResponse::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); - - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); $issuer = Issuer::getChildrenOfClass($xml); Assert::countBetween($issuer, 0, 1); @@ -112,14 +97,13 @@ public static function fromXML(DOMElement $xml): static Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.'); $response = new static( + self::getAttribute($xml, 'ID', IDValue::class), array_pop($status), - $issueInstant, + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), array_pop($issuer), - $id, - $version, - self::getOptionalAttribute($xml, 'InResponseTo', null), - self::getOptionalAttribute($xml, 'Destination', null), - self::getOptionalAttribute($xml, 'Consent', null), + self::getOptionalAttribute($xml, 'InResponseTo', NCNameValue::class, null), + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), empty($extensions) ? null : array_pop($extensions), ); diff --git a/src/XML/samlp/MessageFactory.php b/src/XML/samlp/MessageFactory.php index c1b863bfa6..d173528a7d 100644 --- a/src/XML/samlp/MessageFactory.php +++ b/src/XML/samlp/MessageFactory.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; diff --git a/src/XML/samlp/NameIDPolicy.php b/src/XML/samlp/NameIDPolicy.php index 1e2f6ae844..6341078da2 100644 --- a/src/XML/samlp/NameIDPolicy.php +++ b/src/XML/samlp/NameIDPolicy.php @@ -5,13 +5,13 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\BooleanValue; use function array_change_key_case; use function array_filter; @@ -34,42 +34,40 @@ final class NameIDPolicy extends AbstractSamlpElement implements /** * Initialize a NameIDPolicy. * - * @param string|null $Format - * @param string|null $SPNameQualifier - * @param bool|null $AllowCreate + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $Format + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier + * @param \SimpleSAML\XML\Type\BooleanValue|null $AllowCreate */ public function __construct( - protected ?string $Format = null, - protected ?string $SPNameQualifier = null, - protected ?bool $AllowCreate = null, + protected ?SAMLAnyURIValue $Format = null, + protected ?SAMLStringValue $SPNameQualifier = null, + protected ?BooleanValue $AllowCreate = null, ) { - SAMLAssert::nullOrValidURI($Format); - Assert::nullOrNotWhitespaceOnly($SPNameQualifier); } /** - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null */ - public function getFormat(): ?string + public function getFormat(): ?SAMLAnyURIValue { return $this->Format; } /** - * @return string|null + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null */ - public function getSPNameQualifier(): ?string + public function getSPNameQualifier(): ?SAMLStringValue { return $this->SPNameQualifier; } /** - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function getAllowCreate(): ?bool + public function getAllowCreate(): ?BooleanValue { return $this->AllowCreate; } @@ -82,9 +80,9 @@ public function getAllowCreate(): ?bool */ public function isEmptyElement(): bool { - return empty($this->Format) - && empty($this->SPNameQualifier) - && empty($this->AllowCreate); + return empty($this->getFormat()) + && empty($this->getSPNameQualifier()) + && empty($this->getAllowCreate()); } @@ -102,9 +100,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'NameIDPolicy', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, NameIDPolicy::NS, InvalidDOMElementException::class); - $Format = self::getOptionalAttribute($xml, 'Format', null); - $SPNameQualifier = self::getOptionalAttribute($xml, 'SPNameQualifier', null); - $AllowCreate = self::getOptionalBooleanAttribute($xml, 'AllowCreate', null); + $Format = self::getOptionalAttribute($xml, 'Format', SAMLAnyURIValue::class, null); + $SPNameQualifier = self::getOptionalAttribute($xml, 'SPNameQualifier', SAMLStringValue::class, null); + $AllowCreate = self::getOptionalAttribute($xml, 'AllowCreate', BooleanValue::class, null); return new static( $Format, @@ -125,15 +123,15 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getFormat()) { - $e->setAttribute('Format', $this->getFormat()); + $e->setAttribute('Format', $this->getFormat()->getValue()); } if ($this->getSPNameQualifier()) { - $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()); + $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue()); } if ($this->getAllowCreate() !== null) { - $e->setAttribute('AllowCreate', var_export($this->getAllowCreate(), true)); + $e->setAttribute('AllowCreate', var_export($this->getAllowCreate()->toBoolean(), true)); } return $e; @@ -151,9 +149,9 @@ public static function fromArray(array $data): static $data = self::processArrayContents($data); return new static( - $data['Format'] ?? null, - $data['SPNameQualifier'] ?? null, - $data['AllowCreate'] ?? null, + $data['Format'] !== null ? SAMLAnyURIValue::fromString($data['Format']) : null, + $data['SPNameQualifier'] !== null ? SAMLStringValue::fromString($data['SPNameQualifier']) : null, + $data['AllowCreate'] !== null ? BooleanValue::fromBoolean($data['AllowCreate']) : null, ); } @@ -206,9 +204,9 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = [ - 'Format' => $this->getFormat(), - 'SPNameQualifier' => $this->getSPNameQualifier(), - 'AllowCreate' => $this->getAllowCreate(), + 'Format' => $this->getFormat()->getValue(), + 'SPNameQualifier' => $this->getSPNameQualifier()->getValue(), + 'AllowCreate' => $this->getAllowCreate()->toBoolean(), ]; return array_filter($data); diff --git a/src/XML/samlp/RequestedAuthnContext.php b/src/XML/samlp/RequestedAuthnContext.php index b3c3d29147..576e490cc9 100644 --- a/src/XML/samlp/RequestedAuthnContext.php +++ b/src/XML/samlp/RequestedAuthnContext.php @@ -5,15 +5,14 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\Comparison; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_merge; @@ -53,12 +52,14 @@ public function __construct( $requestedAuthnContexts, AuthnContextClassRef::class, 'You need either AuthnContextClassRef or AuthnContextDeclRef, not both.', + ProtocolViolationException::class, ); } else { // Can only be AuthnContextDeclRef Assert::allIsInstanceOf( $requestedAuthnContexts, AuthnContextDeclRef::class, 'You need either AuthnContextClassRef or AuthnContextDeclRef, not both.', + ProtocolViolationException::class, ); } } @@ -100,13 +101,19 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'RequestedAuthnContext', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RequestedAuthnContext::NS, InvalidDOMElementException::class); - $Comparison = self::getOptionalAttribute($xml, 'Comparison', 'unknown'); + $Comparison = self::getOptionalAttribute( + $xml, + 'Comparison', + SAMLStringValue::class, + SAMLStringValue::fromString('unknown'), + ); + return new static( array_merge( AuthnContextClassRef::getChildrenOfClass($xml), AuthnContextDeclRef::getChildrenOfClass($xml), ), - Comparison::tryFrom($Comparison), + Comparison::tryFrom($Comparison->getValue()), ); } diff --git a/src/XML/samlp/RequesterID.php b/src/XML/samlp/RequesterID.php index 741037d8ee..d31622328c 100644 --- a/src/XML/samlp/RequesterID.php +++ b/src/XML/samlp/RequesterID.php @@ -4,11 +4,11 @@ namespace SimpleSAML\SAML2\XML\samlp; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\XML\URIElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; @@ -20,16 +20,10 @@ final class RequesterID extends AbstractSamlpElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use URIElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = EntityIDValue::class; /** @@ -43,7 +37,9 @@ public static function fromArray(array $data): static Assert::allString($data, ArrayValidationException::class); $index = array_key_first($data); - return new static($data[$index]); + return new static( + EntityIDValue::fromString($data[$index]), + ); } @@ -54,6 +50,6 @@ public static function fromArray(array $data): static */ public function toArray(): array { - return [$this->getContent()]; + return [$this->getContent()->getValue()]; } } diff --git a/src/XML/samlp/Response.php b/src/XML/samlp/Response.php index 506617e0e5..89121fde2c 100644 --- a/src/XML/samlp/Response.php +++ b/src/XML/samlp/Response.php @@ -4,25 +4,20 @@ namespace SimpleSAML\SAML2\XML\samlp; -use DateTimeImmutable; use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{Assertion, EncryptedAssertion, Issuer}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_merge; use function array_pop; +use function strval; /** * Class for SAML 2 Response messages. @@ -37,26 +32,24 @@ class Response extends AbstractStatusResponse implements SchemaValidatableElemen /** * Constructor for SAML 2 response messages. * + * @param \SimpleSAML\SAML2\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status - * @param \DateTimeImmutable $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param string|null $id - * @param string $version - * @param string $inResponseTo - * @param string|null $destination - * @param string|null $consent + * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * @param (\SimpleSAML\SAML2\XML\saml\Assertion|\SimpleSAML\SAML2\XML\saml\EncryptedAssertion)[] $assertions */ final public function __construct( + IDValue $id, Status $status, - DateTimeImmutable $issueInstant, + SAMLDateTimeValue $issueInstant, ?Issuer $issuer = null, - ?string $id = null, - string $version = '2.0', - ?string $inResponseTo = null, - ?string $destination = null, - ?string $consent = null, + ?NCNameValue $inResponseTo = null, + ?SAMLAnyURIValue $destination = null, + ?SAMLAnyURIValue $consent = null, ?Extensions $extensions = null, protected array $assertions = [], ) { @@ -64,11 +57,10 @@ final public function __construct( Assert::allIsInstanceOfAny($assertions, [Assertion::class, EncryptedAssertion::class]); parent::__construct( + $id, $status, $issueInstant, $issuer, - $id, - $version, $inResponseTo, $destination, $consent, @@ -106,27 +98,13 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'Response', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Response::NS, InvalidDOMElementException::class); - $version = self::getAttribute($xml, 'Version'); - Assert::true(version_compare('2.0', $version, '<='), RequestVersionTooLowException::class); - Assert::true(version_compare('2.0', $version, '>='), RequestVersionTooHighException::class); + $version = self::getAttribute($xml, 'Version', SAMLStringValue::class); + Assert::true(version_compare('2.0', strval($version), '<='), RequestVersionTooLowException::class); + Assert::true(version_compare('2.0', strval($version), '>='), RequestVersionTooHighException::class); $signature = Signature::getChildrenOfClass($xml); Assert::maxCount($signature, 1, 'Only one ds:Signature element is allowed.', TooManyElementsException::class); - $id = self::getAttribute($xml, 'ID'); - Assert::validNCName($id); // Covers the empty string - - $inResponseTo = self::getOptionalAttribute($xml, 'InResponseTo', null); - $destination = self::getOptionalAttribute($xml, 'Destination', null); - $consent = self::getOptionalAttribute($xml, 'Consent', null); - - $issueInstant = self::getAttribute($xml, 'IssueInstant'); - // Strip sub-seconds - See paragraph 1.3.3 of SAML core specifications - $issueInstant = preg_replace('/([.][0-9]+Z)$/', 'Z', $issueInstant, 1); - - Assert::validDateTime($issueInstant, ProtocolViolationException::class); - $issueInstant = new DateTimeImmutable($issueInstant); - $issuer = Issuer::getChildrenOfClass($xml); Assert::countBetween($issuer, 0, 1); @@ -143,14 +121,13 @@ public static function fromXML(DOMElement $xml): static ); $response = new static( + self::getAttribute($xml, 'ID', IDValue::class), array_pop($status), - $issueInstant, + self::getAttribute($xml, 'IssueInstant', SAMLDateTimeValue::class), empty($issuer) ? null : array_pop($issuer), - $id, - $version, - $inResponseTo, - $destination, - $consent, + self::getOptionalAttribute($xml, 'InResponseTo', NCNameValue::class, null), + self::getOptionalAttribute($xml, 'Destination', SAMLAnyURIValue::class, null), + self::getOptionalAttribute($xml, 'Consent', SAMLAnyURIValue::class, null), empty($extensions) ? null : array_pop($extensions), array_merge(Assertion::getChildrenOfClass($xml), EncryptedAssertion::getChildrenOfClass($xml)), ); diff --git a/src/XML/samlp/Scoping.php b/src/XML/samlp/Scoping.php index 52e8621698..8af219da97 100644 --- a/src/XML/samlp/Scoping.php +++ b/src/XML/samlp/Scoping.php @@ -5,13 +5,14 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\NonNegativeIntegerValue; use function array_pop; +use function strval; /** * Class for handling SAML2 Scoping. @@ -26,18 +27,17 @@ final class Scoping extends AbstractSamlpElement implements SchemaValidatableEle /** * Initialize a Scoping element. * - * @param int|null $proxyCount + * @param \SimpleSAML\XML\Type\NonNegativeIntegerValue|null $proxyCount * @param \SimpleSAML\SAML2\XML\samlp\IDPList|null $IDPList * @param \SimpleSAML\SAML2\XML\samlp\RequesterID[] $requesterId */ public function __construct( - protected ?int $proxyCount = null, + protected ?NonNegativeIntegerValue $proxyCount = null, protected ?IDPList $IDPList = null, protected array $requesterId = [], ) { Assert::maxCount($requesterId, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($requesterId, RequesterID::class); - Assert::nullOrNatural($proxyCount); } @@ -60,9 +60,9 @@ public function getRequesterId(): array /** - * @return int|null + * @return \SimpleSAML\XML\Type\NonNegativeIntegerValue|null */ - public function getProxyCount(): ?int + public function getProxyCount(): ?NonNegativeIntegerValue { return $this->proxyCount; } @@ -75,9 +75,9 @@ public function getProxyCount(): ?int */ public function isEmptyElement(): bool { - return empty($this->proxyCount) - && empty($this->IDPList) - && empty($this->requesterId); + return empty($this->getProxyCount()) + && empty($this->getIDPList()) + && empty($this->getRequesterId()); } @@ -95,12 +95,11 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'Scoping', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Scoping::NS, InvalidDOMElementException::class); - $proxyCount = self::getOptionalIntegerAttribute($xml, 'ProxyCount', null); $idpList = IDPList::getChildrenOfClass($xml); $requesterId = RequesterID::getChildrenOfClass($xml); return new static( - $proxyCount, + self::getOptionalAttribute($xml, 'ProxyCount', NonNegativeIntegerValue::class, null), array_pop($idpList), $requesterId, ); diff --git a/src/XML/samlp/SessionIndex.php b/src/XML/samlp/SessionIndex.php index 6d7bee65b3..286f00d936 100644 --- a/src/XML/samlp/SessionIndex.php +++ b/src/XML/samlp/SessionIndex.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\samlp; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing a samlp:SessionIndex element. @@ -16,14 +16,9 @@ final class SessionIndex extends AbstractSamlpElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/samlp/Status.php b/src/XML/samlp/Status.php index 877a8d1eed..7027e5eac8 100644 --- a/src/XML/samlp/Status.php +++ b/src/XML/samlp/Status.php @@ -5,16 +5,14 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_pop; +use function strval; /** * SAML Status data type. @@ -39,7 +37,7 @@ public function __construct( protected array $statusDetails = [], ) { Assert::oneOf( - $statusCode->getValue(), + strval($statusCode->getValue()), [ C::STATUS_SUCCESS, C::STATUS_REQUESTER, diff --git a/src/XML/samlp/StatusCode.php b/src/XML/samlp/StatusCode.php index 5f929ddbec..0af581cfd8 100644 --- a/src/XML/samlp/StatusCode.php +++ b/src/XML/samlp/StatusCode.php @@ -5,12 +5,13 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; + +use function strval; /** * SAML StatusCode data type. @@ -25,14 +26,13 @@ final class StatusCode extends AbstractSamlpElement implements SchemaValidatable /** * Initialize a samlp:StatusCode * - * @param string $Value + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValueValue $Value * @param \SimpleSAML\SAML2\XML\samlp\StatusCode[] $subCodes */ public function __construct( - protected string $Value = C::STATUS_SUCCESS, + protected SAMLAnyURIValue $Value, protected array $subCodes = [], ) { - SAMLAssert::validURI($Value); Assert::maxCount($subCodes, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf($subCodes, StatusCode::class); } @@ -41,9 +41,9 @@ public function __construct( /** * Collect the Value * - * @return string + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue */ - public function getValue(): string + public function getValue(): SAMLAnyURIValue { return $this->Value; } @@ -76,12 +76,9 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'StatusCode', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, StatusCode::NS, InvalidDOMElementException::class); - $Value = self::getAttribute($xml, 'Value'); - $subCodes = StatusCode::getChildrenOfClass($xml); - return new static( - $Value, - $subCodes, + self::getAttribute($xml, 'Value', SAMLAnyURIValue::class), + StatusCode::getChildrenOfClass($xml), ); } @@ -95,7 +92,7 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Value', $this->getValue()); + $e->setAttribute('Value', strval($this->getValue())); foreach ($this->getSubCodes() as $subCode) { $subCode->toXML($e); diff --git a/src/XML/samlp/StatusDetail.php b/src/XML/samlp/StatusDetail.php index fac25b1228..7f1d00f10b 100644 --- a/src/XML/samlp/StatusDetail.php +++ b/src/XML/samlp/StatusDetail.php @@ -5,11 +5,9 @@ namespace SimpleSAML\SAML2\XML\samlp; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{ExtendableElementTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\XsNamespace as NS; /** diff --git a/src/XML/samlp/StatusMessage.php b/src/XML/samlp/StatusMessage.php index 00ee4b4f96..e7351505f8 100644 --- a/src/XML/samlp/StatusMessage.php +++ b/src/XML/samlp/StatusMessage.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\samlp; -use SimpleSAML\SAML2\XML\StringElementTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing a samlp:StatusMessage element. @@ -16,14 +16,8 @@ final class StatusMessage extends AbstractSamlpElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; - - /** - * @param string $content - */ - public function __construct(string $content) - { - $this->setContent($content); - } + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/shibmd/KeyAuthority.php b/src/XML/shibmd/KeyAuthority.php index 75f1479c52..2b2470bc71 100644 --- a/src/XML/shibmd/KeyAuthority.php +++ b/src/XML/shibmd/KeyAuthority.php @@ -5,12 +5,11 @@ namespace SimpleSAML\SAML2\XML\shibmd; use DOMElement; -use SimpleSAML\Assert\Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\UnsignedByteValue; use SimpleSAML\XML\XsNamespace as NS; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; @@ -36,16 +35,15 @@ final class KeyAuthority extends AbstractShibmdElement implements SchemaValidata * Create a KeyAuthority. * * @param \SimpleSAML\XMLSecurity\XML\ds\KeyInfo[] $keys - * @param int|null $VerifyDepth + * @param \SimpleSAML\XML\Type\UnsignedByteValue|null $VerifyDepth * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( protected array $keys, - protected ?int $VerifyDepth = null, + protected ?UnsignedByteValue $VerifyDepth = null, array $namespacedAttributes = [], ) { Assert::maxCount($keys, C::UNBOUNDED_LIMIT); - Assert::nullOrRange($VerifyDepth, 0, 255); $this->setAttributesNS($namespacedAttributes); } @@ -54,9 +52,9 @@ public function __construct( /** * Collect the value of the VerifyDepth-property * - * @return int|null + * @return \SimpleSAML\XML\Type\UnsigedByteValue|null */ - public function getVerifyDepth(): ?int + public function getVerifyDepth(): ?UnsignedByteValue { return $this->VerifyDepth; } @@ -87,8 +85,7 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'KeyAuthority', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, KeyAuthority::NS, InvalidDOMElementException::class); - $verifyDepth = self::getOptionalIntegerAttribute($xml, 'VerifyDepth', 1); - Assert::natural($verifyDepth); + $verifyDepth = self::getOptionalAttribute($xml, 'VerifyDepth', UnsignedByteValue::class, null); $keys = KeyInfo::getChildrenOfClass($xml); Assert::minCount($keys, 1); @@ -98,9 +95,9 @@ public static function fromXML(DOMElement $xml): static /** - * Convert this Scope to XML. + * Convert this KeyAuthority to XML. * - * @param \DOMElement|null $parent The element we should append this Scope to. + * @param \DOMElement|null $parent The element we should append this KeyAuthority to. * @return \DOMElement */ public function toXML(?DOMElement $parent = null): DOMElement diff --git a/src/XML/shibmd/Scope.php b/src/XML/shibmd/Scope.php index 1635d22daf..2d7a287308 100644 --- a/src/XML/shibmd/Scope.php +++ b/src/XML/shibmd/Scope.php @@ -5,11 +5,12 @@ namespace SimpleSAML\SAML2\XML\shibmd; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\StringElementTrait; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\SchemaValidatableElementInterface; -use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class which represents the Scope element found in Shibboleth metadata. @@ -20,18 +21,21 @@ final class Scope extends AbstractShibmdElement implements SchemaValidatableElementInterface { use SchemaValidatableElementTrait; - use StringElementTrait; + use TypedTextContentTrait; + + /** @var string */ + public const TEXTCONTENT_TYPE = SAMLStringValue::class; /** * Create a Scope. * - * @param string $scope - * @param bool|null $regexp + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $scope + * @param \SimpleSAML\XML\Type\BooleanValue|null $regexp */ public function __construct( - string $scope, - protected ?bool $regexp = false, + SAMLStringValue $scope, + protected ?BooleanValue $regexp = null, ) { $this->setContent($scope); } @@ -40,9 +44,9 @@ public function __construct( /** * Collect the value of the regexp-property * - * @return bool|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ - public function isRegexpScope(): ?bool + public function isRegexpScope(): ?BooleanValue { return $this->regexp; } @@ -62,10 +66,10 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'Scope', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, Scope::NS, InvalidDOMElementException::class); - $scope = $xml->textContent; - $regexp = self::getOptionalBooleanAttribute($xml, 'regexp', null); - - return new static($scope, $regexp); + return new static( + SAMLStringValue::fromString($xml->textContent), + self::getOptionalAttribute($xml, 'regexp', BooleanValue::class, null), + ); } @@ -78,10 +82,10 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->textContent = $this->getContent(); + $e->textContent = strval($this->getContent()); if ($this->isRegexpScope() !== null) { - $e->setAttribute('regexp', $this->isRegexpScope() ? 'true' : 'false'); + $e->setAttribute('regexp', strval($this->isRegexpScope())); } return $e; diff --git a/tests/InterOperability/EntitiesDescriptorTest.php b/tests/InterOperability/EntitiesDescriptorTest.php index 4e971f518e..1f59643307 100644 --- a/tests/InterOperability/EntitiesDescriptorTest.php +++ b/tests/InterOperability/EntitiesDescriptorTest.php @@ -90,6 +90,9 @@ public static function provideMetadata(): array 'GRNET' => [ DOMDocumentFactory::fromFile('/tmp/metadata/grnet.xml')->documentElement, ], + 'EduID' => [ + DOMDocumentFactory::fromFile('eduid.xml')->documentElement, + ], ]; } } diff --git a/tests/SAML2/Assert/CIDRTest.php b/tests/SAML2/Assert/CIDRTest.php new file mode 100644 index 0000000000..f6ff14c508 --- /dev/null +++ b/tests/SAML2/Assert/CIDRTest.php @@ -0,0 +1,58 @@ +assertTrue($shouldPass); + } catch (ProtocolViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideCIDR(): array + { + return [ + 'ipv4' => [true, '192.168.0.1/32'], + 'ipv6' => [true, '2001:0000:130F:0000:0000:09C0:876A:130B/128'], + 'ipv4 too long' => [false, '192.168.0.1.5/32'], + 'ipv6 too long' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B:130F:805B/128'], + 'ipv6 mixed notation' => [false, '805B:2D9D:DC28::FC57:212.200.31.255'], + 'ipv6 shortened notation' => [false, '::ffff:192.1.56.10/96'], + 'ipv6 compressed notation' => [false, '::212.200.31.255'], + 'ipv4 without length' => [false, '192.168.0.1'], + 'ipv6 wihtout length' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B'], + 'ipv4 out of bounds length' => [false, '192.168.0.1/33'], + 'ipv6 out of bounds length' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B/129'], + 'ipv4 out of bounds address' => [false, '256.168.0.1/32'], + 'ipv6 out of bounds address' => [false, '2001:0000:130G:0000:0000:09C0:876A:130B/128'], + ]; + } +} diff --git a/tests/SAML2/Assert/DomainTest.php b/tests/SAML2/Assert/DomainTest.php new file mode 100644 index 0000000000..4fbabcdfc2 --- /dev/null +++ b/tests/SAML2/Assert/DomainTest.php @@ -0,0 +1,51 @@ +assertTrue($shouldPass); + } catch (ProtocolViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideDomain(): array + { + return [ + 'domain' => [true, 'simplesamlphp.org'], + 'subdomain' => [true, 'sub.simplesamlphp.org'], + 'ipv4' => [false, '192.168.0.1'], + 'ipv6' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B'], + 'with scheme' => [false, 'https://simplesamlphp.org'], + 'tld' => [false, '.org'], + ]; + } +} diff --git a/tests/SAML2/Assert/EntityIDTest.php b/tests/SAML2/Assert/EntityIDTest.php index f1399f2514..1ceb4c94cf 100644 --- a/tests/SAML2/Assert/EntityIDTest.php +++ b/tests/SAML2/Assert/EntityIDTest.php @@ -4,10 +4,9 @@ namespace SimpleSAML\Test\SAML2\Assert; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Assert\Assert as SAML2Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\Exception\SchemaViolationException; @@ -19,7 +18,8 @@ * * @package simplesamlphp/saml2 */ -#[CoversClass(SAML2Assert::class)] +#[Group('assert')] +#[CoversClass(Assert::class)] final class EntityIDTest extends TestCase { /** @@ -30,7 +30,7 @@ final class EntityIDTest extends TestCase public function testValidEntityID(bool $shouldPass, string $entityID): void { try { - SAML2Assert::validEntityID($entityID); + Assert::validEntityID($entityID); $this->assertTrue($shouldPass); } catch (ProtocolViolationException | SchemaViolationException $e) { $this->assertFalse($shouldPass); diff --git a/tests/SAML2/Assert/URITest.php b/tests/SAML2/Assert/SAMLAnyURITest.php similarity index 78% rename from tests/SAML2/Assert/URITest.php rename to tests/SAML2/Assert/SAMLAnyURITest.php index a0be98a6ab..f544762af0 100644 --- a/tests/SAML2/Assert/URITest.php +++ b/tests/SAML2/Assert/SAMLAnyURITest.php @@ -4,30 +4,30 @@ namespace SimpleSAML\Test\SAML2\Assert; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Assert\Assert as SAML2Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\Exception\SchemaViolationException; /** - * Class \SimpleSAML\SAML2\Assert\URITest + * Class \SimpleSAML\SAML2\Assert\SAMLAnyURITest * * @package simplesamlphp/saml2 */ -#[CoversClass(SAML2Assert::class)] -final class URITest extends TestCase +#[Group('assert')] +#[CoversClass(Assert::class)] +final class SAMLAnyURITest extends TestCase { /** * @param boolean $shouldPass * @param string $uri */ #[DataProvider('provideURI')] - public function testValidURI(bool $shouldPass, string $uri): void + public function testValidSAMLAnyURI(bool $shouldPass, string $uri): void { try { - SAML2Assert::validURI($uri); + Assert::validSAMLAnyURI($uri); $this->assertTrue($shouldPass); } catch (ProtocolViolationException | SchemaViolationException $e) { $this->assertFalse($shouldPass); diff --git a/tests/SAML2/Assert/DateTimeTest.php b/tests/SAML2/Assert/SAMLDateTimeTest.php similarity index 74% rename from tests/SAML2/Assert/DateTimeTest.php rename to tests/SAML2/Assert/SAMLDateTimeTest.php index d7392a4685..44b976830b 100644 --- a/tests/SAML2/Assert/DateTimeTest.php +++ b/tests/SAML2/Assert/SAMLDateTimeTest.php @@ -4,31 +4,31 @@ namespace SimpleSAML\SAML2\Test\Assert; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\Assert\Assert as SAML2Assert; +use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\Exception\SchemaViolationException; /** - * Class \SimpleSAML\SAML2\Assert\DateTimeTest + * Class \SimpleSAML\SAML2\Assert\SAMLDateTimeTest * * @package simplesamlphp/saml2 */ -#[CoversClass(SAML2Assert::class)] -final class DateTimeTest extends TestCase +#[Group('assert')] +#[CoversClass(Assert::class)] +final class SAMLDateTimeTest extends TestCase { /** * @param boolean $shouldPass * @param string $timestamp */ #[DataProvider('provideDateTime')] - public function testValidDateTime(bool $shouldPass, string $timestamp): void + public function testValidSAMLDateTime(bool $shouldPass, string $timestamp): void { try { - SAML2Assert::validDateTime($timestamp); + Assert::validSAMLDateTime($timestamp); $this->assertTrue($shouldPass); } catch (AssertionFailedException | ProtocolViolationException | SchemaViolationException $e) { $this->assertFalse($shouldPass); diff --git a/tests/SAML2/Assert/SAMLStringTest.php b/tests/SAML2/Assert/SAMLStringTest.php new file mode 100644 index 0000000000..8e5af044c2 --- /dev/null +++ b/tests/SAML2/Assert/SAMLStringTest.php @@ -0,0 +1,50 @@ +assertTrue($shouldPass); + } catch (ProtocolViolationException | SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideString(): array + { + return [ + 'single letter' => [true, 't'], + 'single word' => [true, 'this'], + 'spaces' => [true, 'this is silly'], + 'empty' => [false, ''], + ]; + } +} diff --git a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php index a5b36df691..5ffba6485c 100644 --- a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php +++ b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php @@ -4,36 +4,31 @@ namespace SimpleSAML\Test\SAML2\Assertion\Transformer; -use DateTimeImmutable; use DOMDocument; -use PHPUnit\Framework\Attributes\PreserveGlobalState; -use PHPUnit\Framework\Attributes\RunInSeparateProcess; +use PHPUnit\Framework\Attributes\{PreserveGlobalState, RunInSeparateProcess}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; -use SimpleSAML\SAML2\Assertion\Processor; -use SimpleSAML\SAML2\Assertion\ProcessorBuilder; +use Psr\Log\{LoggerInterface, NullLogger}; +use SimpleSAML\SAML2\Assertion\{Processor, ProcessorBuilder}; use SimpleSAML\SAML2\Compat\ContainerSingleton; -use SimpleSAML\SAML2\Configuration\Destination; -use SimpleSAML\SAML2\Configuration\IdentityProvider; -use SimpleSAML\SAML2\Configuration\PrivateKey; -use SimpleSAML\SAML2\Configuration\ServiceProvider; +use SimpleSAML\SAML2\Configuration\{Destination, IdentityProvider, PrivateKey, ServiceProvider}; use SimpleSAML\SAML2\Signature\Validator; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utilities\ArrayCollection; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnStatement; -use SimpleSAML\SAML2\XML\saml\EncryptedID; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\saml\{ + Assertion, + AuthnContext, + AuthnContextClassRef, + AuthnStatement, + EncryptedID, + Issuer, + NameID, + Subject, +}; +use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -91,7 +86,13 @@ public static function setUpBeforeClass(): void self::$logger = new NullLogger(); self::$validator = new Validator(self::$logger); self::$destination = new Destination(C::ENTITY_SP); - self::$response = new Response(new Status(new StatusCode()), self::$clock->now()); + self::$response = new Response( + id: IDValue::fromString('SomeIDValue'), + status: new Status( + new StatusCode(SAMLAnyURIValue::fromString(C::STATUS_SUCCESS)), + ), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); self::$identityProviderConfiguration = new IdentityProvider(['assertionEncryptionEnabled' => true]); $base = getcwd() . DIRECTORY_SEPARATOR . self::FRAMEWORK; @@ -124,22 +125,29 @@ public static function setUpBeforeClass(): void C::KEY_TRANSPORT_RSA_1_5, PEMCertificatesMock::getPublicKey(PEMCertificatesMock::PUBLIC_KEY), ); - $nameId = new NameID('value', 'urn:x-simplesamlphp:namequalifier'); + $nameId = new NameID( + SAMLStringValue::fromString('value'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + ); $encryptedId = new EncryptedID($nameId->encrypt($encryptor)); $assertion = new Assertion( - issuer: new Issuer(C::ENTITY_IDP), - id: '_45e42090d8cbbfa52d5a394b01049fc2221e274182', - issueInstant: new DateTimeImmutable('2023-05-27T16:20:52Z'), + issuer: new Issuer( + SAMLStringValue::fromString(C::ENTITY_IDP), + ), + id: IDValue::fromString('_45e42090d8cbbfa52d5a394b01049fc2221e274182'), + issueInstant: SAMLDateTimeValue::fromString('2023-05-27T16:20:52Z'), subject: new Subject($encryptedId), statements: [ new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA1), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA1), + ), null, null, ), - new DateTimeImmutable('2023-05-27T16:20:52Z'), + SAMLDateTimeValue::fromString('2023-05-27T16:20:52Z'), ), ], ); @@ -163,8 +171,8 @@ public function testBasicNameIdDecryption(): void $identifier = $processed->getSubject()->getIdentifier(); $this->assertInstanceOf(NameID::class, $identifier); - $this->assertEquals('value', $identifier->getContent()); - $this->assertEquals('urn:x-simplesamlphp:namequalifier', $identifier->getNameQualifier()); + $this->assertEquals('value', $identifier->getContent()->getValue()); + $this->assertEquals('urn:x-simplesamlphp:namequalifier', $identifier->getNameQualifier()->getValue()); } @@ -187,7 +195,7 @@ public function testDecryptionProcessAssertions(): void $identifier = $processed->getOnlyElement()->getSubject()->getIdentifier(); $this->assertInstanceOf(NameID::class, $identifier); - $this->assertEquals('value', $identifier->getContent()); - $this->assertEquals('urn:x-simplesamlphp:namequalifier', $identifier->getNameQualifier()); + $this->assertEquals('value', $identifier->getContent()->getValue()); + $this->assertEquals('urn:x-simplesamlphp:namequalifier', $identifier->getNameQualifier()->getValue()); } } diff --git a/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php b/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php index cbfb7d0175..6b5c407141 100644 --- a/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php +++ b/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php @@ -11,23 +11,19 @@ use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; +use Psr\Log\{LoggerInterface, NullLogger}; use SimpleSAML\SAML2\Assertion\Exception\InvalidAssertionException; -use SimpleSAML\SAML2\Assertion\Processor; -use SimpleSAML\SAML2\Assertion\ProcessorBuilder; +use SimpleSAML\SAML2\Assertion\{Processor, ProcessorBuilder}; use SimpleSAML\SAML2\Assertion\Validation\AssertionValidator; -use SimpleSAML\SAML2\Configuration\Destination; -use SimpleSAML\SAML2\Configuration\IdentityProvider; -use SimpleSAML\SAML2\Configuration\ServiceProvider; +use SimpleSAML\SAML2\Configuration\{Destination, IdentityProvider, ServiceProvider}; use SimpleSAML\SAML2\Signature\Validator; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\IDValue; /** * Tests for the Assertion validators @@ -78,7 +74,15 @@ public static function setUpBeforeClass(): void self::$logger = new NullLogger(); self::$validator = new Validator(self::$logger); self::$destination = new Destination($destination); - self::$response = new Response(new Status(new StatusCode()), self::$clock->now()); + self::$response = new Response( + id: IDValue::fromString('abc123'), + status: new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); self::$identityProviderConfiguration = new IdentityProvider(['entityId' => $idpentity]); self::$serviceProviderConfiguration = new ServiceProvider(['entityId' => $spentity]); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php index 4b207c6272..25c8c7543f 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php @@ -5,20 +5,23 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\NotBefore; use SimpleSAML\SAML2\Assertion\Validation\Result; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnStatement; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\{ + Assertion, + AuthnContext, + AuthnContextClassRef, + AuthnStatement, + Conditions, + Issuer, +}; use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\XML\Type\IDValue; /** * @package simplesamlphp/saml2 @@ -43,16 +46,20 @@ public static function setUpBeforeClass(): void self::$clock = Utils::getContainer()->getClock(); // Create an Issuer - self::$issuer = new Issuer('urn:x-simplesamlphp:issuer'); + self::$issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); // Create the statements self::$authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA1), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA1), + ), null, null, ), - self::$clock->now(), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); } @@ -63,12 +70,17 @@ public static function setUpBeforeClass(): void public function testTimestampInTheFutureBeyondGraceperiodIsNotValid(): void { // Create Conditions - $conditions = new Conditions(self::$clock->now()->add(new DateInterval('PT61S'))); + $conditions = new Conditions( + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->add(new DateInterval('PT61S')), + ), + ); // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: $conditions, statements: [self::$authnStatement], ); @@ -89,12 +101,17 @@ public function testTimestampInTheFutureBeyondGraceperiodIsNotValid(): void public function testTimeWithinGraceperiodIsValid(): void { // Create Conditions - $conditions = new Conditions(self::$clock->now()->add(new DateInterval('PT60S'))); + $conditions = new Conditions( + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->add(new DateInterval('PT60S')), + ), + ); // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: $conditions, statements: [self::$authnStatement], ); @@ -114,12 +131,15 @@ public function testTimeWithinGraceperiodIsValid(): void public function testCurrentTimeIsValid(): void { // Create Conditions - $conditions = new Conditions(self::$clock->now()); + $conditions = new Conditions( + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: $conditions, statements: [self::$authnStatement], ); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php index 92cb6e6ca6..af81ef79da 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php @@ -5,20 +5,23 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\NotOnOrAfter; use SimpleSAML\SAML2\Assertion\Validation\Result; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnStatement; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\{ + Assertion, + AuthnContext, + AuthnContextClassRef, + AuthnStatement, + Conditions, + Issuer, +}; use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\XML\Type\IDValue; /** * @package simplesamlphp/saml2 @@ -43,16 +46,20 @@ public static function setUpBeforeClass(): void self::$clock = Utils::getContainer()->getClock(); // Create an Issuer - self::$issuer = new Issuer('urn:x-simplesamlphp:issuer'); + self::$issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); // Create the statements self::$authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_URN), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_URN), + ), null, null, ), - self::$clock->now(), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); } @@ -63,12 +70,18 @@ public static function setUpBeforeClass(): void public function testTimestampInThePastBeforeGraceperiodIsNotValid(): void { // Create Conditions - $conditions = new Conditions(null, self::$clock->now()->sub(new DateInterval('PT60S'))); + $conditions = new Conditions( + null, + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->sub(new DateInterval('PT60S')), + ), + ); // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: $conditions, statements: [self::$authnStatement], ); @@ -89,12 +102,18 @@ public function testTimestampInThePastBeforeGraceperiodIsNotValid(): void public function testTimeWithinGraceperiodIsValid(): void { // Create Conditions - $conditions = new Conditions(null, self::$clock->now()->sub(new DateInterval('PT59S'))); + $conditions = new Conditions( + null, + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->sub(new DateInterval('PT59S')), + ), + ); // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: $conditions, statements: [self::$authnStatement], ); @@ -114,12 +133,16 @@ public function testTimeWithinGraceperiodIsValid(): void public function testCurrentTimeIsValid(): void { // Create Conditions - $conditions = new Conditions(null, self::$clock->now()); + $conditions = new Conditions( + null, + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: $conditions, statements: [self::$authnStatement], ); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php index ce0aab742c..a3a01071a8 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php @@ -5,19 +5,16 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SessionNotOnOrAfter; use SimpleSAML\SAML2\Assertion\Validation\Result; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnStatement; -use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\{Assertion, AuthnContext, AuthnContextClassRef, AuthnStatement, Issuer}; use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\XML\Type\IDValue; /** * @package simplesamlphp/saml2 @@ -39,7 +36,9 @@ public static function setUpBeforeClass(): void self::$clock = Utils::getContainer()->getClock(); // Create an Issuer - self::$issuer = new Issuer('urn:x-simplesamlphp:issuer'); + self::$issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); } @@ -51,16 +50,25 @@ public function timestampInThePastBeforeGraceperiodIsNotValid(): void // Create the statements $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA1), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA1), + ), null, null, ), - self::$clock->now(), - self::$clock->now()->sub(new DateInterval('PT60S')), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->sub(new DateInterval('PT60S')), + ), ); // Create an assertion - $assertion = new Assertion(self::$issuer, self::$clock->now(), null, null, null, [$authnStatement]); + $assertion = new Assertion( + issuer: self::$issuer, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + id: IDValue::fromString('abc123'), + statements: [$authnStatement], + ); $validator = new SessionNotOnOrAfter(); $result = new Result(); @@ -80,16 +88,25 @@ public function timeWithinGraceperiodIsValid(): void // Create the statements $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA1), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA1), + ), null, null, ), - self::$clock->now(), - self::$clock->now()->sub(new DateInterval('PT59S')), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->sub(new DateInterval('PT59S')), + ), ); // Create an assertion - $assertion = new Assertion(self::$issuer, self::$clock->now(), null, null, null, [$authnStatement]); + $assertion = new Assertion( + id: IDValue::fromString('abc123'), + issuer: self::$issuer, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + statements: [$authnStatement], + ); $validator = new SessionNotOnOrAfter(); $result = new Result(); @@ -108,16 +125,23 @@ public function testCurrentTimeIsValid(): void // Create the statements $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA1), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA1), + ), null, null, ), - self::$clock->now(), - self::$clock->now(), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); // Create an assertion - $assertion = new Assertion(self::$issuer, self::$clock->now(), null, null, null, [$authnStatement]); + $assertion = new Assertion( + id: IDValue::fromString('abc123'), + issuer: self::$issuer, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + statements: [$authnStatement], + ); $validator = new SessionNotOnOrAfter(); $result = new Result(); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php index 721e067b6b..7cc606bb0c 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php @@ -7,22 +7,25 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SpIsValidAudience; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Configuration\ServiceProvider; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\AudienceRestriction; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnStatement; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\{ + Assertion, + Audience, + AudienceRestriction, + AuthnContext, + AuthnContextClassRef, + AuthnStatement, + Conditions, + Issuer, +}; use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\XML\Type\IDValue; /** * Because we're mocking a static call, we have to run it in separate processes so as to no contaminate the other @@ -56,24 +59,33 @@ public static function setUpBeforeClass(): void self::$clock = Utils::getContainer()->getClock(); // Create an Issuer - self::$issuer = new Issuer(C::ENTITY_IDP); + self::$issuer = new Issuer( + SAMLStringValue::fromString(C::ENTITY_IDP), + ); // Create the conditions self::$conditions = new Conditions( null, null, [], - [new AudienceRestriction([new Audience(C::ENTITY_SP), new Audience(C::ENTITY_URN)])], + [ + new AudienceRestriction([ + new Audience(SAMLAnyURIValue::fromString(C::ENTITY_SP)), + new Audience(SAMLAnyURIValue::fromString(C::ENTITY_URN)), + ]), + ], ); // Create the statements self::$authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA1), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA1), + ), null, null, ), - self::$clock->now(), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); } @@ -93,8 +105,9 @@ public function testWhenNoValidAudiencesAreGivenTheAssertionIsValid(): void { // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), statements: [self::$authnStatement], ); @@ -117,8 +130,9 @@ public function testIfTheSpEntityIdIsNotInTheValidAudiencesTheAssertionIsInvalid { // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: self::$conditions, statements: [self::$authnStatement], ); @@ -143,8 +157,9 @@ public function testTheAssertionIsValidWhenTheCurrentSpEntityIdIsAValidAudience( { // Create an assertion $assertion = new Assertion( + id: IDValue::fromString('abc123'), issuer: self::$issuer, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), conditions: self::$conditions, statements: [self::$authnStatement], ); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php index 56bf0d44d9..5003d50d23 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php @@ -4,12 +4,12 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationMethod; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; /** @@ -23,7 +23,9 @@ final class SubjectConfirmationMethodTest extends TestCase #[Group('assertion-validation')] public function testASubjectConfirmationWithBearerMethodIsValid(): void { - $subjectConfirmation = new SubjectConfirmation(C::CM_BEARER); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_BEARER), + ); $validator = new SubjectConfirmationMethod(); $result = new Result(); @@ -39,7 +41,9 @@ public function testASubjectConfirmationWithBearerMethodIsValid(): void #[Group('assertion-validation')] public function testASubjectConfirmationWithHolderOfKeyMethodIsNotValid(): void { - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + ); $validator = new SubjectConfirmationMethod(); $result = new Result(); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php index bb5dc11a60..95d5c9cfc6 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php @@ -5,16 +5,15 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationNotBefore; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; /** * @package simplesamlphp/saml2 @@ -39,8 +38,16 @@ public static function setUpBeforeClass(): void #[Group('assertion-validation')] public function testTimestampInTheFutureBeyondGraceperiodIsNotValid(): void { - $subjectConfirmationData = new SubjectConfirmationData(self::$clock->now()->add(new DateInterval('PT61S'))); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmationData = new SubjectConfirmationData( + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->add(new DateInterval('PT61S')), + ), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationNotBefore(); $result = new Result(); @@ -59,9 +66,15 @@ public function testTimeWithinGraceperiodIsValid(): void { $subjectConfirmationData = new SubjectConfirmationData( null, - self::$clock->now()->add(new DateInterval('PT60S')), + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->add(new DateInterval('PT60S')), + ), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, ); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); $validator = new SubjectConfirmationNotBefore(); $result = new Result(); @@ -77,8 +90,14 @@ public function testTimeWithinGraceperiodIsValid(): void #[Group('assertion-validation')] public function testCurrentTimeIsValid(): void { - $subjectConfirmationData = new SubjectConfirmationData(self::$clock->now()); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmationData = new SubjectConfirmationData( + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationNotBefore(); $result = new Result(); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php index 43631ba8e2..2a7cf420b6 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php @@ -5,17 +5,18 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationNotBefore; -use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationNotOnOrAfter; +use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\{ + SubjectConfirmationNotBefore, + SubjectConfirmationNotOnOrAfter, +}; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; /** * @package simplesamlphp/saml2 @@ -42,9 +43,15 @@ public function testTimestampInThePastBeforeGraceperiodIsNotValid(): void { $subjectConfirmationData = new SubjectConfirmationData( null, - self::$clock->now()->sub(new DateInterval('PT60S')), + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->sub(new DateInterval('PT60S')), + ), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, ); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); $validator = new SubjectConfirmationNotOnOrAfter(); $result = new Result(); @@ -63,9 +70,15 @@ public function testTimeWithinGraceperiodIsValid(): void { $subjectConfirmationData = new SubjectConfirmationData( null, - self::$clock->now()->sub(new DateInterval('PT59S')), + SAMLDateTimeValue::fromDateTime( + self::$clock->now()->sub(new DateInterval('PT59S')), + ), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, ); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); $validator = new SubjectConfirmationNotOnOrAfter(); $result = new Result(); @@ -81,8 +94,15 @@ public function testTimeWithinGraceperiodIsValid(): void #[Group('assertion-validation')] public function testCurrentTimeIsValid(): void { - $subjectConfirmationData = new SubjectConfirmationData(null, self::$clock->now()); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmationData = new SubjectConfirmationData( + null, + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationNotBefore(); $result = new Result(); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php index e727827f82..1ca56814aa 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php @@ -4,15 +4,14 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationRecipientMatches; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Configuration\Destination; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; +use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; /** * @package simplesamlphp/saml2 @@ -25,11 +24,19 @@ final class SubjectConfirmationRecipientMatchesTest extends TestCase #[Group('assertion-validation')] public function testWhenTheSubjectConfirmationRecipientDiffersFromTheDestinationTheScIsInvalid(): void { - $subjectConfirmationData = new SubjectConfirmationData(null, null, 'someDestination'); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmationData = new SubjectConfirmationData( + null, + null, + EntityIDValue::fromString('urn:x-simplesamlphp:someDestination'), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationRecipientMatches( - new Destination('anotherDestination'), + new Destination('urn:x-simplesamlphp:anotherDestination'), ); $result = new Result(); @@ -45,11 +52,19 @@ public function testWhenTheSubjectConfirmationRecipientDiffersFromTheDestination #[Group('assertion-validation')] public function testWhenTheSubjectConfirmationRecipientEqualsTheDestinationTheScIsInvalid(): void { - $subjectConfirmationData = new SubjectConfirmationData(null, null, 'theSameDestination'); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmationData = new SubjectConfirmationData( + null, + null, + EntityIDValue::fromString('urn:x-simplesamlphp:theSameDestination'), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationRecipientMatches( - new Destination('theSameDestination'), + new Destination('urn:x-simplesamlphp:theSameDestination'), ); $result = new Result(); diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php index 4ecdda6ad3..74227605b9 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php @@ -7,14 +7,14 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationResponseToMatches; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; +use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\XML\Type\NCNameValue; /** * @package simplesamlphp/saml2 @@ -40,8 +40,14 @@ public function setUp(): void public function testWhenTheResponseResponsetoIsNullTheSubjectConfirmationIsValid(): void { $this->response->shouldReceive('getInResponseTo')->andReturnNull(); - $subjectConfirmationData = new SubjectConfirmationData(null, null, null, 'someValue'); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmationData = new SubjectConfirmationData( + inResponseTo: NCNameValue::fromString('someIDValue'), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationResponseToMatches($this->response); $result = new Result(); @@ -57,9 +63,13 @@ public function testWhenTheResponseResponsetoIsNullTheSubjectConfirmationIsValid #[Group('assertion-validation')] public function testWhenTheSubjectconfirmationResponsetoIsNullTheSubjectconfirmationIsValid(): void { - $this->response->shouldReceive('getInResponseTo')->andReturn('someValue'); + $this->response->shouldReceive('getInResponseTo')->andReturn(NCNameValue::fromString('someIDValue')); $subjectConfirmationData = new SubjectConfirmationData(); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationResponseToMatches($this->response); $result = new Result(); @@ -77,7 +87,11 @@ public function testWhenTheSubjectconfirmationAndResponseResponsetoAreNullTheSub { $this->response->shouldReceive('getInResponseTo')->andReturnNull(); $subjectConfirmationData = new SubjectConfirmationData(); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationResponseToMatches($this->response); $result = new Result(); @@ -91,11 +105,17 @@ public function testWhenTheSubjectconfirmationAndResponseResponsetoAreNullTheSub /** */ #[Group('assertion-validation')] - public function testWhenTheSubjectconfirmationAndResponseResponsetoAreEqualTheSubjectconfirmationIsValid(): void + public function testWhenTheSubjectConfirmationAndResponseResponsetoAreEqualTheSubjectConfirmationIsValid(): void { - $this->response->shouldReceive('getInResponseTo')->andReturn('theSameValue'); - $subjectConfirmationData = new SubjectConfirmationData(null, null, null, 'theSameValue'); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $this->response->shouldReceive('getInResponseTo')->andReturn(NCNameValue::fromString('someIDValue')); + $subjectConfirmationData = new SubjectConfirmationData( + inResponseTo: NCNameValue::fromString('someIDValue'), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationResponseToMatches($this->response); $result = new Result(); @@ -111,9 +131,15 @@ public function testWhenTheSubjectconfirmationAndResponseResponsetoAreEqualTheSu #[Group('assertion-validation')] public function testWhenTheSubjectconfirmationAndResponseResponsetoDifferTheSubjectconfirmationIsInvalid(): void { - $this->response->shouldReceive('getInResponseTo')->andReturn('someValue'); - $subjectConfirmationData = new SubjectConfirmationData(null, null, null, 'anotherValue'); - $subjectConfirmation = new SubjectConfirmation(C::CM_HOK, null, $subjectConfirmationData); + $this->response->shouldReceive('getInResponseTo')->andReturn(NCNameValue::fromString('someIDValue')); + $subjectConfirmationData = new SubjectConfirmationData( + inResponseTo: NCNameValue::fromString('someOtherIDValue'), + ); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_HOK), + null, + $subjectConfirmationData, + ); $validator = new SubjectConfirmationResponseToMatches($this->response); $result = new Result(); diff --git a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php index b01449801e..46868fc154 100644 --- a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php +++ b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php @@ -9,23 +9,19 @@ use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use Psr\Log\LoggerInterface; -use Psr\Log\NullLogger; +use Psr\Log\{LoggerInterface, NullLogger}; use SimpleSAML\SAML2\Assertion\Exception\InvalidSubjectConfirmationException; -use SimpleSAML\SAML2\Assertion\Processor; -use SimpleSAML\SAML2\Assertion\ProcessorBuilder; +use SimpleSAML\SAML2\Assertion\{Processor, ProcessorBuilder}; use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationValidator; -use SimpleSAML\SAML2\Configuration\Destination; -use SimpleSAML\SAML2\Configuration\IdentityProvider; -use SimpleSAML\SAML2\Configuration\ServiceProvider; +use SimpleSAML\SAML2\Configuration\{Destination, IdentityProvider, ServiceProvider}; use SimpleSAML\SAML2\Signature\Validator; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\IDValue; /** * Tests for the SubjectConfirmation validators @@ -71,7 +67,15 @@ public static function setUpBeforeClass(): void self::$logger = new NullLogger(); self::$validator = new Validator(self::$logger); self::$destination = new Destination(C::ENTITY_SP); - self::$response = new Response(new Status(new StatusCode()), self::$clock->now()); + self::$response = new Response( + id: IDValue::fromString('abc123'), + status: new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); self::$identityProviderConfiguration = new IdentityProvider(['entityId' => C::ENTITY_IDP]); self::$serviceProviderConfiguration = new ServiceProvider(['entityId' => C::ENTITY_SP]); diff --git a/tests/SAML2/Binding/HTTPArtifactTest.php b/tests/SAML2/Binding/HTTPArtifactTest.php index d62b3cab64..05b0c553b2 100644 --- a/tests/SAML2/Binding/HTTPArtifactTest.php +++ b/tests/SAML2/Binding/HTTPArtifactTest.php @@ -6,13 +6,14 @@ use Exception; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Binding\HTTPArtifact; /** * @package simplesamlphp\saml2 */ +#[Group('bindings')] #[CoversClass(HTTPArtifact::class)] final class HTTPArtifactTest extends TestCase { diff --git a/tests/SAML2/Binding/HTTPPostTest.php b/tests/SAML2/Binding/HTTPPostTest.php index ddc86da9ef..ffb3b679f2 100644 --- a/tests/SAML2/Binding/HTTPPostTest.php +++ b/tests/SAML2/Binding/HTTPPostTest.php @@ -6,24 +6,23 @@ use Exception; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\{CoversClass, DoesNotPerformAssertions, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Binding\HTTPPost; +use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AuthnRequest; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\{AuthnRequest, Response, Status, StatusCode}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; -use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; /** * @package simplesamlphp\saml2 */ +#[Group('bindings')] #[CoversClass(HTTPPost::class)] final class HTTPPostTest extends TestCase { @@ -106,7 +105,8 @@ public function testNoRequestParsing(): void public function testSendMissingDestination(): void { $request = new AuthnRequest( - issueInstant: self::$clock->now(), + id: IDValue::fromString('abc123'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); $hp = new HTTPPost(); $this->expectException(Exception::class); @@ -122,7 +122,8 @@ public function testSendMissingDestination(): void public function testSendAuthnRequestWithDestinationInBinding(): void { $request = new AuthnRequest( - issueInstant: self::$clock->now(), + id: IDValue::fromString('abc123'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); $hp = new HTTPPost(); $hp->setDestination('https://example.org'); @@ -137,8 +138,9 @@ public function testSendAuthnRequestWithDestinationInBinding(): void public function testSendAuthnRequestWithDestination(): void { $request = new AuthnRequest( - issueInstant: self::$clock->now(), - destination: 'https://example.org', + id: IDValue::fromString('abc123'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + destination: SAMLAnyURIValue::fromString('https://example.org'), ); $hp = new HTTPPost(); $hp->send($request); @@ -152,14 +154,21 @@ public function testSendAuthnRequestWithDestination(): void #[DoesNotPerformAssertions] public function testSendAuthnResponse(): void { - $status = new Status(new StatusCode()); - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $status = new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); $response = new Response( - issueInstant: self::$clock->now(), + id: IDValue::fromString('abc123'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), status: $status, issuer: $issuer, - destination: 'http://example.org/login?success=yes', + destination: SAMLAnyURIValue::fromString('http://example.org/login?success=yes'), ); $signer = (new SignatureAlgorithmFactory())->getAlgorithm( C::SIG_RSA_SHA256, diff --git a/tests/SAML2/Binding/HTTPRedirectTest.php b/tests/SAML2/Binding/HTTPRedirectTest.php index 3a0320227b..9dad0ce0e1 100644 --- a/tests/SAML2/Binding/HTTPRedirectTest.php +++ b/tests/SAML2/Binding/HTTPRedirectTest.php @@ -6,23 +6,23 @@ use Exception; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\{CoversClass, DoesNotPerformAssertions, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Binding\HTTPRedirect; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AbstractRequest; -use SimpleSAML\SAML2\XML\samlp\AuthnRequest; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\{AbstractRequest, AuthnRequest, Response, Status, StatusCode}; +use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; +use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; /** * @package simplesamlphp\saml2 */ +#[Group('bindings')] #[CoversClass(HTTPRedirect::class)] final class HTTPRedirectTest extends TestCase { @@ -182,6 +182,7 @@ public function testInvalidEncodingSpecified(): void $this->expectException(Exception::class); $this->expectExceptionMessage('Unknown SAMLEncoding:'); + $hr = new HTTPRedirect(); $hr->receive($request); } @@ -201,6 +202,7 @@ public function testNoSigAlgSpecified(): void $this->expectException(Exception::class); $this->expectExceptionMessage('Missing signature algorithm'); + $hr = new HTTPRedirect(); $hr->receive($request); } @@ -217,6 +219,7 @@ public function testInvalidRequestData(): void $this->expectException(Exception::class); $this->expectExceptionMessage('Error while base64 decoding SAML message.'); + $hr = new HTTPRedirect(); @$hr->receive($request); } @@ -233,6 +236,7 @@ public function testNoRequestOrResponse(): void $this->expectException(Exception::class); $this->expectExceptionMessage('Missing SAMLRequest or SAMLResponse parameter.'); + $hr = new HTTPRedirect(); $hr->receive($request); } @@ -243,7 +247,11 @@ public function testNoRequestOrResponse(): void */ public function testSendWithoutDestination(): void { - $request = new AuthnRequest(self::$clock->now()); + $request = new AuthnRequest( + id: IDValue::fromString('abc123'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); + $hr = new HTTPRedirect(); $this->expectException(Exception::class); $this->expectExceptionMessage('Cannot build a redirect URL, no destination set.'); @@ -257,7 +265,10 @@ public function testSendWithoutDestination(): void #[DoesNotPerformAssertions] public function testSendAuthnrequest(): void { - $request = new AuthnRequest(self::$clock->now()); + $request = new AuthnRequest( + id: IDValue::fromString('abc123'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); $hr = new HTTPRedirect(); $hr->setDestination('https://idp.example.org/'); $hr->send($request); @@ -271,14 +282,21 @@ public function testSendAuthnrequest(): void #[DoesNotPerformAssertions] public function testSendAuthnResponse(): void { - $status = new Status(new StatusCode()); - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $status = new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); $response = new Response( + id: IDValue::fromString('abc123'), status: $status, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), issuer: $issuer, - destination: 'http://example.org/login?success=yes', + destination: SAMLAnyURIValue::fromString('http://example.org/login?success=yes'), ); $hr = new HTTPRedirect(); @@ -293,10 +311,22 @@ public function testSendAuthnResponse(): void #[DoesNotPerformAssertions] public function testSendAuthnResponseBespokeDestination(): void { - $status = new Status(new StatusCode()); - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $status = new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); + + $response = new Response( + id: IDValue::fromString('abc123'), + status: $status, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + issuer: $issuer, + ); - $response = new Response($status, self::$clock->now(), $issuer); $hr = new HTTPRedirect(); $hr->setDestination('gopher://myurl'); $hr->send($response); diff --git a/tests/SAML2/Binding/SOAPTest.php b/tests/SAML2/Binding/SOAPTest.php index 1356111913..ba202d93f9 100644 --- a/tests/SAML2/Binding/SOAPTest.php +++ b/tests/SAML2/Binding/SOAPTest.php @@ -6,21 +6,22 @@ use Mockery\Adapter\Phpunit\MockeryTestCase; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use SimpleSAML\SAML2\Binding\SOAP; use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException; -use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated; -use SimpleSAML\SAML2\XML\ecp\Response; -use SimpleSAML\SAML2\XML\samlp\ArtifactResolve; -use SimpleSAML\SAML2\XML\samlp\MessageFactory; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\ecp\{RequestAuthenticated, Response}; +use SimpleSAML\SAML2\XML\samlp\{ArtifactResolve, MessageFactory}; use SimpleSAML\SOAP\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\BooleanValue; use function dirname; /** * @package simplesamlphp\saml2 */ +#[Group('bindings')] #[CoversClass(SOAP::class)] final class SOAPTest extends MockeryTestCase { @@ -109,8 +110,12 @@ public function testSendResponse(): void SOAP); - $requestAuthenticated = new RequestAuthenticated(true); - $ecpResponse = new Response('https://example.org/metadata'); + $requestAuthenticated = new RequestAuthenticated( + BooleanValue::fromBoolean(true), + ); + $ecpResponse = new Response( + SAMLAnyURIValue::fromString('https://example.org/metadata'), + ); /** @var \DOMElement $header */ diff --git a/tests/SAML2/BindingTest.php b/tests/SAML2/BindingTest.php index 6b4363e719..6b64f3157a 100644 --- a/tests/SAML2/BindingTest.php +++ b/tests/SAML2/BindingTest.php @@ -5,7 +5,7 @@ namespace SimpleSAML\Test\SAML2; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Binding; use SimpleSAML\SAML2\Binding\HTTPArtifact; @@ -18,6 +18,7 @@ /** * @package simplesamlphp\saml2 */ +#[Group('bindings')] #[CoversClass(Binding::class)] final class BindingTest extends TestCase { diff --git a/tests/SAML2/CustomBaseID.php b/tests/SAML2/CustomBaseID.php index ed64faba94..7ecd4937b7 100644 --- a/tests/SAML2/CustomBaseID.php +++ b/tests/SAML2/CustomBaseID.php @@ -5,12 +5,12 @@ namespace SimpleSAML\Test\SAML2; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\AbstractBaseID; -use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, Audience}; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\Type\QNameValue; /** * Example class to demonstrate how BaseID can be extended. @@ -33,17 +33,23 @@ final class CustomBaseID extends AbstractBaseID * CustomBaseID constructor. * * @param \SimpleSAML\SAML2\XML\saml\Audience[] $audience - * @param string|null $NameQualifier - * @param string|null $SPNameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier + * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier */ public function __construct( protected array $audience, - ?string $NameQualifier = null, - ?string $SPNameQualifier = null, + ?SAMLStringValue $NameQualifier = null, + ?SAMLStringValue $SPNameQualifier = null, ) { Assert::allIsInstanceOf($audience, Audience::class); - parent::__construct(self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME, $NameQualifier, $SPNameQualifier); + parent::__construct( + QNameValue::fromString( + '{' . self::XSI_TYPE_NAMESPACE . '}' . self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME, + ), + $NameQualifier, + $SPNameQualifier, + ); } @@ -75,10 +81,11 @@ public static function fromXML(DOMElement $xml): static $type = $xml->getAttributeNS(C::NS_XSI, 'type'); Assert::same($type, self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); - $nameQualifier = self::getOptionalAttribute($xml, 'NameQualifier', null); - $spNameQualifier = self::getOptionalAttribute($xml, 'SPNameQualifier', null); - - return new static(Audience::getChildrenOfClass($xml), $nameQualifier, $spNameQualifier); + return new static( + Audience::getChildrenOfClass($xml), + self::getOptionalAttribute($xml, 'NameQualifier', SAMLStringValue::class, null), + self::getOptionalAttribute($xml, 'SPNameQualifier', SAMLStringValue::class, null), + ); } diff --git a/tests/SAML2/CustomCondition.php b/tests/SAML2/CustomCondition.php index 6b88b77090..1c4736b396 100644 --- a/tests/SAML2/CustomCondition.php +++ b/tests/SAML2/CustomCondition.php @@ -5,11 +5,11 @@ namespace SimpleSAML\Test\SAML2; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\AbstractCondition; -use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\XML\saml\{AbstractCondition, Audience}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\Type\QNameValue; /** * Example class to demonstrate how Condition can be extended. @@ -38,7 +38,11 @@ public function __construct( ) { Assert::allIsInstanceOf($audience, Audience::class); - parent::__construct(self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); + parent::__construct( + QNameValue::fromString( + '{' . self::XSI_TYPE_NAMESPACE . '}' . self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME, + ), + ); } diff --git a/tests/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index fba5d7403e..247b36b1b2 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -4,20 +4,23 @@ namespace SimpleSAML\Test\SAML2; -use DateTimeImmutable; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; -use SimpleSAML\SAML2\XML\md\ContactPerson; -use SimpleSAML\SAML2\XML\md\Extensions; -use SimpleSAML\SAML2\XML\md\KeyDescriptor; -use SimpleSAML\SAML2\XML\md\Organization; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractRoleDescriptor, + ContactPerson, + Extensions, + KeyDescriptor, + Organization, +}; use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue}; +use SimpleSAML\XML\XsNamespace as NS; /** * Example class to demonstrate how RoleDescriptor can be extended. @@ -26,6 +29,8 @@ */ final class CustomRoleDescriptor extends AbstractRoleDescriptor { + use ExtendableElementTrait; + /** @var string */ protected const XSI_TYPE_NAME = 'CustomRoleDescriptorType'; @@ -35,17 +40,22 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor /** @var string */ protected const XSI_TYPE_PREFIX = 'ssp'; + /** The namespace-attribute for the xs:any element */ + public const XS_ANY_ELT_NAMESPACE = NS::OTHER; /** * CustomRoleDescriptor constructor. * * @param \SimpleSAML\XML\Chunk[] $chunk * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. - * @param string|null $ID The ID for this document. Defaults to null. - * @param \DateTimeImmutable|null $validUntil Unix time of validity for this document. Defaults to null. - * @param string|null $cacheDuration Maximum time this document can be cached. Defaults to null. + * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. + * Defaults to null. + * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. - * @param string|null $errorURL An URI where to redirect users for support. Defaults to null. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. + * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor An array of KeyDescriptor elements. * Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -57,20 +67,23 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor public function __construct( protected array $chunk, array $protocolSupportEnumeration, - ?string $ID = null, - ?DateTimeImmutable $validUntil = null, - ?string $cacheDuration = null, + ?IDValue $ID = null, + ?SAMLDateTimeValue $validUntil = null, + ?DurationValue $cacheDuration = null, ?Extensions $extensions = null, - ?string $errorURL = null, + ?SAMLAnyURIValue $errorURL = null, array $keyDescriptor = [], ?Organization $organization = null, array $contact = [], array $namespacedAttributes = [], ) { Assert::allIsInstanceOf($chunk, Chunk::class); + Assert::minCount($chunk, 1, 'At least one ssp:Chunk element must be provided.', MissingElementException::class); parent::__construct( - self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME, + QNameValue::fromString( + '{' . self::XSI_TYPE_NAMESPACE . '}' . self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME, + ), $protocolSupportEnumeration, $ID, $validUntil, @@ -119,10 +132,7 @@ public static function fromXML(DOMElement $xml): static $type = $xml->getAttributeNS(C::NS_XSI, 'type'); Assert::same($type, self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - - $validUntil = self::getOptionalAttribute($xml, 'validUntil', null); - SAMLAssert::nullOrValidDateTime($validUntil); + $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( @@ -140,26 +150,14 @@ public static function fromXML(DOMElement $xml): static TooManyElementsException::class, ); - $chunk = []; - foreach ($xml->childNodes as $c) { - if (!($c instanceof DOMElement)) { - continue; - } elseif ($c->namespaceURI === C::NS_MD) { - continue; - } - - $chunk[] = new Chunk($c); - } - Assert::minCount($chunk, 1, 'At least one ssp:Chunk element must be provided.', MissingElementException::class); - return new static( - $chunk, - preg_split('/[\s]+/', trim($protocols)), - self::getOptionalAttribute($xml, 'ID', null), - $validUntil !== null ? new DateTimeImmutable($validUntil) : null, - self::getOptionalAttribute($xml, 'cacheDuration', null), + self::getChildElementsFromXML($xml), + preg_split('/[\s]+/', trim($protocols->getValue())), + self::getOptionalAttribute($xml, 'ID', IDValue::class, null), + self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), + self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), !empty($extensions) ? $extensions[0] : null, - self::getOptionalAttribute($xml, 'errorURL', null), + self::getOptionalAttribute($xml, 'errorURL', SAMLAnyURIValue::class, null), KeyDescriptor::getChildrenOfClass($xml), !empty($orgs) ? $orgs[0] : null, ContactPerson::getChildrenOfClass($xml), @@ -178,6 +176,21 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); + if (!$e->lookupPrefix($this->getXsiType()->getNamespaceURI()->getValue())) { + $namespace = new XMLAttribute( + 'http://www.w3.org/2000/xmlns/', + 'xmlns', + $this->getXsiType()->getNamespacePrefix()->getValue(), + $this->getXsiType()->getNamespaceURI(), + ); + $namespace->toXML($e); + } + + if (!$e->lookupPrefix('xsi')) { + $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); + $type->toXML($e); + } + foreach ($this->getChunk() as $chunk) { $chunk->toXML($e); } diff --git a/tests/SAML2/CustomStatement.php b/tests/SAML2/CustomStatement.php index edcba56f1f..a60ba31ed2 100644 --- a/tests/SAML2/CustomStatement.php +++ b/tests/SAML2/CustomStatement.php @@ -5,11 +5,11 @@ namespace SimpleSAML\Test\SAML2; use DOMElement; -use SimpleSAML\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\AbstractStatement; -use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\Assert\Assert; +use SimpleSAML\SAML2\XML\saml\{AbstractStatement, Audience}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XML\Type\QNameValue; /** * Example class to demonstrate how Statement can be extended. @@ -38,7 +38,11 @@ public function __construct( ) { Assert::allIsInstanceOf($audience, Audience::class); - parent::__construct(self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); + parent::__construct( + QNameValue::fromString( + '{' . self::XSI_TYPE_NAMESPACE . '}' . self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME, + ), + ); } diff --git a/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php b/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php index 6e3631452d..645014142f 100644 --- a/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php +++ b/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php @@ -7,11 +7,11 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use SimpleSAML\SAML2\Configuration\Destination; use SimpleSAML\SAML2\Response\Validation\ConstraintValidator\DestinationMatches; use SimpleSAML\SAML2\Response\Validation\Result; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\samlp\Response; /** @@ -37,8 +37,10 @@ public function setUp(): void #[Group('response-validation')] public function testAResponseIsValidWhenTheDestinationsMatch(): void { - $expectedDestination = new Destination('VALID DESTINATION'); - $this->response->shouldReceive('getDestination')->once()->andReturn('VALID DESTINATION'); + $expectedDestination = new Destination('urn:x-simplesamlphp:validDestination'); + $this->response->shouldReceive('getDestination')->once()->andReturn( + SAMLAnyURIValue::fromString('urn:x-simplesamlphp:validDestination'), + ); $validator = new DestinationMatches($expectedDestination); $result = new Result(); @@ -53,9 +55,11 @@ public function testAResponseIsValidWhenTheDestinationsMatch(): void #[Group('response-validation')] public function testAResponseIsNotValidWhenTheDestinationsAreNotEqual(): void { - $this->response->shouldReceive('getDestination')->once()->andReturn('FOO'); + $this->response->shouldReceive('getDestination')->once()->andReturn( + SAMLAnyURIValue::fromString('urn:x-simplesamlphp:invalidDestination'), + ); $validator = new DestinationMatches( - new Destination('BAR'), + new Destination('urn:x-simplesamlphp:validDestination'), ); $result = new Result(); @@ -64,6 +68,13 @@ public function testAResponseIsNotValidWhenTheDestinationsAreNotEqual(): void $this->assertFalse($result->isValid()); $this->assertCount(1, $errors); - $this->assertEquals('Destination in response "FOO" does not match the expected destination "BAR"', $errors[0]); + $this->assertEquals( + sprintf( + 'Destination in response "%s" does not match the expected destination "%s"', + 'urn:x-simplesamlphp:invalidDestination', + 'urn:x-simplesamlphp:validDestination', + ), + $errors[0], + ); } } diff --git a/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php b/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php index 88a51446cb..c314ce6d88 100644 --- a/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php +++ b/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php @@ -7,15 +7,12 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Response\Validation\ConstraintValidator\IsSuccessful; use SimpleSAML\SAML2\Response\Validation\Result; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; -use SimpleSAML\SAML2\XML\samlp\StatusMessage; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode, StatusMessage}; /** * @package simplesamlphp/saml2 @@ -58,14 +55,16 @@ public function testAnUnsuccessfulResponseIsNotValidAndGeneratesAProperErrorMess { $responseStatus = new Status( new StatusCode( - C::STATUS_SUCCESS, + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), [ new StatusCode( - C::STATUS_PREFIX . 'bar', + SAMLAnyURIVAlue::fromString(C::STATUS_PREFIX . 'bar'), ), ], ), - new StatusMessage('this is a test message'), + new StatusMessage( + SAMLStringValue::fromString('this is a test message'), + ), ); $this->response->shouldReceive('isSuccess')->once()->andReturn(false); diff --git a/tests/SAML2/Signature/ValidatorChainTest.php b/tests/SAML2/Signature/ValidatorChainTest.php index 441e02a2b0..9449df7b99 100644 --- a/tests/SAML2/Signature/ValidatorChainTest.php +++ b/tests/SAML2/Signature/ValidatorChainTest.php @@ -4,18 +4,17 @@ namespace SimpleSAML\Test\SAML2\Signature; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use Psr\Log\NullLogger; use SimpleSAML\SAML2\Configuration\IdentityProvider; -use SimpleSAML\SAML2\Signature\MissingConfigurationException; -use SimpleSAML\SAML2\Signature\ValidatorChain; +use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Signature\{MissingConfigurationException, ValidatorChain}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; +use SimpleSAML\XML\Type\IDValue; /** * @package simplesamlphp/saml2 @@ -23,6 +22,9 @@ #[CoversClass(ValidatorChain::class)] final class ValidatorChainTest extends TestCase { + /** @var \SimpleSAML\SAML2\XML\samlp\Response */ + private static Response $response; + /** @var \SimpleSAML\SAML2\Signature\ValidatorChain */ private static ValidatorChain $chain; @@ -36,6 +38,15 @@ public static function setUpBeforeClass(): void { self::$chain = new ValidatorChain(new NullLogger(), []); self::$clock = Utils::getContainer()->getClock(); + self::$response = new Response( + id: IDValue::fromString('abc123'), + status: new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); } @@ -49,7 +60,7 @@ public function testIfNoValidatorsCanValidateAnExceptionIsThrown(): void $this->expectException(MissingConfigurationException::class); self::$chain->hasValidSignature( - new Response(new Status(new StatusCode()), self::$clock->now()), + self::$response, new IdentityProvider([]), ); } @@ -65,7 +76,7 @@ public function testAllRegisteredValidatorsShouldBeTried(): void self::$chain->appendValidator(new MockChainedValidator(true, false)); $validationResult = self::$chain->hasValidSignature( - new Response(new Status(new StatusCode()), self::$clock->now()), + self::$response, new IdentityProvider([]), ); $this->assertFalse($validationResult, 'The validation result is not what is expected'); @@ -82,7 +93,7 @@ public function testItUsesTheResultOfTheFirstValidatorThatCanValidate(): void self::$chain->appendValidator(new MockChainedValidator(false, true)); $validationResult = self::$chain->hasValidSignature( - new Response(new Status(new StatusCode()), self::$clock->now()), + self::$response, new IdentityProvider([]), ); $this->assertFalse($validationResult, 'The validation result is not what is expected'); diff --git a/tests/SAML2/Type/EntityIDValueTest.php b/tests/SAML2/Type/EntityIDValueTest.php new file mode 100644 index 0000000000..7a44cd38c7 --- /dev/null +++ b/tests/SAML2/Type/EntityIDValueTest.php @@ -0,0 +1,57 @@ +assertTrue($shouldPass); + } catch (ProtocolViolationException | SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideEntityID(): array + { + return [ + 'urn' => [true, 'urn:x-simplesamlphp:phpunit'], + 'same-doc' => [false, '#_53d830ab1be17291a546c95c7f1cdf8d3d23c959e6'], + 'url' => [true, 'https://www.simplesamlphp.org'], + 'diacritical' => [true, 'https://aä.com'], + 'spn' => [true, 'spn:a4cf592f-a64c-46ff-a788-b260f474525b'], + 'typos' => [false, 'https//www.uni.l/en/'], + 'spaces' => [false, 'this is silly'], + 'empty' => [false, ''], + 'azure-common' => [true, 'https://sts.windows.net/{tenantid}/'], + 'too_long' => [false, str_pad('urn:x-simplesamlphp-phpunit:', C::ENTITYID_MAX_LENGTH + 1, 'a')], + ]; + } +} diff --git a/tests/SAML2/Type/ListOfStringsValueTest.php b/tests/SAML2/Type/ListOfStringsValueTest.php new file mode 100644 index 0000000000..41122e8c6a --- /dev/null +++ b/tests/SAML2/Type/ListOfStringsValueTest.php @@ -0,0 +1,57 @@ +assertTrue($shouldPass); + } catch (SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * Test the toArray function + */ + public function testToArray(): void + { + $listOfStrings = ListOfStringsValue::fromString("foo+bar baz"); + $this->assertEquals(['foo bar', 'baz'], $listOfStrings->toArray()); + } + + + /** + * @return array + */ + public static function provideListOfStrings(): array + { + return [ + 'whitespace collapse' => [true, "foo+bar"], + 'normalization' => [true, 'foo+bar baz'], + ]; + } +} diff --git a/tests/SAML2/Type/SAMLAnyURIValueTest.php b/tests/SAML2/Type/SAMLAnyURIValueTest.php new file mode 100644 index 0000000000..217d457df4 --- /dev/null +++ b/tests/SAML2/Type/SAMLAnyURIValueTest.php @@ -0,0 +1,55 @@ +assertTrue($shouldPass); + } catch (ProtocolViolationException | SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideURI(): array + { + return [ + 'urn' => [true, 'urn:x-simplesamlphp:phpunit'], + 'same-doc' => [false, '#_53d830ab1be17291a546c95c7f1cdf8d3d23c959e6'], + 'url' => [true, 'https://www.simplesamlphp.org'], + 'diacritical' => [true, 'https://aä.com'], + 'spn' => [true, 'spn:a4cf592f-a64c-46ff-a788-b260f474525b'], + 'typos' => [false, 'https//www.uni.l/en/'], + 'spaces' => [false, 'this is silly'], + 'empty' => [false, ''], + 'azure-common' => [true, 'https://sts.windows.net/{tenantid}/'], + ]; + } +} diff --git a/tests/SAML2/Type/SAMLDateTimeValueTest.php b/tests/SAML2/Type/SAMLDateTimeValueTest.php new file mode 100644 index 0000000000..5bfb5ab1eb --- /dev/null +++ b/tests/SAML2/Type/SAMLDateTimeValueTest.php @@ -0,0 +1,63 @@ +assertTrue($shouldPass); + } catch (AssertionFailedException | ProtocolViolationException | SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideDateTime(): array + { + return [ + 'valid' => [true, '2001-10-26T21:32:52Z'], + 'invalid with numeric difference' => [false, '2001-10-26T21:32:52+02:00'], + 'invalid with Zulu' => [false, '2001-10-26T19:32:52'], + 'invalid with 00:00 difference' => [false, '2001-10-26T19:32:52+00:00'], + 'valid with negative value' => [true, '-2001-10-26T21:32:52Z'], + 'valid with subseconds' => [true, '2001-10-26T21:32:52.12679Z'], + 'valid with more than four digit year' => [true, '-22001-10-26T21:32:52Z'], + 'valid with sub-seconds' => [true, '2001-10-26T21:32:52.12679Z'], + 'empty' => [false, ''], + 'whitespace collapse' => [true, ' 2001-10-26T21:32:52Z '], + 'missing time' => [false, '2001-10-26'], + 'missing second' => [false, '2001-10-26T21:32'], + 'hour out of range' => [false, '2001-10-26T25:32:52+02:00'], + 'year 0000' => [false, '0000-10-26T25:32:52+02:00'], + 'prefixed zero' => [false, '02001-10-26T25:32:52+02:00'], + 'wrong format' => [false, '01-10-26T21:32'], + ]; + } +} diff --git a/tests/SAML2/Type/SAMLStringValueTest.php b/tests/SAML2/Type/SAMLStringValueTest.php new file mode 100644 index 0000000000..90727d9890 --- /dev/null +++ b/tests/SAML2/Type/SAMLStringValueTest.php @@ -0,0 +1,48 @@ +assertTrue($shouldPass); + } catch (ProtocolViolationException | SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideString(): array + { + return [ + 'empty string' => [false, ''], + 'some thing' => [true, 'Snoopy '], + ]; + } +} diff --git a/tests/SAML2/UtilsTest.php b/tests/SAML2/UtilsTest.php index 304f3477ca..360e568255 100644 --- a/tests/SAML2/UtilsTest.php +++ b/tests/SAML2/UtilsTest.php @@ -8,11 +8,12 @@ use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\saml\{NameID, Subject}; use SimpleSAML\SAML2\XML\samlp\AttributeQuery; +use SimpleSAML\XML\Type\IDValue; use function count; @@ -42,13 +43,17 @@ public static function setUpBeforeClass(): void public function testXpQuery(): void { $nameId_before = new NameID( - 'NameIDValue', - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', - C::NAMEID_TRANSIENT, + SAMLStringValue::fromString('NameIDValue'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ); - $aq = new AttributeQuery(new Subject($nameId_before), self::$clock->now()); + $aq = new AttributeQuery( + id: IDValue::fromString('abc123'), + subject: new Subject($nameId_before), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); $xml = $aq->toXML(); diff --git a/tests/SAML2/XML/alg/DigestMethodTest.php b/tests/SAML2/XML/alg/DigestMethodTest.php index 117f8d9ca4..962fbbb7b4 100644 --- a/tests/SAML2/XML/alg/DigestMethodTest.php +++ b/tests/SAML2/XML/alg/DigestMethodTest.php @@ -4,17 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\alg; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\alg\AbstractAlgElement; -use SimpleSAML\SAML2\XML\alg\DigestMethod; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\alg\{AbstractAlgElement, DigestMethod}; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +47,7 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $digestMethod = new DigestMethod( - C::DIGEST_SHA256, + SAMLAnyURIValue::fromString(C::DIGEST_SHA256), [ new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/SAML2/XML/alg/SigningMethodTest.php b/tests/SAML2/XML/alg/SigningMethodTest.php index 9bc124c0a5..813adc6997 100644 --- a/tests/SAML2/XML/alg/SigningMethodTest.php +++ b/tests/SAML2/XML/alg/SigningMethodTest.php @@ -4,17 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\alg; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\alg\AbstractAlgElement; -use SimpleSAML\SAML2\XML\alg\SigningMethod; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\alg\{AbstractAlgElement, SigningMethod}; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\PositiveIntegerValue; use function dirname; use function strval; @@ -50,9 +48,9 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $signingMethod = new SigningMethod( - C::SIG_RSA_SHA256, - 1024, - 4096, + SAMLAnyURIValue::fromString(C::SIG_RSA_SHA256), + PositiveIntegerValue::fromString('1024'), + PositiveIntegerValue::fromString('4096'), [ new Chunk(DOMDocumentFactory::fromString( 'Some', diff --git a/tests/SAML2/XML/ecp/RelayStateTest.php b/tests/SAML2/XML/ecp/RelayStateTest.php index a6032d3a96..2fc870bcd7 100644 --- a/tests/SAML2/XML/ecp/RelayStateTest.php +++ b/tests/SAML2/XML/ecp/RelayStateTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; -use SimpleSAML\SAML2\XML\ecp\RelayState; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, RelayState}; use SimpleSAML\SOAP\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $relayState = new RelayState('AGDY854379dskssda'); + $relayState = new RelayState( + SAMLStringValue::fromString('AGDY854379dskssda'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php index 31c8aa9b92..23718034c1 100644 --- a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php +++ b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; -use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated; +use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, RequestAuthenticated}; use SimpleSAML\SOAP\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\BooleanValue; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $ra = new RequestAuthenticated(false); + $ra = new RequestAuthenticated( + BooleanValue::fromBoolean(false), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/ecp/RequestTest.php b/tests/SAML2/XML/ecp/RequestTest.php index ebce837d03..a2e733d3d2 100644 --- a/tests/SAML2/XML/ecp/RequestTest.php +++ b/tests/SAML2/XML/ecp/RequestTest.php @@ -4,20 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; -use SimpleSAML\SAML2\XML\ecp\Request; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, Request}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\GetComplete; -use SimpleSAML\SAML2\XML\samlp\IDPEntry; -use SimpleSAML\SAML2\XML\samlp\IDPList; +use SimpleSAML\SAML2\XML\samlp\{GetComplete, IDPEntry, IDPList}; use SimpleSAML\SOAP\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\BooleanValue; use function dirname; use function strval; @@ -51,18 +48,33 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $issuer = new Issuer( - 'urn:x-simplesamlphp:issuer', - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', - 'urn:the:format', - 'TheSPProvidedID', + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + SAMLAnyURIValue::fromString('urn:the:format'), + SAMLStringValue::fromString('TheSPProvidedID'), + ); + $entry1 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester1'), + SAMLStringValue::fromString('testName1'), + SAMLAnyURIValue::fromString('urn:test:testLoc1'), + ); + $entry2 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester2'), + SAMLStringValue::fromString('testName2'), + SAMLAnyURIValue::fromString('urn:test:testLoc2'), + ); + $getComplete = new GetComplete( + SAMLAnyURIValue::fromString('https://some/location'), ); - $entry1 = new IDPEntry('urn:some:requester1', 'testName1', 'urn:test:testLoc1'); - $entry2 = new IDPEntry('urn:some:requester2', 'testName2', 'urn:test:testLoc2'); - $getComplete = new GetComplete('https://some/location'); $idpList = new IDPList([$entry1, $entry2], $getComplete); - $request = new Request($issuer, $idpList, 'PHPUnit', true); + $request = new Request( + $issuer, + $idpList, + SAMLStringValue::fromString('PHPUnit'), + BooleanValue::fromBoolean(true), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/ecp/ResponseTest.php b/tests/SAML2/XML/ecp/ResponseTest.php index bfc0d43a49..46595bf9fb 100644 --- a/tests/SAML2/XML/ecp/ResponseTest.php +++ b/tests/SAML2/XML/ecp/ResponseTest.php @@ -5,18 +5,15 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; -use SimpleSAML\SAML2\XML\ecp\Response; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, Response}; use SimpleSAML\SOAP\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -49,7 +46,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $response = new Response('https://example.com/ACS'); + $response = new Response( + SAMLAnyURIValue::fromString('https://example.com/ACS'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -65,7 +64,9 @@ public function testToXMLResponseAppended(): void $doc = new DOMDocument('1.0', 'UTF-8'); $element = $doc->createElement('Foobar'); - $response = new Response('https://example.com/ACS'); + $response = new Response( + SAMLAnyURIValue::fromString('https://example.com/ACS'), + ); $return = $response->toXML($element); $elements = $element->getElementsByTagNameNS(C::NS_ECP, 'Response'); @@ -75,16 +76,6 @@ public function testToXMLResponseAppended(): void } - /** - */ - public function testInvalidACSThrowsException(): void - { - $this->expectException(ProtocolViolationException::class); - - new Response('some non-url'); - } - - /** */ public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void diff --git a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php index 2f49ff9814..bea6e7f778 100644 --- a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php @@ -4,23 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; -use SimpleSAML\SAML2\XML\ecp\SubjectConfirmation; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, SubjectConfirmation}; use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; use SimpleSAML\SOAP\Constants as SOAP; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{IDValue, NCNameValue, StringValue}; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -55,23 +51,38 @@ public function testMarshalling(): void { $arbitrary = DOMDocumentFactory::fromString('Arbitrary Element'); - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute( + 'urn:test:something', + 'test', + 'attr1', + SAMLStringValue::fromString('testval1'), + ); + $attr2 = new XMLAttribute( + 'urn:test:something', + 'test', + 'attr2', + SAMLStringValue::fromString('testval2'), + ); $subjectConfirmationData = new SubjectConfirmationData( - new DateTimeImmutable('2001-04-19T04:25:21Z'), - new DateTimeImmutable('2009-02-13T23:31:30Z'), - C::ENTITY_SP, - 'SomeRequestID', - '127.0.0.1', + SAMLDateTimeValue::fromString('2001-04-19T04:25:21Z'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + EntityIDValue::fromString(C::ENTITY_SP), + NCNameValue::fromString('SomeRequestID'), + SAMLStringValue::fromString('127.0.0.1'), [ - new KeyInfo([new KeyName('SomeKey')]), + new KeyInfo([ + new KeyName(StringValue::fromString('SomeKey')), + ]), new Chunk($arbitrary->documentElement), ], [$attr1, $attr2], ); - $subjectConfirmation = new SubjectConfirmation(C::CM_BEARER, $subjectConfirmationData); + $subjectConfirmation = new SubjectConfirmation( + SAMLAnyURIValue::fromString(C::CM_BEARER), + $subjectConfirmationData, + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/emd/RepublishRequestTest.php b/tests/SAML2/XML/emd/RepublishRequestTest.php index 279f8f7a80..ce01db64b0 100644 --- a/tests/SAML2/XML/emd/RepublishRequestTest.php +++ b/tests/SAML2/XML/emd/RepublishRequestTest.php @@ -4,16 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\emd; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\emd\AbstractEmdElement; -use SimpleSAML\SAML2\XML\emd\RepublishRequest; -use SimpleSAML\SAML2\XML\emd\RepublishTarget; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\emd\{AbstractEmdElement, RepublishRequest, RepublishTarget}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -55,7 +51,9 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $republishRequest = new RepublishRequest( - new RepublishTarget('http://edugain.org/'), + new RepublishTarget( + SAMLAnyURIValue::fromString('http://edugain.org/'), + ), ); $this->assertEquals( diff --git a/tests/SAML2/XML/emd/RepublishTargetTest.php b/tests/SAML2/XML/emd/RepublishTargetTest.php index 2906a500e5..71e3893daa 100644 --- a/tests/SAML2/XML/emd/RepublishTargetTest.php +++ b/tests/SAML2/XML/emd/RepublishTargetTest.php @@ -4,12 +4,11 @@ namespace SimpleSAML\Test\SAML2\XML\emd; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\emd\AbstractEmdElement; -use SimpleSAML\SAML2\XML\emd\RepublishTarget; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\emd\{AbstractEmdElement, RepublishTarget}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -46,7 +45,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $republishTarget = new RepublishTarget('http://edugain.org/'); + $republishTarget = new RepublishTarget( + SAMLAnyURIValue::fromString('http://edugain.org/'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -64,6 +65,6 @@ public function testMarshallingIncorrectValueThrowsException(): void 'Expected a value identical to "http://edugain.org/". Got: "http://example.org/"', ); - new RepublishTarget('http://example.org/'); + new RepublishTarget(SAMLAnyURIValue::fromString('http://example.org/')); } } diff --git a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php index f364101090..c3ff8d8036 100644 --- a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php +++ b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php @@ -4,20 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\idpdisc; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; -use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\{AbstractIndexedEndpointType, AbstractMdElement}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; use function dirname; use function strval; @@ -51,7 +48,12 @@ public static function setUpBeforeClass(): void { self::$testedClass = DiscoveryResponse::class; - self::$attr = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + self::$attr = new XMLAttribute( + 'urn:x-simplesamlphp:namespace', + 'ssp', + 'attr1', + SAMLStringValue::fromString('testval1'), + ); self::$ext = new Chunk(DOMDocumentFactory::fromString( 'SomeExtension', @@ -82,10 +84,10 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $discoResponse = new DiscoveryResponse( - 43, - C::BINDING_IDPDISC, - C::LOCATION_A, - false, + UnsignedShortValue::fromInteger(43), + SAMLAnyURIValue::fromString(C::BINDING_IDPDISC), + SAMLAnyURIValue::fromString(C::LOCATION_A), + BooleanValue::fromBoolean(false), null, [self::$ext], [self::$attr], @@ -108,11 +110,11 @@ public function testMarshallingWithResponseLocation(): void 'The \'ResponseLocation\' attribute must be omitted for idpdisc:DiscoveryResponse.', ); new DiscoveryResponse( - 42, - C::BINDING_IDPDISC, - C::LOCATION_A, - false, - 'https://response.location/', + UnsignedShortValue::fromInteger(42), + SAMLAnyURIValue::fromString(C::BINDING_IDPDISC), + SAMLAnyURIValue::fromString(C::LOCATION_A), + BooleanValue::fromBoolean(false), + SAMLAnyURIValue::fromString('https://response.location/'), ); } diff --git a/tests/SAML2/XML/init/RequestInitiatorTest.php b/tests/SAML2/XML/init/RequestInitiatorTest.php index f96b9642a2..7ebf1d40f6 100644 --- a/tests/SAML2/XML/init/RequestInitiatorTest.php +++ b/tests/SAML2/XML/init/RequestInitiatorTest.php @@ -4,18 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\init; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\init\RequestInitiator; use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -62,8 +60,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'test', 'attr', 'value'); - $requestInitiator = new RequestInitiator(C::LOCATION_A, C::LOCATION_B, [self::$ext], [$attr]); + $attr = new XMLAttribute(C::NAMESPACE, 'test', 'attr', SAMLStringValue::fromString('value')); + $requestInitiator = new RequestInitiator( + SAMLAnyURIValue::fromString(C::LOCATION_A), + SAMLAnyURIValue::fromString(C::LOCATION_B), + [self::$ext], + [$attr], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php index bf915ffca8..97ca835d96 100644 --- a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php +++ b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php @@ -5,16 +5,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\ServiceDescription; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceDescription}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; +use SimpleSAML\XML\Exception\{MissingAttributeException, SchemaViolationException}; use function dirname; @@ -43,33 +40,6 @@ public static function setUpBeforeClass(): void } - // test marshalling - - - /** - * Test that creating a ServiceDescription from scratch with an empty language fails. - */ - public function testMarshallingWithEmptyLang(): void - { - $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage('Expected a non-whitespace string. Got: ""'); - - new ServiceDescription('', 'Academic Journals R US and only us'); - } - - - /** - * Test that creating a ServiceDescription from scratch with an empty value works. - */ - public function testMarshallingWithEmptyValue(): void - { - $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage('Expected a non-whitespace string. Got: ""'); - - new ServiceDescription('en', ''); - } - - // test unmarshalling @@ -96,8 +66,8 @@ public function testUnmarshallingWithEmptyLang(): void $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->setAttributeNS(C::NS_XML, 'lang', ''); - $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage('Expected a non-whitespace string. Got: ""'); + $this->expectException(SchemaViolationException::class); + $this->expectExceptionMessage('"" is not a valid xs:language'); ServiceDescription::fromXML($xmlRepresentation->documentElement); } @@ -112,7 +82,7 @@ public function testUnmarshallingWithEmptyValue(): void $xmlRepresentation->documentElement->textContent = ''; $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage('Expected a non-whitespace string. Got: ""'); + $this->expectExceptionMessage('"" is not a SAML2.0-compliant string'); ServiceDescription::fromXML($xmlRepresentation->documentElement); } diff --git a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php index 5d87eb2596..b0eff1b698 100644 --- a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php +++ b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php @@ -4,17 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AdditionalMetadataLocation; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, AdditionalMetadataLocation}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -53,7 +50,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $additionalMetadataLocation = new AdditionalMetadataLocation(C::NAMESPACE, C::LOCATION_A); + $additionalMetadataLocation = new AdditionalMetadataLocation( + SAMLAnyURIValue::fromString(C::NAMESPACE), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -62,16 +62,6 @@ public function testMarshalling(): void } - /** - * Test that creating an AdditionalMetadataLocation from scratch with an empty namespace fails. - */ - public function testMarshallingWithEmptyNamespace(): void - { - $this->expectException(ProtocolViolationException::class); - new AdditionalMetadataLocation('', C::LOCATION_A); - } - - // test unmarshalling diff --git a/tests/SAML2/XML/md/AffiliateMemberTest.php b/tests/SAML2/XML/md/AffiliateMemberTest.php index 4063587739..24f45b4ab7 100644 --- a/tests/SAML2/XML/md/AffiliateMemberTest.php +++ b/tests/SAML2/XML/md/AffiliateMemberTest.php @@ -4,20 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AffiliateMember; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, AffiliateMember}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; -use function sprintf; -use function str_pad; use function strval; /** @@ -54,34 +48,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $affiliateMember = new AffiliateMember('https://some.entity.org/id'); + $affiliateMember = new AffiliateMember( + EntityIDValue::fromString('https://some.entity.org/id'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($affiliateMember), ); } - - - /** - */ - public function testMarshallingEmptyThrowsException(): void - { - $this->expectException(ProtocolViolationException::class); - - new AffiliateMember(''); - } - - - /** - */ - public function testMarshallingTooLongContentThrowsException(): void - { - $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage( - sprintf('An entityID cannot be longer than %d characters.', C::ENTITYID_MAX_LENGTH), - ); - - new AffiliateMember(str_pad('https://some.entity.org/id', C::ENTITYID_MAX_LENGTH + 1, 'a')); - } } diff --git a/tests/SAML2/XML/md/AffiliationDescriptorTest.php b/tests/SAML2/XML/md/AffiliationDescriptorTest.php index 433de1a0e6..62810bb0e8 100644 --- a/tests/SAML2/XML/md/AffiliationDescriptorTest.php +++ b/tests/SAML2/XML/md/AffiliationDescriptorTest.php @@ -4,27 +4,27 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DateTimeImmutable; use Exception; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\AffiliateMember; -use SimpleSAML\SAML2\XML\md\AffiliationDescriptor; -use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue, KeyTypesValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractSignedMdElement, + AffiliateMember, + AffiliationDescriptor, + KeyDescriptor, + KeyTypesEnum, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -67,22 +67,33 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $affiliationDescriptor = new AffiliationDescriptor( - affiliationOwnerId: C::ENTITY_IDP, - affiliateMember: [new AffiliateMember(C::ENTITY_SP), new AffiliateMember(C::ENTITY_OTHER)], - ID: 'TheID', - validUntil: new DateTimeImmutable('2009-02-13T23:31:30Z'), - cacheDuration: 'PT5000S', + affiliationOwnerId: EntityIDValue::fromString(C::ENTITY_IDP), + affiliateMember: [ + new AffiliateMember( + EntityIDValue::fromString(C::ENTITY_SP), + ), + new AffiliateMember( + EntityIDValue::fromString(C::ENTITY_OTHER), + ), + ], + ID: IDValue::fromString('TheID'), + validUntil: SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + cacheDuration: DurationValue::fromString('PT5000S'), keyDescriptor: [ new KeyDescriptor( new KeyInfo( [ - new KeyName('IdentityProvider.com SSO Key'), + new KeyName( + SAMLStringValue::fromString('IdentityProvider.com SSO Key'), + ), ], ), - 'signing', + KeyTypesValue::fromEnum(KeyTypesEnum::SIGNING), ), ], - namespacedAttribute: [new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1')], + namespacedAttribute: [ + new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', SAMLStringValue::fromString('value1')), + ], ); $this->assertEquals( @@ -92,19 +103,6 @@ public function testMarshalling(): void } - /** - * Test that creating an AffiliationDescriptor with an empty owner ID fails. - */ - public function testMarhsallingWithEmptyOwnerID(): void - { - $this->expectException(ProtocolViolationException::class); - new AffiliationDescriptor( - affiliationOwnerId: '', - affiliateMember: [new AffiliateMember(C::ENTITY_SP), new AffiliateMember(C::ENTITY_OTHER)], - ); - } - - /** * Test that creating an AffiliationDescriptor with an empty list of members fails. */ @@ -113,7 +111,7 @@ public function testMarshallingWithEmptyMemberList(): void $this->expectException(Exception::class); $this->expectExceptionMessage('List of affiliated members must not be empty.'); new AffiliationDescriptor( - affiliationOwnerId: C::ENTITY_IDP, + affiliationOwnerId: EntityIDValue::fromString(C::ENTITY_IDP), affiliateMember: [], ); } diff --git a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php index b13041b990..1e7d7bb001 100644 --- a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php +++ b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php @@ -4,20 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractIndexedEndpointType, AbstractMdElement, ArtifactResolutionService}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, StringValue, UnsignedShortValue}; use function array_merge; use function dirname; @@ -54,7 +50,12 @@ public static function setUpBeforeClass(): void 'SomeExtension', )->documentElement); - self::$attr = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + self::$attr = new XMLAttribute( + 'urn:x-simplesamlphp:namespace', + 'ssp', + 'attr1', + StringValue::fromString('testval1'), + ); self::$testedClass = ArtifactResolutionService::class; @@ -82,10 +83,10 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $ars = new ArtifactResolutionService( - 42, - C::BINDING_HTTP_ARTIFACT, - 'https://simplesamlphp.org/some/endpoint', - false, + UnsignedShortValue::fromInteger(42), + SAMLAnyURIValue::fromString(C::BINDING_HTTP_ARTIFACT), + SAMLAnyURIValue::fromString('https://simplesamlphp.org/some/endpoint'), + BooleanValue::fromBoolean(false), null, [self::$ext], [self::$attr], @@ -107,7 +108,13 @@ public function testMarshallingWithResponseLocation(): void $this->expectExceptionMessage( 'The \'ResponseLocation\' attribute must be omitted for md:ArtifactResolutionService.', ); - new ArtifactResolutionService(42, C::BINDING_HTTP_ARTIFACT, C::LOCATION_A, false, 'https://response.location/'); + new ArtifactResolutionService( + UnsignedShortValue::fromInteger(42), + SAMLAnyURIValue::fromString(C::BINDING_HTTP_ARTIFACT), + SAMLAnyURIValue::fromString(C::LOCATION_A), + BooleanValue::fromBoolean(false), + SAMLAnyURIValue::fromString('https://response.location/'), + ); } diff --git a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php index f130a1e527..230874ddb0 100644 --- a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php +++ b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php @@ -4,19 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AssertionConsumerService; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractIndexedEndpointType, AbstractMdElement, AssertionConsumerService}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, StringValue, UnsignedShortValue}; use function dirname; use function strval; @@ -52,7 +48,12 @@ public static function setUpBeforeClass(): void 'SomeExtension', )->documentElement); - self::$attr = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1'); + self::$attr = new XMLAttribute( + 'urn:x-simplesamlphp:namespace', + 'ssp', + 'attr1', + StringValue::fromString('testval1'), + ); self::$testedClass = AssertionConsumerService::class; @@ -81,11 +82,11 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $idxep = new AssertionConsumerService( - 42, - C::BINDING_HTTP_POST, - C::LOCATION_A, - false, - 'https://foo.bar/', + UnsignedShortValue::fromInteger(42), + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + BooleanValue::fromBoolean(false), + SAMLAnyURIValue::fromString('https://foo.bar/'), [self::$ext], [self::$attr], ); diff --git a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php index e927016a11..9e54cc8241 100644 --- a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php @@ -5,27 +5,29 @@ namespace SimpleSAML\Test\SAML2\XML\md; use Exception; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; -use SimpleSAML\SAML2\XML\md\AttributeAuthorityDescriptor; -use SimpleSAML\SAML2\XML\md\AttributeProfile; -use SimpleSAML\SAML2\XML\md\AttributeService; -use SimpleSAML\SAML2\XML\md\NameIDFormat; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractRoleDescriptor, + AbstractRoleDescriptorType, + AbstractSignedMdElement, + AssertionIDRequestService, + AttributeAuthorityDescriptor, + AttributeProfile, + AttributeService, + NameIDFormat, +}; +use SimpleSAML\SAML2\XML\saml\{Attribute, AttributeValue}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\MissingElementException; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -68,13 +70,13 @@ public static function setUpBeforeClass(): void ); self::$as = new AttributeService( - C::BINDING_SOAP, - "https://IdentityProvider.com/SAML/AA/SOAP", + SAMLAnyURIValue::fromString(C::BINDING_SOAP), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/AA/SOAP'), ); self::$aidrs = new AssertionIDRequestService( - C::BINDING_URI, - "https://IdentityProvider.com/SAML/AA/URI", + SAMLAnyURIValue::fromString(C::BINDING_URI), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/AA/URI'), ); } @@ -88,15 +90,15 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $attr1 = new Attribute( - "urn:oid:1.3.6.1.4.1.5923.1.1.1.6", - C::NAMEFORMAT_URI, - "eduPersonPrincipalName", + SAMLStringValue::fromString('urn:oid:1.3.6.1.4.1.5923.1.1.1.6'), + SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + SAMLStringValue::fromString("eduPersonPrincipalName"), ); $attr2 = new Attribute( - "urn:oid:1.3.6.1.4.1.5923.1.1.1.1", - C::NAMEFORMAT_URI, - 'eduPersonAffiliation', + SAMLStringValue::fromString('urn:oid:1.3.6.1.4.1.5923.1.1.1.1'), + SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + SAMLStringValue::fromString('eduPersonAffiliation'), [ new AttributeValue('member'), new AttributeValue('student'), @@ -110,16 +112,26 @@ public function testMarshalling(): void [C::NS_SAMLP], [self::$aidrs], [ - new NameIDFormat(C::NAMEID_X509_SUBJECT_NAME), - new NameIDFormat(C::NAMEID_PERSISTENT), - new NameIDFormat(C::NAMEID_TRANSIENT), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_X509_SUBJECT_NAME), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), ], [ - new AttributeProfile(C::PROFILE_1), - new AttributeProfile(C::PROFILE_2), + new AttributeProfile( + SAMLAnyURIValue::fromString(C::PROFILE_1), + ), + new AttributeProfile( + SAMLAnyURIValue::fromString(C::PROFILE_2), + ), ], [$attr1, $attr2], - 'phpunit', + IDValue::fromString('phpunit'), ); $this->assertEquals( @@ -157,7 +169,7 @@ public function testMarshallingWithEmptySupportedProtocols(): void */ public function testMarshallingWithoutAttributeServices(): void { - $this->expectException(AssertionFailedException::class); + $this->expectException(MissingElementException::class); $this->expectExceptionMessage('AttributeAuthorityDescriptor must contain at least one AttributeService.'); new AttributeAuthorityDescriptor([], [C::NS_SAMLP]); } @@ -201,32 +213,6 @@ public function testMarshallingWithEmptyAssertionIDRequestService(): void } - /** - * Test that creating an AttributeAuthorityDescriptor with an empty NameIDFormat fails. - */ - public function testMarshallingWithEmptyNameIDFormat(): void - { - $this->expectException(ProtocolViolationException::class); - new AttributeAuthorityDescriptor([self::$as], [C::NS_SAMLP], [self::$aidrs], [new NameIDFormat('')]); - } - - - /** - * Test that creating an AttributeAuthorityDescriptor with an empty AttributeProfile fails. - */ - public function testMarshallingWithEmptyAttributeProfile(): void - { - $this->expectException(ProtocolViolationException::class); - new AttributeAuthorityDescriptor( - [self::$as], - [C::NS_SAMLP], - [self::$aidrs], - [new NameIDFormat(C::NAMEID_TRANSIENT)], - [new AttributeProfile('')], - ); - } - - // test unmarshalling diff --git a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php index 9a7c6ceacc..cd6bdc76c8 100644 --- a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php +++ b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php @@ -4,22 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AttributeConsumingService; -use SimpleSAML\SAML2\XML\md\RequestedAttribute; -use SimpleSAML\SAML2\XML\md\ServiceDescription; -use SimpleSAML\SAML2\XML\md\ServiceName; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AttributeConsumingService, + RequestedAttribute, + ServiceDescription, + ServiceName, +}; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\{MissingAttributeException, MissingElementException}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, LanguageValue, UnsignedShortValue}; use function dirname; use function strval; @@ -53,9 +53,9 @@ public static function setUpBeforeClass(): void ); self::$requestedAttribute = new RequestedAttribute( - Name: 'urn:oid:1.3.6.1.4.1.5923.1.1.1.7', - NameFormat: 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri', - FriendlyName: 'eduPersonEntitlement', + Name: SAMLStringValue::fromString('urn:oid:1.3.6.1.4.1.5923.1.1.1.7'), + NameFormat: SAMLAnyURIValue::fromString('urn:oasis:names:tc:SAML:2.0:attrname-format:uri'), + FriendlyName: SAMLStringValue::fromString('eduPersonEntitlement'), AttributeValues: [new AttributeValue('https://ServiceProvider.com/entitlements/123456789')], ); } @@ -70,11 +70,21 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $acs = new AttributeConsumingService( - 2, - [new ServiceName('en', 'Academic Journals R US')], + UnsignedShortValue::fromInteger(2), + [ + new ServiceName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US'), + ), + ], [self::$requestedAttribute], - true, - [new ServiceDescription('en', 'Academic Journals R US and only us')], + BooleanValue::fromBoolean(true), + [ + new ServiceDescription( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US and only us'), + ), + ], ); $this->assertEquals( @@ -90,10 +100,15 @@ public function testMarshalling(): void public function testMarshallingWithoutDescription(): void { $acs = new AttributeConsumingService( - 2, - [new ServiceName('en', 'Academic Journals R US')], + UnsignedShortValue::fromInteger(2), + [ + new ServiceName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US'), + ), + ], [self::$requestedAttribute], - false, + BooleanValue::fromBoolean(false), ); $xmlRepresentation = clone self::$xmlRepresentation; @@ -125,10 +140,20 @@ public function testMarshallingWithoutDescription(): void public function testMarshallingWithoutIsDefault(): void { $acs = new AttributeConsumingService( - index: 2, - serviceName: [new ServiceName('en', 'Academic Journals R US')], + index: UnsignedShortValue::fromInteger(2), + serviceName: [ + new ServiceName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US'), + ), + ], requestedAttribute: [self::$requestedAttribute], - serviceDescription: [new ServiceDescription('en', 'Academic Journals R US and only us')], + serviceDescription: [ + new ServiceDescription( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US and only us'), + ), + ], ); $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->removeAttribute('isDefault'); @@ -147,7 +172,7 @@ public function testMarshallingWithEmptyServiceName(): void $this->expectException(MissingElementException::class); $this->expectExceptionMessage('Missing at least one ServiceName in AttributeConsumingService.'); new AttributeConsumingService( - 2, + UnsignedShortValue::fromInteger(2), [], [self::$requestedAttribute], ); @@ -162,8 +187,13 @@ public function testMarshallingWithEmptyRequestedAttributes(): void $this->expectException(MissingElementException::class); $this->expectExceptionMessage('Missing at least one RequestedAttribute in AttributeConsumingService.'); new AttributeConsumingService( - 2, - [new ServiceName('en', 'Academic Journals R US')], + UnsignedShortValue::fromInteger(2), + [ + new ServiceName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US'), + ), + ], [], ); } @@ -185,44 +215,6 @@ public function testUnmarshallingWithoutIndex(): void } - /** - * Test that creating an AssertionConsumerService from XML works if isDefault is missing. - */ - public function testUnmarshallingWithoutIsDefault(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->removeAttribute('isDefault'); - $acs = AttributeConsumingService::fromXML($xmlRepresentation->documentElement); - $this->assertNull($acs->getIsDefault()); - } - - - /** - * Test that creating an AssertionConsumerService from XML fails if isDefault is not boolean - */ - public function testUnmarshallingWithWrongIsDefault(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->setAttribute('isDefault', 'xxx'); - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage("The 'isDefault' attribute of md:AttributeConsumingService must be a boolean."); - AttributeConsumingService::fromXML($xmlRepresentation->documentElement); - } - - - /** - * Test that creating an AssertionConsumerService from XML fails if index is not numerical. - */ - public function testUnmarshallingWithNonNumericIndex(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->setAttribute('index', 'x'); - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('The \'index\' attribute of md:AttributeConsumingService must be numerical.'); - AttributeConsumingService::fromXML($xmlRepresentation->documentElement); - } - - /** * Test that creating an AssertionConsumerService from XMl fails if no ServiceName was provided. */ diff --git a/tests/SAML2/XML/md/AttributeProfileTest.php b/tests/SAML2/XML/md/AttributeProfileTest.php index 0d5f3c9908..1731584075 100644 --- a/tests/SAML2/XML/md/AttributeProfileTest.php +++ b/tests/SAML2/XML/md/AttributeProfileTest.php @@ -4,15 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AttributeProfile; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, AttributeProfile}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +48,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attributeProfile = new AttributeProfile(C::PROFILE_1); + $attributeProfile = new AttributeProfile( + SAMLAnyURIValue::fromString(C::PROFILE_1), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php index 7bc02a6f1d..738a4e5226 100644 --- a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php @@ -10,19 +10,22 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; -use SimpleSAML\SAML2\XML\md\AuthnAuthorityDescriptor; -use SimpleSAML\SAML2\XML\md\AuthnQueryService; -use SimpleSAML\SAML2\XML\md\NameIDFormat; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractRoleDescriptor, + AbstractRoleDescriptorType, + AbstractSignedMdElement, + AssertionIDRequestService, + AuthnAuthorityDescriptor, + AuthnQueryService, + NameIDFormat, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -62,8 +65,15 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/md_AuthnAuthorityDescriptor.xml', ); - self::$aqs = new AuthnQueryService(C::BINDING_HTTP_POST, 'http://www.example.com/aqs'); - self::$aidrs = new AssertionIDRequestService(C::BINDING_HTTP_POST, 'http://www.example.com/aidrs'); + self::$aqs = new AuthnQueryService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('http://www.example.com/aqs'), + ); + + self::$aidrs = new AssertionIDRequestService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('http://www.example.com/aidrs'), + ); } @@ -79,8 +89,15 @@ public function testMarshalling(): void [self::$aqs], [C::NS_SAMLP, C::PROTOCOL], [self::$aidrs], - [new NameIDFormat(C::NAMEID_PERSISTENT), new NameIDFormat(C::NAMEID_TRANSIENT)], - 'phpunit', + [ + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), + ], + IDValue::fromString('phpunit'), ); $this->assertEquals( @@ -101,7 +118,14 @@ public function testMarshallingWithoutAuthnQueryServices(): void [], [C::NS_SAMLP, C::PROTOCOL], [self::$aidrs], - [new NameIDFormat(C::NAMEID_PERSISTENT), new NameIDFormat(C::NAMEID_TRANSIENT)], + [ + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), + ], ); } @@ -119,21 +143,6 @@ public function testMarshallingWithoutOptionalElements(): void } - /** - * Test that creating an AuthnAuthorityDescriptor with an empty NameIDFormat fails. - */ - public function testMarshallWithEmptyNameIDFormat(): void - { - $this->expectException(ProtocolViolationException::class); - new AuthnAuthorityDescriptor( - [self::$aqs], - [C::NS_SAMLP, C::PROTOCOL], - [self::$aidrs], - [new NameIDFormat(''), new NameIDFormat(C::NAMEID_TRANSIENT)], - ); - } - - /** * Test that creating an AuthnAuthorityDescriptor with a wrong AuthnQueryService fails. */ @@ -145,7 +154,14 @@ public function testMarshallingWithWrongAuthnQueryService(): void [self::$aqs, ''], [C::NS_SAMLP, C::PROTOCOL], [self::$aidrs], - [new NameIDFormat(C::NAMEID_PERSISTENT), new NameIDFormat(C::NAMEID_TRANSIENT)], + [ + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), + ], ); } @@ -161,7 +177,14 @@ public function testMarshallingWithWrongAssertionIDRequestService(): void [self::$aqs], [C::NS_SAMLP, C::PROTOCOL], [self::$aidrs, ''], - [new NameIDFormat(C::NAMEID_PERSISTENT), new NameIDFormat(C::NAMEID_TRANSIENT)], + [ + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), + ], ); } diff --git a/tests/SAML2/XML/md/CompanyTest.php b/tests/SAML2/XML/md/CompanyTest.php index 139530b567..a33e88937e 100644 --- a/tests/SAML2/XML/md/CompanyTest.php +++ b/tests/SAML2/XML/md/CompanyTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\Company; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, Company}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +48,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new Company('Company'); + $name = new Company( + SAMLStringValue::fromString('Company'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/ContactPersonTest.php b/tests/SAML2/XML/md/ContactPersonTest.php index da29b7f069..227ca988fd 100644 --- a/tests/SAML2/XML/md/ContactPersonTest.php +++ b/tests/SAML2/XML/md/ContactPersonTest.php @@ -5,11 +5,11 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{EmailAddressValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\SAML2\XML\md\Company; use SimpleSAML\SAML2\XML\md\ContactPerson; @@ -19,12 +19,10 @@ use SimpleSAML\SAML2\XML\md\SurName; use SimpleSAML\SAML2\XML\md\TelephoneNumber; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\StringValue; use function dirname; use function strval; @@ -90,21 +88,38 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $contactPerson = new ContactPerson( - 'other', - new Company('Test Company'), - new GivenName('John'), - new SurName('Doe'), + SAMLStringValue::fromString('other'), + new Company( + SAMLStringValue::fromString('Test Company'), + ), + new GivenName( + SAMLStringValue::fromString('John'), + ), + new SurName( + SAMLStringValue::fromString('Doe'), + ), new Extensions( [ new Chunk(self::$ext->documentElement), ], ), - [new EmailAddress('jdoe@test.company'), new EmailAddress('john.doe@test.company')], - [new TelephoneNumber('1-234-567-8901')], + [ + new EmailAddress( + EmailAddressValue::fromString('jdoe@test.company'), + ), + new EmailAddress( + EmailAddressValue::fromString('john.doe@test.company'), + ), + ], + [ + new TelephoneNumber( + SAMLStringValue::fromString('1-234-567-8901'), + ), + ], [$attr1, $attr2], ); @@ -124,7 +139,9 @@ public function testMarshallingWithWrongType(): void $this->expectExceptionMessage( 'Expected one of: "technical", "support", "administrative", "billing", "other". Got: "wrong"', ); - new ContactPerson('wrong'); + new ContactPerson( + SAMLStringValue::fromString('wrong'), + ); } diff --git a/tests/SAML2/XML/md/EmailAddressTest.php b/tests/SAML2/XML/md/EmailAddressTest.php index c469bbef03..2ada3c9031 100644 --- a/tests/SAML2/XML/md/EmailAddressTest.php +++ b/tests/SAML2/XML/md/EmailAddressTest.php @@ -4,16 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\EmailAddress; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EmailAddress}; +use SimpleSAML\SAML2\Type\EmailAddressValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; /** * Tests for EmailAddress. @@ -52,7 +49,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $email = new EmailAddress('john.doe@example.org'); + $email = new EmailAddress( + EmailAddressValue::fromString('john.doe@example.org'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -67,7 +66,9 @@ public function testInvalidEmailThrowsException(): void { $this->expectException(AssertionFailedException::class); $this->expectExceptionMessage('Expected a value to be a valid e-mail address. Got: "not so valid"'); - new EmailAddress('not so valid'); + new EmailAddress( + EmailAddressValue::fromString('not so valid'), + ); } diff --git a/tests/SAML2/XML/md/EncryptionMethodTest.php b/tests/SAML2/XML/md/EncryptionMethodTest.php index fc09ed1324..99a5e9e7a0 100644 --- a/tests/SAML2/XML/md/EncryptionMethodTest.php +++ b/tests/SAML2/XML/md/EncryptionMethodTest.php @@ -4,20 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\EncryptionMethod; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EncryptionMethod}; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\xenc\KeySize; -use SimpleSAML\XMLSecurity\XML\xenc\OAEPparams; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\Base64BinaryValue; +use SimpleSAML\XMLSecurity\Type\KeySizeValue; +use SimpleSAML\XMLSecurity\XML\xenc\{KeySize, OAEPparams}; use function dirname; use function strval; @@ -58,13 +56,21 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $alg = C::KEY_TRANSPORT_OAEP_MGF1P; $chunkXml = DOMDocumentFactory::fromString( 'Value', ); $chunk = Chunk::fromXML($chunkXml->documentElement); - $encryptionMethod = new EncryptionMethod($alg, new KeySize(10), new OAEPparams('9lWu3Q=='), [$chunk]); + $encryptionMethod = new EncryptionMethod( + SAMLAnyURIValue::fromString(C::KEY_TRANSPORT_OAEP_MGF1P), + new KeySize( + KeySizeValue::fromInteger(10), + ), + new OAEPparams( + Base64BinaryValue::fromString('9lWu3Q=='), + ), + [$chunk], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -78,7 +84,9 @@ public function testMarshalling(): void */ public function testMarshallingWithoutOptionalParameters(): void { - $encryptionMethod = new EncryptionMethod(C::KEY_TRANSPORT_OAEP_MGF1P); + $encryptionMethod = new EncryptionMethod( + SAMLAnyURIValue::fromString(C::KEY_TRANSPORT_OAEP_MGF1P), + ); $document = DOMDocumentFactory::fromString(sprintf( '', C::NS_MD, @@ -99,7 +107,16 @@ public function testMarshallingElementOrdering(): void ); $chunk = Chunk::fromXML($chunkXml->documentElement); - $em = new EncryptionMethod($alg, new KeySize(10), new OAEPparams('9lWu3Q=='), [$chunk]); + $em = new EncryptionMethod( + SAMLAnyURIValue::fromString(C::KEY_TRANSPORT_OAEP_MGF1P), + new KeySize( + KeySizeValue::fromInteger(10), + ), + new OAEPparams( + Base64BinaryValue::fromString('9lWu3Q=='), + ), + [$chunk], + ); // Marshall it to a \DOMElement $emElement = $em->toXML(); diff --git a/tests/SAML2/XML/md/EndpointTypeTest.php b/tests/SAML2/XML/md/EndpointTypeTest.php index 10c33c6b1a..5e4fb43d8c 100644 --- a/tests/SAML2/XML/md/EndpointTypeTest.php +++ b/tests/SAML2/XML/md/EndpointTypeTest.php @@ -5,23 +5,22 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractEndpointType; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; -use SimpleSAML\SAML2\XML\md\AttributeService; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{ + AbstractEndpointType, + AbstractMdElement, + AssertionIDRequestService, + AttributeService, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\StringValue; use function dirname; use function strval; @@ -60,7 +59,14 @@ public static function setUpBeforeClass(): void 'Location' => 'https://whatever/', 'ResponseLocation' => 'https://foo.bar/', 'children' => [new Chunk(self::$ext->documentElement)], - 'attributes' => [(new XMLAttribute('urn:x-simplesamlphp:namespace', 'test', 'attr', 'value'))->toArray()], + 'attributes' => [ + (new XMLAttribute( + 'urn:x-simplesamlphp:namespace', + 'test', + 'attr', + StringValue::fromString('value'), + ))->toArray(), + ], ]; self::$xmlRepresentation = DOMDocumentFactory::fromFile( @@ -77,12 +83,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr = new XMLAttribute(C::NAMESPACE, 'test', 'attr', 'value'); + $attr = new XMLAttribute(C::NAMESPACE, 'test', 'attr', StringValue::fromString('value')); $endpointType = new AttributeService( - C::BINDING_HTTP_POST, - 'https://whatever/', - 'https://foo.bar/', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('https://whatever/'), + SAMLAnyURIValue::fromString('https://foo.bar/'), [new Chunk(self::$ext->documentElement)], [$attr], ); @@ -94,32 +100,15 @@ public function testMarshalling(): void } - /** - * Test that creating an EndpointType from scratch with an empty Binding fails. - */ - public function testMarshallingWithEmptyBinding(): void - { - $this->expectException(ProtocolViolationException::class); - new AttributeService('', C::LOCATION_A); - } - - - /** - * Test that creating an EndpointType from scratch with an empty Location fails. - */ - public function testMarshallingWithEmptyLocation(): void - { - $this->expectException(ProtocolViolationException::class); - new AttributeService(C::BINDING_HTTP_POST, ''); - } - - /** * Test that creating an EndpointType from scratch without optional attributes works. */ public function testMarshallingWithoutOptionalAttributes(): void { - $endpointType = new AttributeService(C::BINDING_HTTP_POST, C::LOCATION_A); + $endpointType = new AttributeService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ); $this->assertNull($endpointType->getResponseLocation()); $this->assertEmpty($endpointType->getAttributesNS()); } diff --git a/tests/SAML2/XML/md/EntitiesDescriptorTest.php b/tests/SAML2/XML/md/EntitiesDescriptorTest.php index d484afa790..630aa542c2 100644 --- a/tests/SAML2/XML/md/EntitiesDescriptorTest.php +++ b/tests/SAML2/XML/md/EntitiesDescriptorTest.php @@ -4,23 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\EntitiesDescriptor; -use SimpleSAML\SAML2\XML\md\EntityDescriptor; -use SimpleSAML\SAML2\XML\md\Extensions; -use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; -use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractSignedMdElement, + EntitiesDescriptor, + EntityDescriptor, + Extensions, +}; +use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, UsagePolicy}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{IDValue, LanguageValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -65,9 +65,14 @@ public function testMarshalling(): void { $extensions = new Extensions([ new PublicationInfo( - publisher: 'http://publisher.ra/', - creationInstant: new DateTimeImmutable('2020-02-03T13:46:24Z'), - usagePolicy: [new UsagePolicy('en', 'http://publisher.ra/policy.txt')], + publisher: SAMLStringValue::fromString('http://publisher.ra/'), + creationInstant: SAMLDateTimeValue::fromString('2020-02-03T13:46:24Z'), + usagePolicy: [ + new UsagePolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://publisher.ra/policy.txt'), + ), + ], ), ]); $entitiesdChildElement = self::$xmlRepresentation->documentElement->getElementsByTagNameNS( @@ -88,9 +93,9 @@ public function testMarshalling(): void $entitiesd = new EntitiesDescriptor( entityDescriptors: [$childEntityd], entitiesDescriptors: [$childEntitiesd], - Name: 'Federation', + Name: SAMLStringValue::fromString('Federation'), extensions: $extensions, - ID: 'phpunit', + ID: IDValue::fromString('phpunit'), ); $this->assertEquals( @@ -164,18 +169,6 @@ public function testUnmarshallingWithoutName(): void } - /** - * Test that creating an EntitiesDescriptor with an empty Name from XML works. - */ - public function testUnmarshallingWithEmptyName(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->setAttribute('Name', ''); - $entitiesd = EntitiesDescriptor::fromXML($xmlRepresentation->documentElement); - $this->assertEquals('', $entitiesd->getName()); - } - - /** * Test that creating an EntitiesDescriptor without nested EntitiesDescriptor elements from XML works. */ diff --git a/tests/SAML2/XML/md/EntityDescriptorTest.php b/tests/SAML2/XML/md/EntityDescriptorTest.php index 902c5984d2..43e05b8493 100644 --- a/tests/SAML2/XML/md/EntityDescriptorTest.php +++ b/tests/SAML2/XML/md/EntityDescriptorTest.php @@ -4,49 +4,52 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DateTimeImmutable; use DOMText; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\AdditionalMetadataLocation; -use SimpleSAML\SAML2\XML\md\AffiliateMember; -use SimpleSAML\SAML2\XML\md\AffiliationDescriptor; -use SimpleSAML\SAML2\XML\md\AttributeAuthorityDescriptor; -use SimpleSAML\SAML2\XML\md\AttributeService; -use SimpleSAML\SAML2\XML\md\AuthnAuthorityDescriptor; -use SimpleSAML\SAML2\XML\md\AuthnQueryService; -use SimpleSAML\SAML2\XML\md\AuthzService; -use SimpleSAML\SAML2\XML\md\ContactPerson; -use SimpleSAML\SAML2\XML\md\EmailAddress; -use SimpleSAML\SAML2\XML\md\EntityDescriptor; -use SimpleSAML\SAML2\XML\md\Extensions; -use SimpleSAML\SAML2\XML\md\IDPSSODescriptor; -use SimpleSAML\SAML2\XML\md\Organization; -use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; -use SimpleSAML\SAML2\XML\md\OrganizationName; -use SimpleSAML\SAML2\XML\md\OrganizationURL; -use SimpleSAML\SAML2\XML\md\PDPDescriptor; -use SimpleSAML\SAML2\XML\md\SingleSignOnService; -use SimpleSAML\SAML2\XML\md\UnknownRoleDescriptor; -use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; -use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; +use SimpleSAML\SAML2\Type\{ + SAMLAnyURIValue, + SAMLDateTimeValue, + EmailAddressValue, + EntityIDValue, + SAMLStringValue, +}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractSignedMdElement, + AdditionalMetadataLocation, + AffiliateMember, + AffiliationDescriptor, + AttributeAuthorityDescriptor, + AttributeService, + AuthnAuthorityDescriptor, + AuthnQueryService, + AuthzService, + ContactPerson, + EmailAddress, + EntityDescriptor, + Extensions, + IDPSSODescriptor, + Organization, + OrganizationDisplayName, + OrganizationName, + OrganizationURL, + PDPDescriptor, + SingleSignOnService, + UnknownRoleDescriptor, +}; +use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, UsagePolicy}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\{MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{DurationValue, IDValue, LanguageValue, StringValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; -use function str_pad; use function strval; /** @@ -86,17 +89,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); - $entityid = C::ENTITY_IDP; - $id = "_5A3CHB081"; - $now = 1580895565; - $duration = "P2Y6M5DT12H35M30S"; + $entityid = EntityIDValue::fromString(C::ENTITY_IDP); + $id = IDValue::fromString("_5A3CHB081"); + $duration = DurationValue::fromString("P2Y6M5DT12H35M30S"); $idpssod = new IDPSSODescriptor( [ new SingleSignOnService( - C::BINDING_HTTP_REDIRECT, - 'https://engine.test.example.edu/authentication/idp/single-sign-on', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString('https://engine.test.example.edu/authentication/idp/single-sign-on'), ), ], [C::NS_SAMLP], @@ -104,8 +106,8 @@ public function testMarshalling(): void $attrad = new AttributeAuthorityDescriptor( [ new AttributeService( - C::BINDING_SOAP, - 'https://idp.example.org/AttributeService', + SAMLAnyURIValue::fromString(C::BINDING_SOAP), + SAMLAnyURIValue::fromString('https://idp.example.org/AttributeService'), ), ], [C::NS_SAMLP], @@ -113,8 +115,8 @@ public function testMarshalling(): void $authnad = new AuthnAuthorityDescriptor( [ new AuthnQueryService( - C::BINDING_HTTP_REDIRECT, - 'http://www.example.com/aqs', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString('http://www.example.com/aqs'), ), ], [C::NS_SAMLP], @@ -122,47 +124,85 @@ public function testMarshalling(): void $pdpd = new PDPDescriptor( [ new AuthzService( - C::BINDING_SOAP, - 'https://IdentityProvider.com/SAML/AA/SOAP', + SAMLAnyURIValue::fromString(C::BINDING_SOAP), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/AA/SOAP'), ), ], [C::NS_SAMLP], ); $org = new Organization( - [new OrganizationName('en', 'orgNameTest (en)')], - [new OrganizationDisplayName('en', 'orgDispNameTest (en)')], - [new OrganizationURL('en', 'https://IdentityProvider.com')], + [ + new OrganizationName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('orgNameTest (en)'), + ), + ], + [ + new OrganizationDisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('orgDispNameTest (en)'), + ), + ], + [ + new OrganizationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://IdentityProvider.com'), + ), + ], ); $contacts = [ new ContactPerson( - contactType: 'support', - emailAddress: [new EmailAddress('help@example.edu')], + contactType: SAMLStringValue::fromString('support'), + emailAddress: [ + new EmailAddress( + EmailAddressValue::fromString('help@example.edu'), + ), + ], ), new ContactPerson( - contactType: 'technical', - emailAddress: [new EmailAddress('root@example.edu')], + contactType: SAMLStringValue::fromString('technical'), + emailAddress: [ + new EmailAddress( + EmailAddressValue::fromString('root@example.edu'), + ), + ], ), new ContactPerson( - contactType: 'administrative', - emailAddress: [new EmailAddress('info@example.edu')], + contactType: SAMLStringValue::fromString('administrative'), + emailAddress: [ + new EmailAddress( + EmailAddressValue::fromString('info@example.edu'), + ), + ], ), ]; $mdloc = [ - new AdditionalMetadataLocation(C::NAMESPACE, 'https://example.edu/some/metadata.xml'), - new AdditionalMetadataLocation(C::NAMESPACE, 'https://example.edu/more/metadata.xml'), + new AdditionalMetadataLocation( + SAMLAnyURIValue::fromString(C::NAMESPACE), + SAMLAnyURIValue::fromString('https://example.edu/some/metadata.xml'), + ), + new AdditionalMetadataLocation( + SAMLAnyURIValue::fromString(C::NAMESPACE), + SAMLAnyURIValue::fromString('https://example.edu/more/metadata.xml'), + ), ]; $extensions = new Extensions([ new PublicationInfo( - publisher: 'http://publisher.ra/', - creationInstant: new DateTimeImmutable('2020-02-03T13:46:24Z'), - usagePolicy: [new UsagePolicy('en', 'http://publisher.ra/policy.txt')], + publisher: SAMLStringValue::fromString('http://publisher.ra/'), + creationInstant: SAMLDateTimeValue::fromString('2020-02-03T13:46:24Z'), + usagePolicy: [ + new UsagePolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://publisher.ra/policy.txt'), + ), + ], ), ]); $ed = new EntityDescriptor( entityId: $entityid, id: $id, - validUntil: new DateTimeImmutable('2020-02-05T09:39:25Z'), + validUntil: SAMLDateTimeValue::fromString('2020-02-05T09:39:25Z'), cacheDuration: $duration, extensions: $extensions, roleDescriptor: [ @@ -229,45 +269,90 @@ public function testMarshallingWithAffiliationDescriptor(): void , ); - $entityid = C::ENTITY_IDP; - $id = "_5A3CHB081"; - $duration = "P2Y6M5DT12H35M30S"; - $ad = new AffiliationDescriptor(C::ENTITY_IDP, [new AffiliateMember(C::ENTITY_OTHER)]); + $entityid = EntityIDValue::fromString(C::ENTITY_IDP); + $id = IDValue::fromString("_5A3CHB081"); + $duration = DurationValue::fromString("P2Y6M5DT12H35M30S"); + $ad = new AffiliationDescriptor( + $entityid, + [ + new AffiliateMember( + EntityIDValue::fromString(C::ENTITY_OTHER), + ), + ], + ); $org = new Organization( - [new OrganizationName('en', 'orgNameTest (en)')], - [new OrganizationDisplayName('en', 'orgDispNameTest (en)')], - [new OrganizationURL('en', 'https://IdentityProvider.com')], + [ + new OrganizationName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('orgNameTest (en)'), + ), + ], + [ + new OrganizationDisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('orgDispNameTest (en)'), + ), + ], + [ + new OrganizationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://IdentityProvider.com'), + ), + ], ); $contacts = [ new ContactPerson( - contactType: 'support', - emailAddress: [new EmailAddress('help@example.edu')], + contactType: SAMLStringValue::fromString('support'), + emailAddress: [ + new EmailAddress( + EmailAddressValue::fromString('help@example.edu'), + ), + ], ), new ContactPerson( - contactType: 'technical', - emailAddress: [new EmailAddress('root@example.edu')], + contactType: SAMLStringValue::fromString('technical'), + emailAddress: [ + new EmailAddress( + EmailAddressValue::fromString('root@example.edu'), + ), + ], ), new ContactPerson( - contactType: 'administrative', - emailAddress: [new EmailAddress('info@example.edu')], + contactType: SAMLStringValue::fromString('administrative'), + emailAddress: [ + new EmailAddress( + EmailAddressValue::fromString('info@example.edu'), + ), + ], ), ]; $mdloc = [ - new AdditionalMetadataLocation(C::NAMESPACE, 'https://example.edu/some/metadata.xml'), - new AdditionalMetadataLocation(C::NAMESPACE, 'https://example.edu/more/metadata.xml'), + new AdditionalMetadataLocation( + SAMLAnyURIValue::fromString(C::NAMESPACE), + SAMLAnyURIValue::fromString('https://example.edu/some/metadata.xml'), + ), + new AdditionalMetadataLocation( + SAMLAnyURIValue::fromString(C::NAMESPACE), + SAMLAnyURIValue::fromString('https://example.edu/more/metadata.xml'), + ), ]; $extensions = new Extensions([ new PublicationInfo( - publisher: 'http://publisher.ra/', - creationInstant: new DateTimeImmutable('2020-02-03T13:46:24Z'), - usagePolicy: [new UsagePolicy('en', 'http://publisher.ra/policy.txt')], + publisher: SAMLStringValue::fromString('http://publisher.ra/'), + creationInstant: SAMLDateTimeValue::fromString('2020-02-03T13:46:24Z'), + usagePolicy: [ + new UsagePolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://publisher.ra/policy.txt'), + ), + ], ), ]); $ed = new EntityDescriptor( entityId: $entityid, id: $id, - validUntil: new DateTimeImmutable('2020-02-05T09:39:25Z'), + validUntil: SAMLDateTimeValue::fromString('2020-02-05T09:39:25Z'), cacheDuration: $duration, extensions: $extensions, affiliationDescriptor: $ad, @@ -275,10 +360,10 @@ public function testMarshallingWithAffiliationDescriptor(): void contactPerson: $contacts, additionalMetadataLocation: $mdloc, ); - $this->assertEquals($entityid, $ed->getEntityID()); - $this->assertEquals($id, $ed->getID()); - $this->assertEquals('2020-02-05T09:39:25Z', $ed->getValidUntil()->format(C::DATETIME_FORMAT)); - $this->assertEquals($duration, $ed->getCacheDuration()); + $this->assertEquals($entityid, $ed->getEntityID()->getValue()); + $this->assertEquals($id, $ed->getID()->getValue()); + $this->assertEquals('2020-02-05T09:39:25Z', $ed->getValidUntil()->getValue()); + $this->assertEquals($duration, $ed->getCacheDuration()->getValue()); $this->assertEmpty($ed->getRoleDescriptor()); $this->assertInstanceOf(AffiliationDescriptor::class, $ed->getAffiliationDescriptor()); $this->assertEquals( @@ -297,7 +382,9 @@ public function testMarshallingWithoutDescriptors(): void $this->expectExceptionMessage( 'Must have either one of the RoleDescriptors or an AffiliationDescriptor in EntityDescriptor.', ); - new EntityDescriptor(C::ENTITY_SP); + new EntityDescriptor( + EntityIDValue::fromString(C::ENTITY_SP), + ); } @@ -307,7 +394,14 @@ public function testMarshallingWithoutDescriptors(): void public function testMarshallingWithAffiliationAndRoleDescriptors(): void { $xmlRepresentation = clone self::$xmlRepresentation; - $affiliationDescriptor = new AffiliationDescriptor(C::ENTITY_IDP, [new AffiliateMember(C::ENTITY_SP)]); + $affiliationDescriptor = new AffiliationDescriptor( + EntityIDValue::fromString(C::ENTITY_IDP), + [ + new AffiliateMember( + EntityIDValue::fromString(C::ENTITY_SP), + ), + ], + ); $affiliationDescriptor->toXML($xmlRepresentation->documentElement); $this->expectException(ProtocolViolationException::class); @@ -319,36 +413,6 @@ public function testMarshallingWithAffiliationAndRoleDescriptors(): void } - /** - * Test that creating an EntityDescriptor from scratch fails if an empty entityID is provided. - */ - public function testMarshallingWithEmptyEntityID(): void - { - $this->expectException(ProtocolViolationException::class); - new EntityDescriptor( - entityId: '', - affiliationDescriptor: new AffiliationDescriptor(C::ENTITY_IDP, [new AffiliateMember(C::ENTITY_SP)]), - ); - } - - - /** - * Test that creating an EntityDescriptor from scratch with a very long entityID fails. - */ - public function testMarshallingWithLongEntityID(): void - { - $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage( - sprintf('An entityID cannot be longer than %d characters.', C::ENTITYID_MAX_LENGTH), - ); - - new EntityDescriptor( - entityId: str_pad('urn:x-simplesamlphp:', C::ENTITYID_MAX_LENGTH + 1, 'a'), - affiliationDescriptor: new AffiliationDescriptor(C::ENTITY_IDP, [new AffiliateMember(C::ENTITY_OTHER)]), - ); - } - - // test unmarshalling @@ -367,7 +431,7 @@ public function testUnmarshalling(): void 'urn:x-simplesamlphp:namespace', ); - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', 'ssp:UnknownRoleDescriptor'); + $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptor')); $type->toXML($customd); $newline = new DOMText("\n "); @@ -394,7 +458,7 @@ public function testUnmarshalling(): void ); $this->assertEquals(C::ENTITY_IDP, $entityDescriptor->getEntityID()); $this->assertEquals('_5A3CHB081', $entityDescriptor->getID()); - $this->assertEquals('2020-02-05T09:39:25Z', $entityDescriptor->getValidUntil()->format(C::DATETIME_FORMAT)); + $this->assertEquals('2020-02-05T09:39:25Z', $entityDescriptor->getValidUntil()->getValue()); $this->assertEquals('P2Y6M5DT12H35M30S', $entityDescriptor->getCacheDuration()); $roleDescriptors = $entityDescriptor->getRoleDescriptor(); @@ -478,30 +542,6 @@ public function testUnmarshallingWithoutDescriptors(): void } - /** - * Test that creating an EntityDescriptor from XML fails with an invalid validUntil attribute. - */ - public function testUnmarshallingWithInvalidValidUntil(): void - { - $entity_idp = C::ENTITY_IDP; - $entity_sp = C::ENTITY_SP; - - $document = DOMDocumentFactory::fromString( - << - - {$entity_sp} - - -XML - , - ); - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('\'asdf\' is not a valid xs:dateTime'); - EntityDescriptor::fromXML($document->documentElement); - } - - /** * Test that creating an EntityDescriptor from XML works when an AffiliationDescriptor is used. */ diff --git a/tests/SAML2/XML/md/ExtensionsTest.php b/tests/SAML2/XML/md/ExtensionsTest.php index 1c661be949..205d0cfcf3 100644 --- a/tests/SAML2/XML/md/ExtensionsTest.php +++ b/tests/SAML2/XML/md/ExtensionsTest.php @@ -4,33 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\alg\DigestMethod; -use SimpleSAML\SAML2\XML\alg\SigningMethod; -use SimpleSAML\SAML2\XML\emd\RepublishRequest; -use SimpleSAML\SAML2\XML\emd\RepublishTarget; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, CIDRValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\alg\{DigestMethod, SigningMethod}; +use SimpleSAML\SAML2\XML\emd\{RepublishRequest, RepublishTarget}; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, Extensions}; use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; -use SimpleSAML\SAML2\XML\mdrpi\Publication; -use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; -use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; -use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; -use SimpleSAML\SAML2\XML\mdui\DiscoHints; -use SimpleSAML\SAML2\XML\mdui\DisplayName; -use SimpleSAML\SAML2\XML\mdui\IPHint; -use SimpleSAML\SAML2\XML\mdui\UIInfo; +use SimpleSAML\SAML2\XML\mdrpi\{Publication, PublicationInfo, PublicationPath, RegistrationInfo}; +use SimpleSAML\SAML2\XML\mdui\{DiscoHints, DisplayName, IPHint, UIInfo}; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\SAML2\XML\shibmd\Scope; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue, UnsignedShortValue}; use function dirname; use function strval; @@ -71,20 +61,51 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $scope = new Scope('SomeScope'); - $ra = new RegistrationInfo('SomeAuthority'); - $pubInfo = new PublicationInfo('SomePublisher'); + $scope = new Scope( + SAMLStringValue::fromString('SomeScope'), + ); + $ra = new RegistrationInfo( + SAMLStringValue::fromString('SomeAuthority'), + ); + $pubInfo = new PublicationInfo( + SAMLStringValue::fromString('SomePublisher'), + ); $pubPath = new PublicationPath( [ - new Publication('SomePublisher'), + new Publication( + SAMLStringValue::fromString('SomePublisher'), + ), ], ); - $uiinfo = new UIInfo([new DisplayName('en', 'Example')]); - $idpdisc = new DiscoveryResponse(1, C::NS_IDPDISC, 'https://example.org/authenticate/sp'); - $discoHints = new DiscoHints([], [new IPHint('127.0.0.1')]); - $digestMethod = new DigestMethod(C::DIGEST_SHA256); - $signingMethod = new SigningMethod(C::SIG_RSA_SHA256, 1024, 4096); - $republishRequest = new RepublishRequest(new RepublishTarget('http://edugain.org/')); + $uiinfo = new UIInfo([ + new DisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Example'), + ), + ]); + $idpdisc = new DiscoveryResponse( + UnsignedShortValue::fromInteger(1), + SAMLAnyURIValue::fromString(C::NS_IDPDISC), + SAMLAnyURIValue::fromString('https://example.org/authenticate/sp'), + ); + $discoHints = new DiscoHints([], [ + new IPHint( + CIDRValue::fromString('127.0.0.0/8'), + ), + ]); + $digestMethod = new DigestMethod( + SAMLAnyURIValue::fromString(C::DIGEST_SHA256), + ); + $signingMethod = new SigningMethod( + SAMLAnyURIValue::fromString(C::SIG_RSA_SHA256), + PositiveIntegerValue::fromInteger(1024), + PositiveIntegerValue::fromInteger(4096), + ); + $republishRequest = new RepublishRequest( + new RepublishTarget( + SAMLAnyURIValue::fromString('http://edugain.org/'), + ), + ); $extensions = new Extensions([ $scope, @@ -174,7 +195,7 @@ public function testUnmarshalling(): void Example - 127.0.0.1 + 127.0.0.0/8 assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/IDPSSODescriptorTest.php b/tests/SAML2/XML/md/IDPSSODescriptorTest.php index b009c066c9..e5d7a6ee05 100644 --- a/tests/SAML2/XML/md/IDPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/IDPSSODescriptorTest.php @@ -4,35 +4,36 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; -use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; -use SimpleSAML\SAML2\XML\md\AttributeProfile; -use SimpleSAML\SAML2\XML\md\IDPSSODescriptor; -use SimpleSAML\SAML2\XML\md\KeyDescriptor; -use SimpleSAML\SAML2\XML\md\ManageNameIDService; -use SimpleSAML\SAML2\XML\md\NameIDFormat; -use SimpleSAML\SAML2\XML\md\NameIDMappingService; -use SimpleSAML\SAML2\XML\md\SingleLogoutService; -use SimpleSAML\SAML2\XML\md\SingleSignOnService; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, KeyTypesValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractRoleDescriptor, + AbstractRoleDescriptorType, + AbstractSignedMdElement, + ArtifactResolutionService, + AssertionIDRequestService, + AttributeProfile, + IDPSSODescriptor, + KeyDescriptor, + KeyTypesEnum, + ManageNameIDService, + NameIDFormat, + NameIDMappingService, + SingleLogoutService, + SingleSignOnService, +}; +use SimpleSAML\SAML2\XML\saml\{Attribute, AttributeValue}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, IDValue, UnsignedShortValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -77,53 +78,57 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $idpssod = new IDPSSODescriptor( - ID: 'phpunit', + ID: IDValue::fromString('phpunit'), singleSignOnService: [ new SingleSignOnService( - C::BINDING_HTTP_REDIRECT, - 'https://IdentityProvider.com/SAML/SSO/Browser', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), new SingleSignOnService( - C::BINDING_HTTP_POST, - 'https://IdentityProvider.com/SAML/SSO/Browser', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), ], protocolSupportEnumeration: [C::NS_SAMLP], - wantAuthnRequestsSigned: true, + wantAuthnRequestsSigned: BooleanValue::fromBoolean(true), nameIDMappingService: [ new NameIDMappingService( - C::BINDING_HTTP_REDIRECT, - 'https://IdentityProvider.com/SAML/SSO/Browser', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), new NameIDMappingService( - C::BINDING_HTTP_POST, - 'https://IdentityProvider.com/SAML/SSO/Browser', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), ], assertionIDRequestService: [ new AssertionIDRequestService( - C::BINDING_HTTP_REDIRECT, - 'https://IdentityProvider.com/SAML/SSO/Browser', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), new AssertionIDRequestService( - C::BINDING_HTTP_POST, - 'https://IdentityProvider.com/SAML/SSO/Browser', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), ], attributeProfile: [ - new AttributeProfile('urn:attribute:profile1'), - new AttributeProfile('urn:attribute:profile2'), + new AttributeProfile( + SAMLAnyURIValue::fromString('urn:attribute:profile1'), + ), + new AttributeProfile( + SAMLAnyURIValue::fromString('urn:attribute:profile2'), + ), ], attribute: [ new Attribute( - 'urn:oid:1.3.6.1.4.1.5923.1.1.1.6', - C::NAMEFORMAT_URI, - 'eduPersonPrincipalName', + SAMLStringValue::fromString('urn:oid:1.3.6.1.4.1.5923.1.1.1.6'), + SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + SAMLStringValue::fromString('eduPersonPrincipalName'), ), new Attribute( - 'urn:oid:1.3.6.1.4.1.5923.1.1.1.1', - C::NAMEFORMAT_URI, - 'eduPersonAffiliation', + SAMLStringValue::fromString('urn:oid:1.3.6.1.4.1.5923.1.1.1.1'), + SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + SAMLStringValue::fromString('eduPersonAffiliation'), [ new AttributeValue('member'), new AttributeValue('student'), @@ -135,41 +140,49 @@ public function testMarshalling(): void ], keyDescriptor: [ new KeyDescriptor( - new KeyInfo( - [new KeyName('IdentityProvider.com SSO Key')], - ), - 'signing', + new KeyInfo([ + new KeyName( + SAMLStringValue::fromString('IdentityProvider.com SSO Key'), + ), + ]), + KeyTypesValue::fromEnum(KeyTypesEnum::SIGNING), ), ], artifactResolutionService: [ new ArtifactResolutionService( - 0, - C::BINDING_SOAP, - 'https://IdentityProvider.com/SAML/Artifact', - true, + UnsignedShortValue::fromInteger(0), + SAMLAnyURIValue::fromString(C::BINDING_SOAP), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/Artifact'), + BooleanValue::fromBoolean(true), ), ], singleLogoutService: [ new SingleLogoutService( - C::BINDING_SOAP, - 'https://IdentityProvider.com/SAML/SLO/SOAP', + SAMLAnyURIValue::fromString(C::BINDING_SOAP), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SLO/SOAP'), ), new SingleLogoutService( - C::BINDING_HTTP_REDIRECT, - 'https://IdentityProvider.com/SAML/SLO/Browser', - 'https://IdentityProvider.com/SAML/SLO/Response', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SLO/Browser'), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SLO/Response'), ), ], manageNameIDService: [ new ManageNameIDService( - C::BINDING_HTTP_POST, - 'https://IdentityProvider.com/SAML/SSO/Browser', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), ], nameIDFormat: [ - new NameIDFormat(C::NAMEID_X509_SUBJECT_NAME), - new NameIDFormat(C::NAMEID_PERSISTENT), - new NameIDFormat(C::NAMEID_TRANSIENT), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_X509_SUBJECT_NAME), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), ], ); @@ -200,26 +213,17 @@ public function testMarshallingWithoutProtocolSupportThrowsException(): void $this->expectExceptionMessage('At least one protocol must be supported by this md:IDPSSODescriptor.'); new IDPSSODescriptor( - [new SingleSignOnService(C::BINDING_HTTP_POST, C::LOCATION_A)], + [ + new SingleSignOnService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ), + ], [], ); } - /** - * Test that creating an IDPSSODescriptor from scratch fails if an empty AttributeProfile is provided. - */ - public function testMarshallingWithEmptyAttributeProfile(): void - { - $this->expectException(ProtocolViolationException::class); - new IDPSSODescriptor( - singleSignOnService: [new SingleSignOnService(C::BINDING_HTTP_POST, C::LOCATION_A)], - protocolSupportEnumeration: [C::NS_SAMLP], - attributeProfile: [new AttributeProfile('profile1'), new AttributeProfile('')], - ); - } - - /** * Test that creating an IDPSSODescriptor from scratch works if no optional arguments are provided. */ @@ -227,8 +231,14 @@ public function testMarshallingWithoutOptionalArguments(): void { $idpssod = new IDPSSODescriptor( [ - new SingleSignOnService(C::BINDING_HTTP_POST, C::LOCATION_A), - new SingleSignOnService(C::BINDING_HTTP_REDIRECT, C::LOCATION_B), + new SingleSignOnService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ), + new SingleSignOnService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString(C::LOCATION_B), + ), ], [C::NS_SAMLP, C::PROTOCOL], ); @@ -259,23 +269,6 @@ public function testUnmarshallingWithoutSingleSignOnService(): void } - /** - * Test that creating an IDPSSODescriptor from XML fails if WantAuthnRequestsSigned is not boolean. - */ - public function testUnmarshallingWithWrongWantAuthnRequestsSigned(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->setAttribute('WantAuthnRequestsSigned', 'not a boolean'); - - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage( - 'The \'WantAuthnRequestsSigned\' attribute of md:IDPSSODescriptor must be a boolean.', - ); - - IDPSSODescriptor::fromXML($xmlRepresentation->documentElement); - } - - /** * Test that creating an IDPSSODescriptor from XML fails if an empty AttributeProfile is provided. */ diff --git a/tests/SAML2/XML/md/IndexedEndpointTypeTest.php b/tests/SAML2/XML/md/IndexedEndpointTypeTest.php index 470e3dada8..ab26025f35 100644 --- a/tests/SAML2/XML/md/IndexedEndpointTypeTest.php +++ b/tests/SAML2/XML/md/IndexedEndpointTypeTest.php @@ -4,20 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; -use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; -use SimpleSAML\SAML2\XML\md\AssertionConsumerService; +use SimpleSAML\SAML2\XML\md\{ + AbstractIndexedEndpointType, + AbstractMdElement, + ArtifactResolutionService, + AssertionConsumerService, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\MissingAttributeException; +use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\Type\UnsignedShortValue; use function dirname; use function sprintf; @@ -56,7 +56,11 @@ public static function setUpBeforeClass(): void public function testMarshallingWithoutIsDefault(string $class, string $xmlRepresentation): void { $binding = ($class === DiscoveryResponse::class) ? C::BINDING_IDPDISC : C::BINDING_HTTP_POST; - $idxep = new $class(42, $binding, C::LOCATION_A); + $idxep = new $class( + UnsignedShortValue::fromInteger(42), + SAMLAnyURIValue::fromString($binding), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ); $this->assertNull($idxep->getIsDefault()); } @@ -79,7 +83,7 @@ public function testUnmarshallingWithNumericString(string $class, string $xmlRep $xmlRepresentation->documentElement->setAttribute('index', '+0000000000000000000005'); $endpoint = $class::fromXML($xmlRepresentation->documentElement); - $this->assertEquals(5, $endpoint->getIndex()); + $this->assertEquals(5, $endpoint->getIndex()->toInteger()); } @@ -126,31 +130,6 @@ public function testUnmarshallingWithoutIndex(string $class, string $xmlRepresen } - /** - * Test that creating an IndexedEndpointType from XML with a non-numeric index fails. - * - * @param class-string $class - * @param string $xmlRepresentation - */ - #[DataProvider('classProvider')] - public function testUnmarshallingWithWrongIndex(string $class, string $xmlRepresentation): void - { - $xmlRepresentation = DOMDocumentFactory::fromFile( - self::$resourcePath . $xmlRepresentation, - ); - $xmlRepresentation->documentElement->setAttribute('index', 'value'); - - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage(sprintf( - 'The \'index\' attribute of %s:%s must be numerical.', - $class::getNamespacePrefix(), - $class::getLocalName(), - )); - - $class::fromXML($xmlRepresentation->documentElement); - } - - /** * Test that creating an IndexedEndpointType from XML without isDefault works. * @@ -170,31 +149,6 @@ public function testUnmarshallingWithoutIsDefault(string $class, string $xmlRepr } - /** - * Test that creating an IndexedEndpointType from XML with isDefault of a non-boolean value fails. - * - * @param class-string $class - * @param string $xmlRepresentation - */ - #[DataProvider('classProvider')] - public function testUnmarshallingWithWrongIsDefault(string $class, string $xmlRepresentation): void - { - $xmlRepresentation = DOMDocumentFactory::fromFile( - self::$resourcePath . $xmlRepresentation, - ); - $xmlRepresentation->documentElement->setAttribute('isDefault', 'non-bool'); - - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage(sprintf( - 'The \'isDefault\' attribute of %s:%s must be a boolean.', - $class::getNamespacePrefix(), - $class::getLocalName(), - )); - - $class::fromXML($xmlRepresentation->documentElement); - } - - /** */ public static function classProvider(): array diff --git a/tests/SAML2/XML/md/KeyDescriptorTest.php b/tests/SAML2/XML/md/KeyDescriptorTest.php index a0c629b400..7e10f9edbb 100644 --- a/tests/SAML2/XML/md/KeyDescriptorTest.php +++ b/tests/SAML2/XML/md/KeyDescriptorTest.php @@ -4,18 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\EncryptionMethod; -use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, KeyTypesValue}; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EncryptionMethod, KeyDescriptor, KeyTypesEnum}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -55,9 +52,17 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $kd = new KeyDescriptor( - new KeyInfo([new KeyName('IdentityProvider.com SSO Key')]), - 'signing', - [new EncryptionMethod('http://www.w3.org/2001/04/xmlenc#rsa-1_5')], + new KeyInfo([ + new KeyName( + StringValue::fromString('IdentityProvider.com SSO Key'), + ), + ]), + KeyTypesValue::fromEnum(KeyTypesEnum::SIGNING), + [ + new EncryptionMethod( + SAMLAnyURIValue::fromString('http://www.w3.org/2001/04/xmlenc#rsa-1_5'), + ), + ], ); $this->assertEquals( @@ -67,27 +72,18 @@ public function testMarshalling(): void } - /** - * Test that creating a KeyDescriptor from scratch with a wrong use fails. - */ - public function testMarshallingWrongUse(): void - { - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('The "use" attribute of a KeyDescriptor can only be "encryption" or "signing".'); - - new KeyDescriptor( - new KeyInfo([new KeyName('IdentityProvider.com SSO Key')]), - 'wrong', - ); - } - - /** * Test that creating a KeyDescriptor from scratch without any optional argument works. */ public function testMarshallingWithoutOptionalParameters(): void { - $kd = new KeyDescriptor(new KeyInfo([new KeyName('IdentityProvider.com SSO Key')])); + $kd = new KeyDescriptor( + new KeyInfo([ + new KeyName( + StringValue::fromString('IdentityProvider.com SSO Key'), + ), + ]), + ); $this->assertNull($kd->getUse()); $this->assertEmpty($kd->getEncryptionMethod()); @@ -117,8 +113,8 @@ public function testUnmarshallingWithWrongUse(): void $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->setAttribute('use', 'wrong'); - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('The "use" attribute of a KeyDescriptor can only be "encryption" or "signing".'); + $this->expectException(SchemaViolationException::class); + $this->expectExceptionMessage('Expected one of: "signing", "encryption". Got: "wrong"'); KeyDescriptor::fromXML($xmlRepresentation->documentElement); } diff --git a/tests/SAML2/XML/md/NameIDFormatTest.php b/tests/SAML2/XML/md/NameIDFormatTest.php index 9df3b5b217..58b60a5b83 100644 --- a/tests/SAML2/XML/md/NameIDFormatTest.php +++ b/tests/SAML2/XML/md/NameIDFormatTest.php @@ -4,15 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\NameIDFormat; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, NameIDFormat}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +48,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $nameIdFormat = new NameIDFormat(C::NAMEID_PERSISTENT); + $nameIdFormat = new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/NameIDMappingServiceTest.php b/tests/SAML2/XML/md/NameIDMappingServiceTest.php index 349c5eb0a2..eed5b984ef 100644 --- a/tests/SAML2/XML/md/NameIDMappingServiceTest.php +++ b/tests/SAML2/XML/md/NameIDMappingServiceTest.php @@ -4,16 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\SAML2\XML\md\NameIDMappingService; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -52,7 +51,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $nidmsep = new NameIDMappingService(C::BINDING_HTTP_POST, C::LOCATION_A); + $nidmsep = new NameIDMappingService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -70,7 +72,12 @@ public function testMarshallingWithResponseLocation(): void $this->expectExceptionMessage( 'The \'ResponseLocation\' attribute must be omitted for md:NameIDMappingService.', ); - new NameIDMappingService(C::BINDING_HTTP_POST, C::LOCATION_A, 'https://response.location/'); + + new NameIDMappingService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + SAMLAnyURIValue::fromString('https://response.location/'), + ); } diff --git a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php index 3dd660e894..3a389dd8e7 100644 --- a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php +++ b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php @@ -4,16 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, OrganizationDisplayName}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -56,7 +53,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new OrganizationDisplayName('en', 'Identity Providers R US, a Division of Lerxst Corp.'); + $name = new OrganizationDisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US, a Division of Lerxst Corp.'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/OrganizationNameTest.php b/tests/SAML2/XML/md/OrganizationNameTest.php index 9a7de991a5..e45e54f7ba 100644 --- a/tests/SAML2/XML/md/OrganizationNameTest.php +++ b/tests/SAML2/XML/md/OrganizationNameTest.php @@ -4,16 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\OrganizationName; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, OrganizationName}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -56,7 +53,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new OrganizationName('en', 'Identity Providers R US'); + $name = new OrganizationName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/OrganizationTest.php b/tests/SAML2/XML/md/OrganizationTest.php index 015f48a33e..e15bd716bd 100644 --- a/tests/SAML2/XML/md/OrganizationTest.php +++ b/tests/SAML2/XML/md/OrganizationTest.php @@ -5,22 +5,22 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\Extensions; -use SimpleSAML\SAML2\XML\md\Organization; -use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; -use SimpleSAML\SAML2\XML\md\OrganizationName; -use SimpleSAML\SAML2\XML\md\OrganizationURL; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + Extensions, + Organization, + OrganizationDisplayName, + OrganizationName, + OrganizationURL, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{LanguageValue, StringValue}; use function dirname; use function strval; @@ -84,15 +84,30 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $org = new Organization( - [new OrganizationName('en', 'Identity Providers R US')], - [new OrganizationDisplayName('en', 'Identity Providers R US, a Division of Lerxst Corp.')], - [new OrganizationURL('en', 'https://IdentityProvider.com')], + [ + new OrganizationName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US'), + ), + ], + [ + new OrganizationDisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US, a Division of Lerxst Corp.'), + ), + ], + [ + new OrganizationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://IdentityProvider.com'), + ), + ], new Extensions( [ new Chunk(self::$ext->documentElement), ], ), - [new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1')], + [new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'))], ); $this->assertEquals( diff --git a/tests/SAML2/XML/md/OrganizationURLTest.php b/tests/SAML2/XML/md/OrganizationURLTest.php index e6decbacfd..c2ad5ad02c 100644 --- a/tests/SAML2/XML/md/OrganizationURLTest.php +++ b/tests/SAML2/XML/md/OrganizationURLTest.php @@ -4,17 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\OrganizationURL; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI, AbstractMdElement, OrganizationURL}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -58,7 +54,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new OrganizationURL('en', 'https://IdentityProvider.com'); + $name = new OrganizationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://IdentityProvider.com'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/PDPDescriptorTest.php b/tests/SAML2/XML/md/PDPDescriptorTest.php index a04a6441ed..6dad7ae230 100644 --- a/tests/SAML2/XML/md/PDPDescriptorTest.php +++ b/tests/SAML2/XML/md/PDPDescriptorTest.php @@ -4,23 +4,25 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; -use SimpleSAML\SAML2\XML\md\AuthzService; -use SimpleSAML\SAML2\XML\md\NameIDFormat; -use SimpleSAML\SAML2\XML\md\PDPDescriptor; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractRoleDescriptor, + AbstractRoleDescriptorType, + AbstractSignedMdElement, + AssertionIDRequestService, + AuthzService, + NameIDFormat, + PDPDescriptor, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -63,13 +65,13 @@ public static function setUpBeforeClass(): void ); self::$authzService = new AuthzService( - C::BINDING_SOAP, - 'https://IdentityProvider.com/SAML/AA/SOAP', + SAMLAnyURIValue::fromString(C::BINDING_SOAP), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/AA/SOAP'), ); self::$assertionIDRequestService = new AssertionIDRequestService( - C::BINDING_URI, - 'https://IdentityProvider.com/SAML/AA/URI', + SAMLAnyURIValue::fromString(C::BINDING_URI), + SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/AA/URI'), ); } @@ -87,11 +89,17 @@ public function testMarshalling(): void ["urn:oasis:names:tc:SAML:2.0:protocol"], [self::$assertionIDRequestService], [ - new NameIDFormat(C::NAMEID_X509_SUBJECT_NAME), - new NameIDFormat(C::NAMEID_PERSISTENT), - new NameIDFormat(C::NAMEID_TRANSIENT), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_X509_SUBJECT_NAME), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_PERSISTENT), + ), + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), ], - 'phpunit', + IDValue::fromString('phpunit'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/md/RequestedAttributeTest.php b/tests/SAML2/XML/md/RequestedAttributeTest.php index 44da963ccf..f86074b536 100644 --- a/tests/SAML2/XML/md/RequestedAttributeTest.php +++ b/tests/SAML2/XML/md/RequestedAttributeTest.php @@ -4,17 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\RequestedAttribute; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, RequestedAttribute}; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\BooleanValue; use function dirname; use function strval; @@ -54,11 +52,13 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $ra = new RequestedAttribute( - 'attr', - true, - C::NAMEFORMAT_BASIC, - 'Attribute', - [new AttributeValue('value1')], + SAMLStringValue::fromString('attr'), + BooleanValue::fromBoolean(true), + SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), + SAMLStringValue::fromString('Attribute'), + [ + new AttributeValue('value1'), + ], ); $this->assertEquals( @@ -73,8 +73,10 @@ public function testMarshalling(): void */ public function testMarshallingWithoutOptionalArguments(): void { - $ra = new RequestedAttribute('attr'); - $this->assertEquals('attr', $ra->getName()); + $ra = new RequestedAttribute( + SAMLStringValue::fromString('attr'), + ); + $this->assertEquals('attr', $ra->getName()->getValue()); $this->assertNull($ra->getIsRequired()); $this->assertNull($ra->getNameFormat()); $this->assertNull($ra->getFriendlyName()); diff --git a/tests/SAML2/XML/md/RoleDescriptorTest.php b/tests/SAML2/XML/md/RoleDescriptorTest.php index 4d002064e3..c25836ad43 100644 --- a/tests/SAML2/XML/md/RoleDescriptorTest.php +++ b/tests/SAML2/XML/md/RoleDescriptorTest.php @@ -4,42 +4,47 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\Company; -use SimpleSAML\SAML2\XML\md\ContactPerson; -use SimpleSAML\SAML2\XML\md\EmailAddress; -use SimpleSAML\SAML2\XML\md\EncryptionMethod; -use SimpleSAML\SAML2\XML\md\Extensions; -use SimpleSAML\SAML2\XML\md\GivenName; -use SimpleSAML\SAML2\XML\md\KeyDescriptor; -use SimpleSAML\SAML2\XML\md\Organization; -use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; -use SimpleSAML\SAML2\XML\md\OrganizationName; -use SimpleSAML\SAML2\XML\md\OrganizationURL; -use SimpleSAML\SAML2\XML\md\SurName; -use SimpleSAML\SAML2\XML\md\TelephoneNumber; -use SimpleSAML\SAML2\XML\md\UnknownRoleDescriptor; +use SimpleSAML\SAML2\Type\{ + SAMLAnyURIValue, + SAMLDateTimeValue, + EmailAddressValue, + KeyTypesValue, + SAMLStringValue, +}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractRoleDescriptor, + AbstractRoleDescriptorType, + AbstractSignedMdElement, + Company, + ContactPerson, + EmailAddress, + EncryptionMethod, + Extensions, + GivenName, + KeyDescriptor, + KeyTypesEnum, + Organization, + OrganizationDisplayName, + OrganizationName, + OrganizationURL, + SurName, + TelephoneNumber, + UnknownRoleDescriptor, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\Test\SAML2\CustomRoleDescriptor; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{AnyURIValue, DurationValue, IDValue, LanguageValue, StringValue}; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -86,14 +91,6 @@ public static function setUpBeforeClass(): void } - public function setUp(): void - { - self::$xmlRepresentation = DOMDocumentFactory::fromFile( - dirname(dirname(dirname(dirname(__FILE__)))) . '/resources/xml/md_RoleDescriptor.xml', - ); - } - - /** */ public static function tearDownAfterClass(): void @@ -109,9 +106,9 @@ public static function tearDownAfterClass(): void */ public function testMarshalling(): void { - $attr_cp_1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr_cp_2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); - $attr_3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'phpunit', 'test'); + $attr_cp_1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr_cp_2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); + $attr_3 = new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'phpunit', StringValue::fromString('test')); $roleDescriptor = new CustomRoleDescriptor( [ @@ -120,47 +117,94 @@ public function testMarshalling(): void )->documentElement), ], [C::NS_SAMLP, C::PROTOCOL], - 'TheID', - new DateTimeImmutable('2009-02-13T23:31:30Z'), - 'PT5000S', - new Extensions([new Chunk( - DOMDocumentFactory::fromString( - 'Some', - )->documentElement, - )]), - 'https://error.reporting/', + IDValue::fromString('TheID'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + DurationValue::fromString('PT5000S'), + new Extensions([ + new Chunk( + DOMDocumentFactory::fromString( + 'Some', + )->documentElement, + ), + ]), + SAMLAnyURIValue::fromString('https://error.reporting/'), [ new KeyDescriptor( - new KeyInfo([new KeyName('IdentityProvider.com SSO Signing Key')]), - 'signing', + new KeyInfo([ + new KeyName( + StringValue::fromString('IdentityProvider.com SSO Signing Key'), + ), + ]), + KeyTypesValue::fromEnum(KeyTypesEnum::SIGNING), ), new KeyDescriptor( - new KeyInfo([new KeyName('IdentityProvider.com SSO Encryption Key')]), - 'encryption', - [new EncryptionMethod(C::KEY_TRANSPORT_OAEP_MGF1P)], + new KeyInfo([ + new KeyName( + StringValue::fromString('IdentityProvider.com SSO Encryption Key'), + ), + ]), + KeyTypesValue::fromEnum(KeyTypesEnum::ENCRYPTION), + [ + new EncryptionMethod( + AnyURIValue::fromString(C::KEY_TRANSPORT_OAEP_MGF1P), + ), + ], ), ], new Organization( - [new OrganizationName('en', 'Identity Providers R US')], - [new OrganizationDisplayName('en', 'Identity Providers R US, a Division of Lerxst Corp.')], - [new OrganizationURL('en', 'https://IdentityProvider.com')], + [ + new OrganizationName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US'), + ), + ], + [ + new OrganizationDisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US, a Division of Lerxst Corp.'), + ), + ], + [ + new OrganizationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://IdentityProvider.com'), + ), + ], ), [ new ContactPerson( - contactType: 'other', - company: new Company('Test Company'), - givenName: new GivenName('John'), - surName: new SurName('Doe'), + contactType: SAMLStringValue::fromString('other'), + company: new Company( + SAMLStringValue::fromString('Test Company'), + ), + givenName: new GivenName( + SAMLStringValue::fromString('John'), + ), + surName: new SurName( + SAMLStringValue::fromString('Doe'), + ), emailAddress: [ - new EmailAddress('mailto:jdoe@test.company'), - new EmailAddress('mailto:john.doe@test.company'), + new EmailAddress( + EmailAddressValue::fromString('mailto:jdoe@test.company'), + ), + new EmailAddress( + EmailAddressValue::fromString('mailto:john.doe@test.company'), + ), + ], + telephoneNumber: [ + new TelephoneNumber( + SAMLStringValue::fromString('1-234-567-8901'), + ), ], - telephoneNumber: [new TelephoneNumber('1-234-567-8901')], namespacedAttribute: [$attr_cp_1, $attr_cp_2], ), new ContactPerson( - contactType: 'technical', - telephoneNumber: [new TelephoneNumber('1-234-567-8901')], + contactType: SAMLStringValue::fromString('technical'), + telephoneNumber: [ + new TelephoneNumber( + SAMLStringValue::fromString('1-234-567-8901'), + ), + ], ), ], [$attr_3], @@ -183,7 +227,7 @@ public function testUnmarshalling(): void { $descriptor = AbstractRoleDescriptor::fromXML(self::$xmlRepresentation->documentElement); - $this->assertInstanceOf(CustomRoleDescriptor::class, $descriptor); + $this->assertInstanceOf(AbstractRoleDescriptor::class, $descriptor); $this->assertCount(2, $descriptor->getKeyDescriptor()); $this->assertInstanceOf(KeyDescriptor::class, $descriptor->getKeyDescriptor()[0]); $this->assertInstanceOf(KeyDescriptor::class, $descriptor->getKeyDescriptor()[1]); @@ -196,9 +240,9 @@ public function testUnmarshalling(): void $this->assertInstanceOf(ContactPerson::class, $descriptor->getContactPerson()[0]); $this->assertInstanceOf(ContactPerson::class, $descriptor->getContactPerson()[1]); $this->assertEquals('TheID', $descriptor->getID()); - $this->assertEquals('2009-02-13T23:31:30Z', $descriptor->getValidUntil()->format(C::DATETIME_FORMAT)); - $this->assertEquals('PT5000S', $descriptor->getCacheDuration()); - $this->assertEquals('https://error.reporting/', $descriptor->getErrorURL()); + $this->assertEquals('2009-02-13T23:31:30Z', $descriptor->getValidUntil()->getValue()); + $this->assertEquals('PT5000S', $descriptor->getCacheDuration()->getValue()); + $this->assertEquals('https://error.reporting/', $descriptor->getErrorURL()->getValue()); $extElement = $descriptor->getExtensions(); $this->assertInstanceOf(Extensions::class, $extElement); @@ -220,12 +264,8 @@ public function testUnmarshalling(): void */ public function testUnmarshallingUnregistered(): void { - $element = self::$xmlRepresentation->documentElement; - $element->setAttributeNS( - 'http://www.w3.org/2000/xmlns/', - 'xmlns:ssp', - 'urn:x-simplesamlphp:namespace', - ); + $element = clone self::$xmlRepresentation->documentElement; + $element->setAttributeNS(C::NS_XSI, 'xsi:type', 'ssp:UnknownRoleDescriptorType'); $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', 'ssp:UnknownRoleDescriptorType'); $type->toXML($element); @@ -244,10 +284,10 @@ public function testUnmarshallingUnregistered(): void $this->assertCount(2, $descriptor->getContactPerson()); $this->assertInstanceOf(ContactPerson::class, $descriptor->getContactPerson()[0]); $this->assertInstanceOf(ContactPerson::class, $descriptor->getContactPerson()[1]); - $this->assertEquals('TheID', $descriptor->getID()); - $this->assertEquals('2009-02-13T23:31:30Z', $descriptor->getValidUntil()->format(C::DATETIME_FORMAT)); - $this->assertEquals('PT5000S', $descriptor->getCacheDuration()); - $this->assertEquals('https://error.reporting/', $descriptor->getErrorURL()); + $this->assertEquals('TheID', $descriptor->getID()->getValue()); + $this->assertEquals('2009-02-13T23:31:30Z', $descriptor->getValidUntil()->getValue()); + $this->assertEquals('PT5000S', $descriptor->getCacheDuration()->getValue()); + $this->assertEquals('https://error.reporting/', $descriptor->getErrorURL()->getValue()); $chunk = $descriptor->getRawRoleDescriptor(); $this->assertEquals('md', $chunk->getPrefix()); @@ -263,7 +303,7 @@ public function testUnmarshallingUnregistered(): void $this->assertEquals('urn:x-simplesamlphp:namespace', $extensions[0]->getNamespaceURI()); $this->assertEquals('Chunk', $extensions[0]->getLocalName()); - $this->assertEquals($element->ownerDocument->saveXML($element), strval($chunk)); + $this->assertEquals($element->ownerDocument?->saveXML($element), strval($descriptor)); } @@ -272,14 +312,15 @@ public function testUnmarshallingUnregistered(): void */ public function testUnmarshallingWithoutSupportedProtocols(): void { - self::$xmlRepresentation->documentElement->removeAttribute('protocolSupportEnumeration'); + $element = clone self::$xmlRepresentation->documentElement; + $element->removeAttribute('protocolSupportEnumeration'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage( 'Missing \'protocolSupportEnumeration\' attribute on md:RoleDescriptor.', ); - UnknownRoleDescriptor::fromXML(self::$xmlRepresentation->documentElement); + UnknownRoleDescriptor::fromXML($element); } @@ -288,23 +329,11 @@ public function testUnmarshallingWithoutSupportedProtocols(): void */ public function testUnmarshallingWithEmptySupportedProtocols(): void { - self::$xmlRepresentation->documentElement->setAttribute('protocolSupportEnumeration', ''); - - $this->expectException(ProtocolViolationException::class); - - UnknownRoleDescriptor::fromXML(self::$xmlRepresentation->documentElement); - } - - - /** - * Test that creating an UnknownRoleDescriptor from XML fails if errorURL is not a valid URL. - */ - public function testUnmarshallingWithInvalidErrorURL(): void - { - self::$xmlRepresentation->documentElement->setAttribute('errorURL', 'not a URL'); + $element = clone self::$xmlRepresentation->documentElement; + $element->setAttribute('protocolSupportEnumeration', ''); $this->expectException(ProtocolViolationException::class); - UnknownRoleDescriptor::fromXML(self::$xmlRepresentation->documentElement); + UnknownRoleDescriptor::fromXML($element); } } diff --git a/tests/SAML2/XML/md/SPSSODescriptorTest.php b/tests/SAML2/XML/md/SPSSODescriptorTest.php index 6d6b96d2ac..2531eb9cf5 100644 --- a/tests/SAML2/XML/md/SPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/SPSSODescriptorTest.php @@ -4,43 +4,44 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; -use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; -use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; -use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; -use SimpleSAML\SAML2\XML\md\AssertionConsumerService; -use SimpleSAML\SAML2\XML\md\AttributeConsumingService; -use SimpleSAML\SAML2\XML\md\ContactPerson; -use SimpleSAML\SAML2\XML\md\EmailAddress; -use SimpleSAML\SAML2\XML\md\Extensions; -use SimpleSAML\SAML2\XML\md\KeyDescriptor; -use SimpleSAML\SAML2\XML\md\ManageNameIDService; -use SimpleSAML\SAML2\XML\md\NameIDFormat; -use SimpleSAML\SAML2\XML\md\Organization; -use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; -use SimpleSAML\SAML2\XML\md\OrganizationName; -use SimpleSAML\SAML2\XML\md\OrganizationURL; -use SimpleSAML\SAML2\XML\md\RequestedAttribute; -use SimpleSAML\SAML2\XML\md\ServiceName; -use SimpleSAML\SAML2\XML\md\SingleLogoutService; -use SimpleSAML\SAML2\XML\md\SPSSODescriptor; -use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; -use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EmailAddressValue, KeyTypesValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{ + AbstractMdElement, + AbstractMetadataDocument, + AbstractRoleDescriptor, + AbstractRoleDescriptorType, + AbstractSignedMdElement, + ArtifactResolutionService, + AssertionConsumerService, + AttributeConsumingService, + ContactPerson, + EmailAddress, + Extensions, + KeyDescriptor, + KeyTypesEnum, + ManageNameIDService, + NameIDFormat, + Organization, + OrganizationDisplayName, + OrganizationName, + OrganizationURL, + RequestedAttribute, + ServiceName, + SingleLogoutService, + SPSSODescriptor, +}; +use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, UsagePolicy}; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, DurationValue, IDValue, LanguageValue, StringValue, UnsignedShortValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -85,80 +86,136 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $slo1 = new SingleLogoutService( - C::BINDING_SOAP, - 'https://ServiceProvider.com/SAML/SLO/SOAP', + SAMLAnyURIValue::fromString(C::BINDING_SOAP), + SAMLAnyURIValue::fromString('https://ServiceProvider.com/SAML/SLO/SOAP'), ); $slo2 = new SingleLogoutService( - C::BINDING_HTTP_REDIRECT, - 'https://ServiceProvider.com/SAML/SLO/Browser', - 'https://ServiceProvider.com/SAML/SLO/Response', + SAMLAnyURIValue::fromString(C::BINDING_HTTP_REDIRECT), + SAMLAnyURIValue::fromString('https://ServiceProvider.com/SAML/SLO/Browser'), + SAMLAnyURIValue::fromString('https://ServiceProvider.com/SAML/SLO/Response'), ); $acs1 = new AssertionConsumerService( - 0, - C::BINDING_HTTP_ARTIFACT, - 'https://ServiceProvider.com/SAML/SSO/Artifact', - true, + UnsignedShortValue::fromInteger(0), + SAMLAnyURIValue::fromString(C::BINDING_HTTP_ARTIFACT), + SAMLAnyURIValue::fromString('https://ServiceProvider.com/SAML/SSO/Artifact'), + BooleanValue::fromBoolean(true), ); $acs2 = new AssertionConsumerService( - 1, - C::BINDING_HTTP_POST, - 'https://ServiceProvider.com/SAML/SSO/POST', + UnsignedShortValue::fromInteger(1), + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString('https://ServiceProvider.com/SAML/SSO/POST'), ); $reqAttr = new RequestedAttribute( - Name: 'urn:oid:1.3.6.1.4.1.5923.1.1.1.7', - NameFormat: C::NAMEFORMAT_URI, - FriendlyName: 'eduPersonEntitlement', - AttributeValues: [new AttributeValue('https://ServiceProvider.com/entitlements/123456789')], + Name: SAMLStringValue::fromString('urn:oid:1.3.6.1.4.1.5923.1.1.1.7'), + NameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + FriendlyName: SAMLStringValue::fromString('eduPersonEntitlement'), + AttributeValues: [ + new AttributeValue( + 'https://ServiceProvider.com/entitlements/123456789', + ), + ], ); $attrcs1 = new AttributeConsumingService( - 0, - [new ServiceName('en', 'Academic Journals R US')], + UnsignedShortValue::fromInteger(0), + [ + new ServiceName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US'), + ), + ], [$reqAttr], - true, + BooleanValue::fromBoolean(true), ); $attrcs2 = new AttributeConsumingService( - 1, - [new ServiceName('en', 'Academic Journals R US')], + UnsignedShortValue::fromInteger(1), + [ + new ServiceName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US'), + ), + ], [$reqAttr], ); $extensions = new Extensions([ new PublicationInfo( - publisher: 'http://publisher.ra/', - creationInstant: new DateTimeImmutable('2020-02-03T13:46:24Z'), - usagePolicy: [new UsagePolicy('en', 'http://publisher.ra/policy.txt')], + publisher: SAMLStringValue::fromString('http://publisher.ra/'), + creationInstant: SAMLDateTimeValue::fromString('2020-02-03T13:46:24Z'), + usagePolicy: [ + new UsagePolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://publisher.ra/policy.txt'), + ), + ], ), ]); - $kd = new KeyDescriptor(new KeyInfo([new KeyName('ServiceProvider.com SSO Key')]), 'signing'); + $kd = new KeyDescriptor( + new KeyInfo([ + new KeyName( + StringValue::fromString('ServiceProvider.com SSO Key'), + ), + ]), + KeyTypesValue::fromEnum(KeyTypesEnum::SIGNING), + ); $org = new Organization( - [new OrganizationName('en', 'Identity Providers R US')], - [new OrganizationDisplayName('en', 'Identity Providers R US, a Division of Lerxst Corp.')], - [new OrganizationURL('en', 'https://IdentityProvider.com')], + [ + new OrganizationName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US'), + ), + ], + [ + new OrganizationDisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Identity Providers R US, a Division of Lerxst Corp.'), + ), + ], + [ + new OrganizationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://IdentityProvider.com'), + ), + ], ); $contact = new ContactPerson( - contactType: 'other', - emailAddress: [new EmailAddress('john.doe@test.company')], + contactType: SAMLStringValue::fromString('other'), + emailAddress: [ + new EmailAddress( + EmailAddressValue::fromString('john.doe@test.company'), + ), + ], + ); + $ars = new ArtifactResolutionService( + UnsignedShortValue::fromInteger(0), + SAMLAnyURIValue::fromString(C::BINDING_HTTP_ARTIFACT), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ); + $mnids = new ManageNameIDService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_B), ); - $ars = new ArtifactResolutionService(0, C::BINDING_HTTP_ARTIFACT, C::LOCATION_A); - $mnids = new ManageNameIDService(C::BINDING_HTTP_POST, C::LOCATION_B); $spssod = new SPSSODescriptor( [$acs1, $acs2], [C::NS_SAMLP], - true, - false, + BooleanValue::fromBoolean(true), + BooleanValue::fromBoolean(false), [$attrcs1, $attrcs2], - 'someID', - new DateTimeImmutable('2010-02-01T12:34:56Z'), - 'PT9000S', + IDValue::fromString('someID'), + SAMLDateTimeValue::fromString('2010-02-01T12:34:56Z'), + DurationValue::fromString('PT9000S'), $extensions, - 'https://error.url/', + SAMLAnyURIValue::fromString('https://error.url/'), [$kd], $org, [$contact], [$ars], [$slo1, $slo2], [$mnids], - [new NameIDFormat(C::NAMEID_TRANSIENT)], + [ + new NameIDFormat( + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), + ], ); $this->assertEquals( @@ -189,7 +246,13 @@ public function testMarshallingWithoutAssertionConsumerService(): void public function testMarshallingWithoutOptionalArguments(): void { $spssod = new SPSSODescriptor( - [new AssertionConsumerService(0, C::BINDING_HTTP_POST, C::LOCATION_A)], + [ + new AssertionConsumerService( + UnsignedShortValue::fromInteger(0), + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ), + ], [C::NS_SAMLP], ); @@ -228,9 +291,7 @@ public function testUnmarshallingWithNonBooleanAuthnRequestsSigned(): void $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->setAttribute('AuthnRequestsSigned', 'not a boolean'); - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('The \'AuthnRequestsSigned\' attribute of md:SPSSODescriptor must be a boolean.'); - + $this->expectException(SchemaViolationException::class); SPSSODescriptor::fromXML($xmlRepresentation->documentElement); } @@ -243,11 +304,7 @@ public function testUnmarshallingWithNonBooleanWantAssertionsSigned(): void $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->setAttribute('WantAssertionsSigned', 'not a boolean'); - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage( - 'The \'WantAssertionsSigned\' attribute of md:SPSSODescriptor must be a boolean.', - ); - + $this->expectException(SchemaViolationException::class); SPSSODescriptor::fromXML($xmlRepresentation->documentElement); } diff --git a/tests/SAML2/XML/md/ServiceDescriptionTest.php b/tests/SAML2/XML/md/ServiceDescriptionTest.php index 9073457ea8..84b660f23f 100644 --- a/tests/SAML2/XML/md/ServiceDescriptionTest.php +++ b/tests/SAML2/XML/md/ServiceDescriptionTest.php @@ -4,16 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\ServiceDescription; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceDescription}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -56,7 +53,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new ServiceDescription('en', 'Academic Journals R US and only us'); + $name = new ServiceDescription( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US and only us'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/ServiceNameTest.php b/tests/SAML2/XML/md/ServiceNameTest.php index abd7928e71..c4cb2fcced 100644 --- a/tests/SAML2/XML/md/ServiceNameTest.php +++ b/tests/SAML2/XML/md/ServiceNameTest.php @@ -4,19 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\ServiceName; +use SimplesAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceName}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\MissingAttributeException; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -59,7 +55,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new ServiceName('en', 'Academic Journals R US'); + $name = new ServiceName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Academic Journals R US'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -68,18 +67,6 @@ public function testMarshalling(): void } - /** - * Test that creating a ServiceName from scratch with an empty language fails. - */ - public function testMarshallingWithEmptyLang(): void - { - $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage('Expected a non-whitespace string. Got: ""'); - - new ServiceName('', 'Academic Journals R US'); - } - - // test unmarshalling @@ -91,24 +78,9 @@ public function testUnmarshallingWithoutLang(): void $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->removeAttributeNS(C::NS_XML, 'lang'); - $this->expectException(AssertionFailedException::class); + $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing xml:lang from ServiceName'); ServiceName::fromXML($xmlRepresentation->documentElement); } - - - /** - * Test that creating a ServiceName from XML fails when xml:lang is empty. - */ - public function testUnmarshallingWithEmptyLang(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->setAttributeNS(C::NS_XML, 'lang', ''); - - $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage('Expected a non-whitespace string. Got: ""'); - - ServiceName::fromXML($xmlRepresentation->documentElement); - } } diff --git a/tests/SAML2/XML/md/SingleSignOnServiceTest.php b/tests/SAML2/XML/md/SingleSignOnServiceTest.php index fb0270489d..3d80a88085 100644 --- a/tests/SAML2/XML/md/SingleSignOnServiceTest.php +++ b/tests/SAML2/XML/md/SingleSignOnServiceTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\SingleSignOnService; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, SingleSignOnService}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -52,7 +50,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $ssoep = new SingleSignOnService(C::BINDING_HTTP_POST, C::LOCATION_A); + $ssoep = new SingleSignOnService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -66,12 +67,16 @@ public function testMarshalling(): void */ public function testMarshallingWithResponseLocation(): void { - $this->expectException(AssertionFailedException::class); + $this->expectException(ProtocolViolationException::class); $this->expectExceptionMessage( 'The \'ResponseLocation\' attribute must be omitted for md:SingleSignOnService.', ); - new SingleSignOnService(C::BINDING_HTTP_POST, C::LOCATION_A, 'https://response.location/'); + new SingleSignOnService( + SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST), + SAMLAnyURIValue::fromString(C::LOCATION_A), + SAMLAnyURIValue::fromString('https://response.location/'), + ); } @@ -86,7 +91,7 @@ public function testUnmarshallingWithResponseLocation(): void $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->setAttribute('ResponseLocation', 'https://response.location/'); - $this->expectException(AssertionFailedException::class); + $this->expectException(ProtocolViolationException::class); $this->expectExceptionMessage( 'The \'ResponseLocation\' attribute must be omitted for md:SingleSignOnService.', ); diff --git a/tests/SAML2/XML/md/SurNameTest.php b/tests/SAML2/XML/md/SurNameTest.php index 7b643fec59..3d190349af 100644 --- a/tests/SAML2/XML/md/SurNameTest.php +++ b/tests/SAML2/XML/md/SurNameTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\SurName; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, SurName}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +48,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new SurName('Doe'); + $name = new SurName( + SAMLStringValue::fromString('Doe'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/md/TelephoneNumberTest.php b/tests/SAML2/XML/md/TelephoneNumberTest.php index 1cad009148..d805ff8b97 100644 --- a/tests/SAML2/XML/md/TelephoneNumberTest.php +++ b/tests/SAML2/XML/md/TelephoneNumberTest.php @@ -4,18 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; -use SimpleSAML\SAML2\XML\md\TelephoneNumber; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractMdElement, TelephoneNumber}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; /** - * Tests for SurName. + * Tests for TelephoneNumber. * * @package simplesamlphp/saml2 */ @@ -47,11 +44,13 @@ public static function setUpBeforeClass(): void /** - * Test creating a TelehponeNumber object from scratch. + * Test creating a TelephoneNumber object from scratch. */ public function testMarshalling(): void { - $name = new TelephoneNumber('+1234567890'); + $name = new TelephoneNumber( + SAMLStringValue::fromString('+1234567890'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdattr/EntityAttributesTest.php b/tests/SAML2/XML/mdattr/EntityAttributesTest.php index 04bf98a8a8..523d07623f 100644 --- a/tests/SAML2/XML/mdattr/EntityAttributesTest.php +++ b/tests/SAML2/XML/mdattr/EntityAttributesTest.php @@ -4,26 +4,26 @@ namespace SimpleSAML\Test\SAML2\XML\mdattr; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\mdattr\AbstractMdattrElement; -use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeStatement; -use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\AudienceRestriction; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\mdattr\{AbstractMdattrElement, EntityAttributes}; +use SimpleSAML\SAML2\XML\saml\{ + Assertion, + Attribute, + AttributeStatement, + AttributeValue, + Audience, + AudienceRestriction, + Conditions, + Issuer, + NameID, + Subject, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -61,8 +61,8 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $attribute1 = new Attribute( - name: 'attrib1', - nameFormat: C::NAMEFORMAT_BASIC, + name: SAMLStringValue::fromString('attrib1'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), attributeValue: [ new AttributeValue('is'), new AttributeValue('really'), @@ -71,15 +71,21 @@ public function testMarshalling(): void ); // Create an Issuer - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); // Create the conditions $conditions = new Conditions( condition: [], audienceRestriction: [ new AudienceRestriction([ - new Audience(C::ENTITY_IDP), - new Audience(C::ENTITY_URN), + new Audience( + SAMLAnyURIValue::fromString(C::ENTITY_IDP), + ), + new Audience( + SAMLAnyURIValue::fromString(C::ENTITY_URN), + ), ]), ], ); @@ -87,31 +93,31 @@ public function testMarshalling(): void // Create the statements $attrStatement = new AttributeStatement([ new Attribute( - name: 'urn:mace:dir:attribute-def:uid', - nameFormat: C::NAMEFORMAT_URI, + name: SAMLStringValue::fromString('urn:mace:dir:attribute-def:uid'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), attributeValue: [ new AttributeValue('student2'), ], ), new Attribute( - name: 'urn:mace:terena.org:attribute-def:schacHomeOrganization', - nameFormat: C::NAMEFORMAT_URI, + name: SAMLStringValue::fromString('urn:mace:terena.org:attribute-def:schacHomeOrganization'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), attributeValue: [ new AttributeValue('university.example.org'), new AttributeValue('bbb.cc'), ], ), new Attribute( - name: 'urn:schac:attribute-def:schacPersonalUniqueCode', - nameFormat: C::NAMEFORMAT_URI, + name: SAMLStringValue::fromString('urn:schac:attribute-def:schacPersonalUniqueCode'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), attributeValue: [ new AttributeValue('urn:schac:personalUniqueCode:nl:local:uvt.nl:memberid:524020'), new AttributeValue('urn:schac:personalUniqueCode:nl:local:surfnet.nl:studentid:12345'), ], ), new Attribute( - name: 'urn:mace:dir:attribute-def:eduPersonAffiliation', - nameFormat: C::NAMEFORMAT_URI, + name: SAMLStringValue::fromString('urn:mace:dir:attribute-def:eduPersonAffiliation'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), attributeValue: [ new AttributeValue('member'), new AttributeValue('student'), @@ -119,16 +125,18 @@ public function testMarshalling(): void ), ]); - $subject = new Subject(new NameID( - value: 'some:entity', - Format: C::NAMEID_ENTITY, - )); + $subject = new Subject( + new NameID( + value: SAMLStringValue::fromString('some:entity'), + Format: SAMLAnyURIValue::FromString(C::NAMEID_ENTITY), + ), + ); // Create an assertion $unsignedAssertion = new Assertion( $issuer, - new DateTimeImmutable('2024-07-23T20:35:34Z'), - '_93af655219464fb403b34436cfb0c5cb1d9a5502', + SAMLDateTimeValue::fromString('2024-07-23T20:35:34Z'), + IDValue::fromString('_93af655219464fb403b34436cfb0c5cb1d9a5502'), $subject, $conditions, [$attrStatement], @@ -143,8 +151,8 @@ public function testMarshalling(): void $signedAssertion = Assertion::fromXML($unsignedAssertion->toXML()); $attribute2 = new Attribute( - name: 'foo', - nameFormat: 'urn:simplesamlphp:v1:simplesamlphp', + name: SAMLStringValue::fromString('foo'), + nameFormat: SAMLAnyURIValue::fromString('urn:simplesamlphp:v1:simplesamlphp'), attributeValue: [ new AttributeValue('is'), new AttributeValue('really'), diff --git a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php index 849ff1303f..6daf0a6248 100644 --- a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php @@ -4,19 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use DOMDocument; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; -use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; -use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{AffiliationDescriptor, EntitiesDescriptor, EntityDescriptor, Extensions}; +use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, PublicationInfo, UsagePolicy}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -35,6 +33,9 @@ final class PublicationInfoTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMDocument */ + private static DOMDocument $affiliationDescriptor; + /** */ @@ -46,6 +47,10 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/mdrpi_PublicationInfo.xml', ); + self::$affiliationDescriptor = DOMDocumentFactory::fromFile( + dirname(__FILE__, 4) . '/resources/xml/md_AffiliationDescriptor.xml', + ); + self::$arrayRepresentation = [ 'publisher' => 'SomePublisher', 'creationInstant' => '2011-01-01T00:00:00Z', @@ -60,12 +65,18 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $publicationInfo = new PublicationInfo( - 'SomePublisher', - new DateTimeImmutable('2011-01-01T00:00:00Z'), - 'SomePublicationId', + SAMLStringValue::fromString('SomePublisher'), + SAMLDateTimeValue::fromString('2011-01-01T00:00:00Z'), + SAMLStringValue::fromString('SomePublicationId'), [ - new UsagePolicy('en', 'http://TheEnglishUsagePolicy'), - new UsagePolicy('no', 'http://TheNorwegianUsagePolicy'), + new UsagePolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://TheEnglishUsagePolicy'), + ), + new UsagePolicy( + LanguageValue::fromString('no'), + SAMLAnyURIValue::fromString('http://TheNorwegianUsagePolicy'), + ), ], ); @@ -84,10 +95,6 @@ public function testCreationInstantTimezoneNotZuluThrowsException(): void $document->setAttribute('creationInstant', '2011-01-01T00:00:00WT'); $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage( - "\"2011-01-01T00:00:00WT\" is not a DateTime expressed in the UTC timezone" - . " using the 'Z' timezone identifier.", - ); PublicationInfo::fromXML($document); } @@ -119,7 +126,10 @@ public function testMultipleUsagePoliciesWithSameLanguageThrowsException(): void $document = clone self::$xmlRepresentation->documentElement; // Append another 'en' UsagePolicy to the document - $x = new UsagePolicy('en', 'https://example.org'); + $x = new UsagePolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://example.org'), + ); $x->toXML($document); $this->expectException(ProtocolViolationException::class); @@ -129,4 +139,29 @@ public function testMultipleUsagePoliciesWithSameLanguageThrowsException(): void ); PublicationInfo::fromXML($document); } + + + /** + */ + public function testNestedPublicationInfoThrowsException(): void + { + $publicationInfo = PublicationInfo::fromXML(self::$xmlRepresentation->documentElement); + $extensions = new Extensions([$publicationInfo]); + + $ed = new EntityDescriptor( + entityId: EntityIDValue::fromString('urn:x-simplesamlphp:entity'), + affiliationDescriptor: AffiliationDescriptor::fromXML(self::$affiliationDescriptor->documentElement), + ); + + $this->expectException(ProtocolViolationException::class); + new EntitiesDescriptor( + extensions: $extensions, + entitiesDescriptors: [ + new EntitiesDescriptor( + extensions: $extensions, + entityDescriptors: [$ed], + ), + ], + ); + } } diff --git a/tests/SAML2/XML/mdrpi/PublicationPathTest.php b/tests/SAML2/XML/mdrpi/PublicationPathTest.php index ed1bfef074..c4e297e570 100644 --- a/tests/SAML2/XML/mdrpi/PublicationPathTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationPathTest.php @@ -4,17 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; -use SimpleSAML\SAML2\XML\mdrpi\Publication; -use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; +use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, Publication, PublicationPath}; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -64,11 +59,15 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $publicationPath = new PublicationPath([ - new Publication('SomePublisher', new DateTimeImmutable('2011-01-01T00:00:00Z'), 'SomePublicationId'), new Publication( - 'SomeOtherPublisher', - new DateTimeImmutable('2011-01-01T00:00:00Z'), - 'SomeOtherPublicationId', + SAMLStringValue::fromString('SomePublisher'), + SAMLDateTimeValue::fromString('2011-01-01T00:00:00Z'), + SAMLStringValue::fromString('SomePublicationId'), + ), + new Publication( + SAMLStringValue::fromString('SomeOtherPublisher'), + SAMLDateTimeValue::fromString('2011-01-01T00:00:00Z'), + SAMLStringValue::fromString('SomeOtherPublicationId'), ), ]); diff --git a/tests/SAML2/XML/mdrpi/PublicationTest.php b/tests/SAML2/XML/mdrpi/PublicationTest.php index 08f6ef11b4..821219f42e 100644 --- a/tests/SAML2/XML/mdrpi/PublicationTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationTest.php @@ -4,18 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; -use SimpleSAML\SAML2\XML\mdrpi\Publication; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, Publication}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -58,9 +54,9 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $publication = new Publication( - 'SomePublisher', - new DateTimeImmutable('2011-01-01T00:00:00Z'), - 'SomePublicationId', + SAMLStringValue::fromString('SomePublisher'), + SAMLDateTimeValue::fromString('2011-01-01T00:00:00Z'), + SAMLStringValue::fromString('SomePublicationId'), ); $this->assertEquals( @@ -78,10 +74,6 @@ public function testCreationInstantTimezoneNotZuluThrowsException(): void $document->setAttribute('creationInstant', '2011-01-01T00:00:00WT'); $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage( - "\"2011-01-01T00:00:00WT\" is not a DateTime expressed in the UTC timezone " - . "using the 'Z' timezone identifier.", - ); Publication::fromXML($document); } diff --git a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php index 4981463824..d428770a4b 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php @@ -4,19 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use DOMDocument; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; -use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; -use SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\md\{AffiliationDescriptor, EntitiesDescriptor, EntityDescriptor, Extensions}; +use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, RegistrationInfo, RegistrationPolicy}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -35,6 +33,9 @@ final class RegistrationInfoTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMDocument */ + private static DOMDocument $affiliationDescriptor; + /** */ @@ -46,6 +47,10 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/mdrpi_RegistrationInfo.xml', ); + self::$affiliationDescriptor = DOMDocumentFactory::fromFile( + dirname(__FILE__, 4) . '/resources/xml/md_AffiliationDescriptor.xml', + ); + self::$arrayRepresentation = [ 'registrationAuthority' => 'https://ExampleAuthority', 'registrationInstant' => '2011-01-01T00:00:00Z', @@ -62,11 +67,17 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $registrationInfo = new RegistrationInfo( - 'https://ExampleAuthority', - new DateTimeImmutable('2009-02-13T23:31:30Z'), + SAMLStringValue::fromString('https://ExampleAuthority'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), [ - new RegistrationPolicy('en', 'http://www.example.org/aai/metadata/en_registration.html'), - new RegistrationPolicy('de', 'http://www.example.org/aai/metadata/de_registration.html'), + new RegistrationPolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://www.example.org/aai/metadata/en_registration.html'), + ), + new RegistrationPolicy( + LanguageValue::fromString('de'), + SAMLAnyURIValue::fromString('http://www.example.org/aai/metadata/de_registration.html'), + ), ], ); @@ -98,15 +109,21 @@ public function testMissingPublisherThrowsException(): void /** */ - public function testRegistrationInstantTimezoneNotZuluThrowsException(): void + public function testMultipleRegistrationPoliciesWithSameLanguageThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->setAttribute('registrationInstant', '2011-01-01T00:00:00WT'); + + // Append another 'en' RegistrationPolicy to the document + $x = new RegistrationPolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://example.org'), + ); + $x->toXML($document); $this->expectException(ProtocolViolationException::class); $this->expectExceptionMessage( - "\"2011-01-01T00:00:00WT\" is not a DateTime expressed in the UTC timezone " - . "using the 'Z' timezone identifier.", + 'There MUST NOT be more than one ,' + . ' within a given , for a given language', ); RegistrationInfo::fromXML($document); } @@ -114,19 +131,25 @@ public function testRegistrationInstantTimezoneNotZuluThrowsException(): void /** */ - public function testMultipleRegistrationPoliciesWithSameLanguageThrowsException(): void + public function testNestedRegistrationInfoThrowsException(): void { - $document = clone self::$xmlRepresentation->documentElement; + $registrationInfo = RegistrationInfo::fromXML(self::$xmlRepresentation->documentElement); + $extensions = new Extensions([$registrationInfo]); - // Append another 'en' RegistrationPolicy to the document - $x = new RegistrationPolicy('en', 'https://example.org'); - $x->toXML($document); + $ed = new EntityDescriptor( + entityId: EntityIDValue::fromString('urn:x-simplesamlphp:entity'), + affiliationDescriptor: AffiliationDescriptor::fromXML(self::$affiliationDescriptor->documentElement), + ); $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage( - 'There MUST NOT be more than one ,' - . ' within a given , for a given language', + new EntitiesDescriptor( + extensions: $extensions, + entitiesDescriptors: [ + new EntitiesDescriptor( + extensions: $extensions, + entityDescriptors: [$ed], + ), + ], ); - RegistrationInfo::fromXML($document); } } diff --git a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php index c855176742..b6d5c8b541 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; -use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; -use SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI}; +use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, RegistrationPolicy}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -56,7 +54,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new RegistrationPolicy('en', 'http://www.example.edu/en/'); + $name = new RegistrationPolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://www.example.edu/en/'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php index 4e9f732bf3..25167177e3 100644 --- a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php +++ b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; -use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; -use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI}; +use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, UsagePolicy}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -56,7 +54,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new UsagePolicy('en', 'http://www.example.edu/en/'); + $name = new UsagePolicy( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://www.example.edu/en/'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdui/DescriptionTest.php b/tests/SAML2/XML/mdui/DescriptionTest.php index 1e956819aa..7ff5647932 100644 --- a/tests/SAML2/XML/mdui/DescriptionTest.php +++ b/tests/SAML2/XML/mdui/DescriptionTest.php @@ -4,15 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement}; use SimpleSAML\SAML2\XML\mdui\Description; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -54,7 +53,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new Description('en', 'Just an example'); + $name = new Description( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Just an example'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdui/DiscoHintsTest.php b/tests/SAML2/XML/mdui/DiscoHintsTest.php index d3a453a871..6c5e546294 100644 --- a/tests/SAML2/XML/mdui/DiscoHintsTest.php +++ b/tests/SAML2/XML/mdui/DiscoHintsTest.php @@ -4,21 +4,21 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; +use SimpleSAML\SAML2\Type\{CIDRValue, DomainValue, GeolocationValue, ListOfStringsValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; -use SimpleSAML\SAML2\XML\mdui\DiscoHints; -use SimpleSAML\SAML2\XML\mdui\DomainHint; -use SimpleSAML\SAML2\XML\mdui\GeolocationHint; -use SimpleSAML\SAML2\XML\mdui\IPHint; -use SimpleSAML\SAML2\XML\mdui\Keywords; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\SAML2\XML\mdui\{ + AbstractMduiElement, + DiscoHints, + DomainHint, + GeolocationHint, + IPHint, + Keywords, +}; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -62,11 +62,29 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $discoHints = new DiscoHints( - ipHint: [new IPHint("130.59.0.0/16"), new IPHint("2001:620::0/96")], - domainHint: [new DomainHint("example.com"), new DomainHint("www.example.com")], + ipHint: [ + new IPHint( + CIDRValue::fromString("130.59.0.0/16"), + ), + new IPHint( + CIDRValue::fromString("2001:620::0/96"), + ), + ], + domainHint: [ + new DomainHint( + DomainValue::fromString("example.com"), + ), + new DomainHint( + DomainValue::fromString("www.example.com"), + ), + ], geolocationHint: [ - new GeolocationHint("geo:47.37328,8.531126"), - new GeolocationHint("geo:19.34343,12.342514"), + new GeolocationHint( + GeolocationValue::fromString("geo:47.37328,8.531126"), + ), + new GeolocationHint( + GeolocationValue::fromString("geo:19.34343,12.342514"), + ), ], ); @@ -97,7 +115,10 @@ public function testMarshallingEmptyElement(): void */ public function testMarshallingChildren(): void { - $keywords = new Keywords("nl", ["voorbeeld", "specimen"]); + $keywords = new Keywords( + LanguageValue::fromString("nl"), + ListOfStringsValue::fromString("voorbeeld+specimen"), + ); $discoHints = new DiscoHints(); $discoHints->addChild(new Chunk($keywords->toXML())); $this->assertCount(1, $discoHints->getElements()); @@ -138,7 +159,7 @@ public function testUnmarshallingChildren(): void $disco = DiscoHints::fromXML($document->documentElement); $this->assertCount(1, $disco->getGeolocationHint()); - $this->assertEquals('geo:47.37328,8.531126', $disco->getGeolocationHint()[0]->getContent()); + $this->assertEquals('geo:47.37328,8.531126', $disco->getGeolocationHint()[0]->getContent()->getValue()); $this->assertCount(1, $disco->getElements()); /** @var \SimpleSAML\XML\Chunk[] $elements */ $elements = $disco->getElements(); diff --git a/tests/SAML2/XML/mdui/DisplayNameTest.php b/tests/SAML2/XML/mdui/DisplayNameTest.php index 7e7b5951a4..2ea06974af 100644 --- a/tests/SAML2/XML/mdui/DisplayNameTest.php +++ b/tests/SAML2/XML/mdui/DisplayNameTest.php @@ -4,15 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement}; use SimpleSAML\SAML2\XML\mdui\DisplayName; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -54,7 +53,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new DisplayName('en', 'University of Examples'); + $name = new DisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('University of Examples'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdui/DomainHintTest.php b/tests/SAML2/XML/mdui/DomainHintTest.php index 54e2393591..48a7753999 100644 --- a/tests/SAML2/XML/mdui/DomainHintTest.php +++ b/tests/SAML2/XML/mdui/DomainHintTest.php @@ -4,15 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Exception\InvalidArgumentException; +use SimpleSAML\SAML2\Type\DomainValue; use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; use SimpleSAML\SAML2\XML\mdui\DomainHint; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -51,27 +49,13 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $hint = new DomainHint('www.example.com'); + $hint = new DomainHint( + DomainValue::fromString('www.example.com'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($hint), ); } - - - // test unmarshalling - - - /** - * Test creating a DomainHint from XML with false domain - */ - public function testUnmarshallingFalseDomain(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->textContent = 'Not`@#%$&*()!ADo><$#mainName'; - - $this->expectException(InvalidArgumentException::class); - DomainHint::fromXML($xmlRepresentation->documentElement); - } } diff --git a/tests/SAML2/XML/mdui/GeolocationHintTest.php b/tests/SAML2/XML/mdui/GeolocationHintTest.php index 44ffb1e7c8..e4c8dd0980 100644 --- a/tests/SAML2/XML/mdui/GeolocationHintTest.php +++ b/tests/SAML2/XML/mdui/GeolocationHintTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; -use SimpleSAML\SAML2\XML\mdui\GeolocationHint; +use SimpleSAML\SAML2\Type\GeolocationValue; +use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, GeolocationHint}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +48,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $hint = new GeolocationHint('geo:47.37328,8.531126'); + $hint = new GeolocationHint( + GeolocationValue::fromString('geo:47.37328,8.531126'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdui/IPHintTest.php b/tests/SAML2/XML/mdui/IPHintTest.php index 4255bf39de..0dafa8be24 100644 --- a/tests/SAML2/XML/mdui/IPHintTest.php +++ b/tests/SAML2/XML/mdui/IPHintTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; -use SimpleSAML\SAML2\XML\mdui\IPHint; +use SimpleSAML\SAML2\Type\CIDRValue; +use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, IPHint}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +48,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $hint = new IPHint('130.59.0.0/16'); + $hint = new IPHint( + CIDRValue::fromString('130.59.0.0/16'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdui/InformationURLTest.php b/tests/SAML2/XML/mdui/InformationURLTest.php index bca0323714..163d075d00 100644 --- a/tests/SAML2/XML/mdui/InformationURLTest.php +++ b/tests/SAML2/XML/mdui/InformationURLTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI, AbstractMdElement}; use SimpleSAML\SAML2\XML\mdui\InformationURL; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -56,7 +54,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new InformationURL('en', 'http://www.example.edu/en/'); + $name = new InformationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://www.example.edu/en/'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdui/KeywordsTest.php b/tests/SAML2/XML/mdui/KeywordsTest.php index 2aaab9c853..ed40309bc5 100644 --- a/tests/SAML2/XML/mdui/KeywordsTest.php +++ b/tests/SAML2/XML/mdui/KeywordsTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; -use SimpleSAML\SAML2\XML\mdui\Keywords; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\ListOfStringsValue; +use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, Keywords}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -54,8 +52,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $keywords = new Keywords("nl", ["KLM", "koninklijke luchtvaart"]); - $keywords->addKeyword("maatschappij"); + $keywords = new Keywords( + LanguageValue::fromString("nl"), + ListOfStringsValue::fromString("KLM koninklijke+luchtvaart+maatschappij"), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -69,23 +69,11 @@ public function testMarshalling(): void */ public function testKeywordWithPlusSignThrowsException(): void { - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('Keywords may not contain a "+" character'); - - new Keywords("en", ["csharp", "pascal", "c++"]); - } + $this->expectException(ProtocolViolationException::class); - - /** - * Unmarshalling fails if attribute is empty - */ - public function testUnmarshallingFailsMissingKeywords(): void - { - $document = clone self::$xmlRepresentation; - $document->documentElement->textContent = ''; - - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('Missing value for Keywords'); - Keywords::fromXML($document->documentElement); + new Keywords( + LanguageValue::fromString("en"), + ListOfStringsValue::fromArray(["csharp", "pascal", "c++"]), + ); } } diff --git a/tests/SAML2/XML/mdui/LogoTest.php b/tests/SAML2/XML/mdui/LogoTest.php index afea872b33..ae95273cfd 100644 --- a/tests/SAML2/XML/mdui/LogoTest.php +++ b/tests/SAML2/XML/mdui/LogoTest.php @@ -4,18 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use InvalidArgumentException; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; -use SimpleSAML\SAML2\XML\mdui\Logo; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, Logo}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue}; use function dirname; use function strval; @@ -68,7 +66,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $logo = new Logo(self::URL, 200, 300, "nl"); + $logo = new Logo( + SAMLAnyURIValue::fromString(self::URL), + PositiveIntegerValue::fromInteger(200), + PositiveIntegerValue::fromInteger(300), + LanguageValue::fromString('nl'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -87,12 +90,16 @@ public function testUnmarshallingWithoutLanguage(): void $logo = Logo::fromXML($xmlRepresentation); $this->assertNull($logo->getLanguage()); - $this->assertEquals(200, $logo->getHeight()); - $this->assertEquals(300, $logo->getWidth()); + $this->assertEquals(200, $logo->getHeight()->toInteger()); + $this->assertEquals(300, $logo->getWidth()->toInteger()); $this->assertEquals(self::URL, $logo->getContent()); $this->assertEquals( $logo->toArray(), - ['url' => $logo->getContent(), 'width' => $logo->getWidth(), 'height' => $logo->getHeight()], + [ + 'url' => $logo->getContent()->getValue(), + 'width' => $logo->getWidth()->toInteger(), + 'height' => $logo->getHeight()->toInteger(), + ], ); } @@ -108,9 +115,9 @@ public function testUnmarshallingDataURL(): void $document->documentElement->setAttribute('width', '1'); $logo = Logo::fromXML($document->documentElement); - $this->assertEquals(1, $logo->getHeight()); - $this->assertEquals(1, $logo->getWidth()); - $this->assertEquals(self::DATA, $logo->getContent()); + $this->assertEquals(1, $logo->getHeight()->toInteger()); + $this->assertEquals(1, $logo->getWidth()->toInteger()); + $this->assertEquals(self::DATA, $logo->getContent()->getValue()); } @@ -136,8 +143,8 @@ public function testUnmarshallingFailsInvalidURL(): void $document = clone self::$xmlRepresentation; $document->documentElement->textContent = 'this is no url'; - $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage('mdui:Logo is not a valid URL.'); + $this->expectException(ProtocolViolationException::class); + $this->expectExceptionMessage('"this is no url" is not a SAML2-compliant URI'); Logo::fromXML($document->documentElement); } diff --git a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php index 4ecde7714e..9df2802cec 100644 --- a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php +++ b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; -use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; -use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI, AbstractMdElement}; use SimpleSAML\SAML2\XML\mdui\PrivacyStatementURL; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\LanguageValue; use function dirname; use function strval; @@ -56,7 +54,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $name = new PrivacyStatementURL('en', 'https://example.org/privacy'); + $name = new PrivacyStatementURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://example.org/privacy'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/mdui/UIInfoTest.php b/tests/SAML2/XML/mdui/UIInfoTest.php index f39a003209..ba0fa86891 100644 --- a/tests/SAML2/XML/mdui/UIInfoTest.php +++ b/tests/SAML2/XML/mdui/UIInfoTest.php @@ -4,26 +4,26 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, CIDRValue, ListOfStringsValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; -use SimpleSAML\SAML2\XML\mdui\Description; -use SimpleSAML\SAML2\XML\mdui\DiscoHints; -use SimpleSAML\SAML2\XML\mdui\DisplayName; -use SimpleSAML\SAML2\XML\mdui\InformationURL; -use SimpleSAML\SAML2\XML\mdui\IPHint; -use SimpleSAML\SAML2\XML\mdui\Keywords; -use SimpleSAML\SAML2\XML\mdui\Logo; -use SimpleSAML\SAML2\XML\mdui\PrivacyStatementURL; -use SimpleSAML\SAML2\XML\mdui\UIInfo; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\SAML2\XML\mdui\{ + AbstractMduiElement, + Description, + DiscoHints, + DisplayName, + InformationURL, + IPHint, + Keywords, + Logo, + PrivacyStatementURL, + UIInfo, +}; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue}; use function dirname; use function strval; @@ -70,22 +70,45 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $logo = new Logo("https://example.org/idp/images/logo_87x88.png", 88, 87, "fy"); + $logo = new Logo( + SAMLAnyURIValue::fromString("https://example.org/idp/images/logo_87x88.png"), + PositiveIntegerValue::fromInteger(88), + PositiveIntegerValue::fromInteger(87), + LanguageValue::fromString('fy'), + ); $uiinfo = new UIInfo( displayName: [ - new DisplayName("en", "University of Examples"), - new DisplayName("el", "Univërsitä øf Exåmpleß"), + new DisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('University of Examples'), + ), + new DisplayName( + LanguageValue::fromString('el'), + SAMLStringValue::fromString('Univërsitä øf Exåmpleß'), + ), ], description: [ - new Description("en", "Just an example"), + new Description( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Just an example'), + ), ], informationURL: [ - new InformationURL("en", "http://www.example.edu/en/"), - new InformationURL("el", "http://www.example.edu/"), + new InformationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('http://www.example.edu/en/'), + ), + new InformationURL( + LanguageValue::fromString('el'), + SAMLAnyURIValue::fromString('http://www.example.edu/'), + ), ], privacyStatementURL: [ - new PrivacyStatementURL("en", "https://example.org/privacy"), + new PrivacyStatementURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://example.org/privacy'), + ), ], children: [ new Chunk(DOMDocumentFactory::fromString( @@ -97,10 +120,16 @@ public function testMarshalling(): void ], ); - $keyword = new Keywords('en', ['University Fictional']); + $keyword = new Keywords( + LanguageValue::fromString('en'), + ListOfStringsValue::fromString('University Fictional'), + ); $uiinfo->addKeyword($keyword); - $keyword = new Keywords('fr', ['Université Fictif']); + $keyword = new Keywords( + LanguageValue::fromString('fr'), + ListOfStringsValue::fromString('Université Fictif'), + ); $uiinfo->addKeyword($keyword); $uiinfo->addLogo($logo); @@ -117,12 +146,27 @@ public function testMarshalling(): void */ public function testMarshallingChildren(): void { - $keywords = new Keywords("nl", ["voorbeeld", "specimen"]); - $logo = new Logo("https://example.edu/logo.png", 30, 20, "nl"); + $keywords = new Keywords( + LanguageValue::fromString('nl'), + ListOfStringsValue::fromString("voorbeeld+specimen"), + ); + $logo = new Logo( + SAMLAnyURIValue::fromString('https://example.edu/logo.png'), + PositiveIntegerValue::fromInteger(30), + PositiveIntegerValue::fromInteger(20), + LanguageValue::fromString('nl'), + ); $discohints = new DiscoHints( [], - [new IPHint("192.168.6.0/24"), new IPHint("fd00:0123:aa:1001::/64")], + [ + new IPHint( + CIDRValue::fromString("192.168.6.0/24"), + ), + new IPHint( + CIDRValue::fromString("fd00:0123:aa:1001::/64"), + ), + ], ); // keywords appears twice, directly under UIinfo and as child of DiscoHints @@ -202,7 +246,10 @@ public function testMultipleDescriptionWithSameLanguageThrowsException(): void $document = clone self::$xmlRepresentation; // Append another 'en' mdui:Description to the document - $x = new Description('en', 'Something'); + $x = new Description( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Something'), + ); $x->toXML($document->documentElement); $this->expectException(ProtocolViolationException::class); @@ -221,7 +268,10 @@ public function testMultipleDisplayNameWithSameLanguageThrowsException(): void $document = clone self::$xmlRepresentation; // Append another 'en' mdui:DisplayName to the document - $x = new DisplayName('en', 'Something'); + $x = new DisplayName( + LanguageValue::fromString('en'), + SAMLStringValue::fromString('Something'), + ); $x->toXML($document->documentElement); $this->expectException(ProtocolViolationException::class); @@ -240,7 +290,10 @@ public function testMultipleKeywordsWithSameLanguageThrowsException(): void $document = clone self::$xmlRepresentation; // Append another 'en' mdui:Keywords to the document - $x = new Keywords('en', ['Something', 'else']); + $x = new Keywords( + LanguageValue::fromString('en'), + ListOfStringsValue::fromString('Something else'), + ); $x->toXML($document->documentElement); $this->expectException(ProtocolViolationException::class); @@ -259,7 +312,10 @@ public function testMultipleInformationURLWithSameLanguageThrowsException(): voi $document = clone self::$xmlRepresentation; // Append another 'en' mdui:InformationURL to the document - $x = new InformationURL('en', 'https://example.org'); + $x = new InformationURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://example.org'), + ); $x->toXML($document->documentElement); $this->expectException(ProtocolViolationException::class); @@ -278,7 +334,10 @@ public function testMultiplePrivacyStatementURLWithSameLanguageThrowsException() $document = clone self::$xmlRepresentation; // Append another 'en' mdui:PrivacyStatementURL to the document - $x = new PrivacyStatementURL('en', 'https://example.org'); + $x = new PrivacyStatementURL( + LanguageValue::fromString('en'), + SAMLAnyURIValue::fromString('https://example.org'), + ); $x->toXML($document->documentElement); $this->expectException(ProtocolViolationException::class); diff --git a/tests/SAML2/XML/saml/ActionTest.php b/tests/SAML2/XML/saml/ActionTest.php index 3ba83267d7..993ccd4627 100644 --- a/tests/SAML2/XML/saml/ActionTest.php +++ b/tests/SAML2/XML/saml/ActionTest.php @@ -4,11 +4,10 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Action; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Action}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -49,8 +48,8 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $action = new Action( - C::NAMESPACE, - 'SomeAction', + SAMLAnyURIValue::fromString(C::NAMESPACE), + SAMLStringValue::fromString('SomeAction'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/AdviceTest.php b/tests/SAML2/XML/saml/AdviceTest.php index 5f8c2f4690..0b4df5e7a2 100644 --- a/tests/SAML2/XML/saml/AdviceTest.php +++ b/tests/SAML2/XML/saml/AdviceTest.php @@ -5,19 +5,18 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Advice; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\AssertionIDRef; -use SimpleSAML\SAML2\XML\saml\AssertionURIRef; -use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + Advice, + Assertion, + AssertionIDRef, + AssertionURIRef, + EncryptedAssertion, +}; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AssertionIDRefTest.php b/tests/SAML2/XML/saml/AssertionIDRefTest.php index 29cc7355fd..4bc3eab445 100644 --- a/tests/SAML2/XML/saml/AssertionIDRefTest.php +++ b/tests/SAML2/XML/saml/AssertionIDRefTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AssertionIDRef; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AssertionIDRef}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\NCNameValue; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $assertionIDRef = new AssertionIDRef('_Test'); + $assertionIDRef = new AssertionIDRef( + NCNameValue::fromString('_Test'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/saml/AssertionTest.php b/tests/SAML2/XML/saml/AssertionTest.php index 6345344740..62f9517ef3 100644 --- a/tests/SAML2/XML/saml/AssertionTest.php +++ b/tests/SAML2/XML/saml/AssertionTest.php @@ -4,49 +4,48 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DateTimeImmutable; use Exception; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, DomainValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeStatement; -use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\AudienceRestriction; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; -use SimpleSAML\SAML2\XML\saml\AuthnStatement; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; -use SimpleSAML\SAML2\XML\saml\EncryptedID; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; -use SimpleSAML\SAML2\XML\saml\SubjectLocality; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + Assertion, + Attribute, + AttributeStatement, + AttributeValue, + Audience, + AudienceRestriction, + AuthenticatingAuthority, + AuthnContext, + AuthnContextClassRef, + AuthnContextDeclRef, + AuthnStatement, + Conditions, + EncryptedAssertion, + EncryptedID, + Issuer, + NameID, + Subject, + SubjectConfirmation, + SubjectConfirmationData, + SubjectLocality, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{Base64BinaryValue, IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\Exception\SignatureVerificationFailedException; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\X509Certificate; -use SimpleSAML\XMLSecurity\XML\ds\X509Data; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, X509Certificate, X509Data}; use function dirname; use function strval; @@ -106,63 +105,81 @@ public static function tearDownAfterClass(): void public function testMarshalling(): void { // Create an Issuer - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); // Create the conditions $conditions = new Conditions( - notBefore: new DateTimeImmutable('2011-08-31T08:51:05Z'), - notOnOrAfter: new DateTimeImmutable('2011-08-31T10:51:05Z'), + notBefore: SAMLDateTimeValue::fromString('2011-08-31T08:51:05Z'), + notOnOrAfter: SAMLDateTimeValue::fromString('2011-08-31T10:51:05Z'), condition: [], - audienceRestriction: [new AudienceRestriction([new Audience(C::ENTITY_SP)])], + audienceRestriction: [ + new AudienceRestriction([ + new Audience( + EntityIDValue::fromString(C::ENTITY_SP), + ), + ]), + ], ); // Create the AuthnStatement $authnStatement = new AuthnStatement( authnContext: new AuthnContext( - new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ), null, null, ), - authnInstant: new DateTimeImmutable('2011-08-31T08:51:05Z'), - sessionIndex: '_93af655219464fb403b34436cfb0c5cb1d9a5502', - subjectLocality: new SubjectLocality('127.0.0.1'), + authnInstant: SAMLDateTimeValue::fromString('2011-08-31T08:51:05Z'), + sessionIndex: SAMLStringValue::fromString('_93af655219464fb403b34436cfb0c5cb1d9a5502'), + subjectLocality: new SubjectLocality( + SAMLStringValue::fromString('127.0.0.1'), + ), ); // Create the AttributeStatement $attrStatement = new AttributeStatement([ new Attribute( - name: 'urn:test:ServiceID', - attributeValue: [new AttributeValue(1)], + name: SAMLStringValue::fromString('urn:test:ServiceID'), + attributeValue: [ + new AttributeValue(1), + ], ), new Attribute( - name: 'urn:test:EntityConcernedID', - attributeValue: [new AttributeValue(1)], + name: SAMLStringValue::fromString('urn:test:EntityConcernedID'), + attributeValue: [ + new AttributeValue(1), + ], ), new Attribute( - name: 'urn:test:EntityConcernedSubID', - attributeValue: [new AttributeValue(1)], + name: SAMLStringValue::fromString('urn:test:EntityConcernedSubID'), + attributeValue: [ + new AttributeValue(1), + ], ), ]); // Create the Subject $subject = new Subject( new NameID( - value: 'SomeNameIDValue', - SPNameQualifier: 'https://sp.example.org/authentication/sp/metadata', - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString('SomeNameIDValue'), + SPNameQualifier: SAMLStringValue::fromString('https://sp.example.org/authentication/sp/metadata'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), [ new SubjectConfirmation( - 'urn:oasis:names:tc:SAML:2.0:cm:bearer', + SAMLAnyURIValue::fromString('urn:oasis:names:tc:SAML:2.0:cm:bearer'), new NameID( - value: 'SomeOtherNameIDValue', - SPNameQualifier: 'https://sp.example.org/authentication/sp/metadata', - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString('SomeOtherNameIDValue'), + SPNameQualifier: SAMLStringValue::fromString('https://sp.example.org/authentication/sp/metadata'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), new SubjectConfirmationData( - notOnOrAfter: new DateTimeImmutable('2011-08-31T08:51:05Z'), - recipient: 'https://sp.example.org/authentication/sp/consume-assertion', - inResponseTo: '_13603a6565a69297e9809175b052d115965121c8', + notOnOrAfter: SAMLDateTimeValue::fromString('2011-08-31T08:51:05Z'), + recipient: EntityIDValue::fromString('https://sp.example.org/authentication/sp/consume-assertion'), + inResponseTo: NCNameValue::fromString('_13603a6565a69297e9809175b052d115965121c8'), ), ), ], @@ -171,8 +188,8 @@ public function testMarshalling(): void // Create an assertion $assertion = new Assertion( $issuer, - new DateTimeImmutable('1970-01-01T01:33:31Z'), - '_93af655219464fb403b34436cfb0c5cb1d9a5502', + SAMLDateTimeValue::fromString('1970-01-01T01:33:31Z'), + IDValue::fromString('_93af655219464fb403b34436cfb0c5cb1d9a5502'), $subject, $conditions, [$authnStatement, $attrStatement], @@ -253,15 +270,20 @@ public function testUnmarshalling(): void public function testMarshallingUnmarshallingChristmas(): void { // Create an Issuer - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); // Create Conditions $conditions = new Conditions( - notBefore: new DateTimeImmutable('2011-08-31T08:51:05Z'), - notOnOrAfter: new DateTimeImmutable('2011-08-31T10:51:05Z'), + notBefore: SAMLDateTimeValue::fromString('2011-08-31T08:51:05Z'), + notOnOrAfter: SAMLDateTimeValue::fromString('2011-08-31T10:51:05Z'), audienceRestriction: [ new AudienceRestriction( - [new Audience(C::ENTITY_SP), new Audience(C::ENTITY_OTHER)], + [ + new Audience(EntityIDValue::fromString(C::ENTITY_SP)), + new Audience(EntityIDValue::fromString(C::ENTITY_OTHER)), + ], ), ], ); @@ -269,18 +291,29 @@ public function testMarshallingUnmarshallingChristmas(): void // Create AuthnStatement $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA1), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA1), + ), null, - new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'), + new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ), [ - new AuthenticatingAuthority(C::ENTITY_IDP), - new AuthenticatingAuthority(C::ENTITY_OTHER), + new AuthenticatingAuthority( + EntityIDValue::fromString(C::ENTITY_IDP), + ), + new AuthenticatingAuthority( + EntityIDValue::fromString(C::ENTITY_OTHER), + ), ], ), - new DateTimeImmutable('2011-08-31T08:51:04Z'), - new DateTimeImmutable('2011-08-31T08:54:25Z'), - 'idx1', - new SubjectLocality('127.0.0.1', 'no.place.like.home'), + SAMLDateTimeValue::fromString('2011-08-31T08:51:04Z'), + SAMLDateTimeValue::fromString('2011-08-31T08:54:25Z'), + SAMLStringValue::fromString('idx1'), + new SubjectLocality( + SAMLStringValue::fromString('127.0.0.1'), + DomainValue::fromString('no.place.like.home'), + ), ); // Create AttributeStatement @@ -288,18 +321,25 @@ public function testMarshallingUnmarshallingChristmas(): void // Attribute [ new Attribute( - name: 'name1', - attributeValue: [new AttributeValue('value1'), new AttributeValue('value2')], + name: SAMLStringValue::fromString('name1'), + attributeValue: [ + new AttributeValue('value1'), + new AttributeValue('value2'), + ], ), new Attribute( - name: 'name2', - nameFormat: C::NAMEFORMAT_UNSPECIFIED, - attributeValue: [new AttributeValue(2)], + name: SAMLStringValue::fromString('name2'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_UNSPECIFIED), + attributeValue: [ + new AttributeValue(2), + ], ), new Attribute( - name: 'name3', - nameFormat: C::NAMEFORMAT_BASIC, - attributeValue: [new AttributeValue(null)], + name: SAMLStringValue::fromString('name3'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), + attributeValue: [ + new AttributeValue(null), + ], ), ], ); @@ -308,8 +348,8 @@ public function testMarshallingUnmarshallingChristmas(): void $statements = [$authnStatement, $attributeStatement]; $assertion = new Assertion( issuer: $issuer, - id: '_123abc', - issueInstant: new DateTimeImmutable('2011-08-31T08:51:05Z'), + id: IDValue::fromString('_123abc'), + issueInstant: SAMLDateTimeValue::fromString('2011-08-31T08:51:05Z'), conditions: $conditions, statements: $statements, ); @@ -326,22 +366,22 @@ public function testMarshallingUnmarshallingChristmas(): void $authnStatement = $authnStatements[0]; $this->assertEquals( 'https://example.org/relative/path/to/document.xml', - $authnStatement->getAuthnContext()->getAuthnContextDeclRef()?->getContent(), + $authnStatement->getAuthnContext()->getAuthnContextDeclRef()?->getContent()->getValue(), ); - $this->assertEquals('_123abc', $assertionToVerify->getId()); - $this->assertEquals('2011-08-31T08:51:05Z', $assertionToVerify->getIssueInstant()->format(C::DATETIME_FORMAT)); - $this->assertEquals('2011-08-31T08:54:25Z', $authnStatement->getSessionNotOnOrAfter()->format(C::DATETIME_FORMAT)); - $this->assertEquals('2011-08-31T08:51:04Z', $authnStatement->getAuthnInstant()->format(C::DATETIME_FORMAT)); - $this->assertEquals('idx1', $authnStatement->getSessionIndex()); + $this->assertEquals('_123abc', $assertionToVerify->getId()->getValue()); + $this->assertEquals('2011-08-31T08:51:05Z', $assertionToVerify->getIssueInstant()->getValue()); + $this->assertEquals('2011-08-31T08:54:25Z', $authnStatement->getSessionNotOnOrAfter()->getValue()); + $this->assertEquals('2011-08-31T08:51:04Z', $authnStatement->getAuthnInstant()->getValue()); + $this->assertEquals('idx1', $authnStatement->getSessionIndex()->getValue()); $subjectLocality = $authnStatement->getSubjectLocality(); - $this->assertEquals('127.0.0.1', $subjectLocality?->getAddress()); - $this->assertEquals('no.place.like.home', $subjectLocality?->getDnsName()); + $this->assertEquals('127.0.0.1', $subjectLocality->getAddress()->getValue()); + $this->assertEquals('no.place.like.home', $subjectLocality->getDnsName()->getValue()); $authauth = $authnStatement->getAuthnContext()->getAuthenticatingAuthorities(); $this->assertCount(2, $authauth); - $this->assertEquals(C::ENTITY_IDP, $authauth[0]->getContent()); - $this->assertEquals(C::ENTITY_OTHER, $authauth[1]->getContent()); + $this->assertEquals(C::ENTITY_IDP, $authauth[0]->getContent()->getValue()); + $this->assertEquals(C::ENTITY_OTHER, $authauth[1]->getContent()->getValue()); $attributeStatements = $assertionToVerify->getAttributeStatements(); $this->assertCount(1, $attributeStatements); @@ -513,7 +553,9 @@ public function testCorrectSignatureMethodCanBeExtracted(): void ); $keyInfo = new KeyInfo([ new X509Data([ - new X509Certificate(PEMCertificatesMock::getPlainPublicKeyContents(PEMCertificatesMock::PUBLIC_KEY)), + new X509Certificate( + Base64BinaryValue::fromString(PEMCertificatesMock::getPlainPublicKeyContents(PEMCertificatesMock::PUBLIC_KEY)), + ), ]), ]); @@ -687,7 +729,7 @@ public function testVerifySignedAssertion(): void $assertion = Assertion::fromXML($doc->documentElement); $verifier = (new SignatureAlgorithmFactory())->getAlgorithm( - $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm(), + $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(), PEMCertificatesMock::getPublicKey(PEMCertificatesMock::SELFSIGNED_PUBLIC_KEY), ); @@ -700,7 +742,7 @@ public function testVerifySignedAssertion(): void // Double-check that we can actually retrieve some basics. $this->assertEquals("_93af655219464fb403b34436cfb0c5cb1d9a5502", $verified->getId()); $this->assertEquals("urn:x-simplesamlphp:issuer", $verified->getIssuer()->getContent()); - $this->assertEquals("1970-01-01T01:33:31Z", $verified->getIssueInstant()->format(C::DATETIME_FORMAT)); + $this->assertEquals("1970-01-01T01:33:31Z", $verified->getIssueInstant()->getValue()); } @@ -714,7 +756,7 @@ public function testCommentsInSignedAssertion(): void $assertion = Assertion::fromXML($doc->documentElement); $verifier = (new SignatureAlgorithmFactory())->getAlgorithm( - $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm(), + $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(), PEMCertificatesMock::getPublicKey(PEMCertificatesMock::SELFSIGNED_PUBLIC_KEY), ); @@ -740,7 +782,7 @@ public function testVerifySignedAssertionChangedBody(): void $assertion = Assertion::fromXML($doc->documentElement); $verifier = (new SignatureAlgorithmFactory())->getAlgorithm( - $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm(), + $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(), PEMCertificatesMock::getPublicKey(PEMCertificatesMock::SELFSIGNED_PUBLIC_KEY), ); @@ -782,7 +824,7 @@ public function testVerifySignedAssertionWrongKey(): void $assertion = Assertion::fromXML($doc->documentElement); $verifier = (new SignatureAlgorithmFactory())->getAlgorithm( - $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm(), + $assertion->getSignature()?->getSignedInfo()->getSignatureMethod()->getAlgorithm()->getValue(), PEMCertificatesMock::getPublicKey(PEMCertificatesMock::OTHER_PUBLIC_KEY), ); @@ -843,8 +885,7 @@ public function testAssertionVersionOtherThan20ThrowsException(): void $document = clone self::$xmlRepresentation; $document->documentElement->setAttribute('Version', '1.3'); - $this->expectException(Exception::class); - $this->expectExceptionMessage('Unsupported version: "1.3"'); + $this->expectException(RequestVersionTooLowException::class); Assertion::fromXML($document->documentElement); } @@ -1072,21 +1113,26 @@ public function testConditionAllowedTypes(): void public function testNameIdEncryption(): void { // Create an Issuer - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); // Create the Conditions $conditions = new Conditions( audienceRestriction: [ new AudienceRestriction( - [new Audience(C::ENTITY_SP), new Audience(C::ENTITY_OTHER)], + [ + new Audience(SAMLAnyURIValue::fromString(C::ENTITY_SP)), + new Audience(SAMLAnyURIValue::fromString(C::ENTITY_OTHER)), + ], ), ], ); // Create a Subject $nameId = new NameID( - value: "just_a_basic_identifier", - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString("just_a_basic_identifier"), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ); $this->assertInstanceOf(NameID::class, $nameId); @@ -1101,17 +1147,20 @@ public function testNameIdEncryption(): void // Create the statements $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_LOA2), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_LOA2), + ), null, null, ), - self::$clock->now(), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); // Create an assertion $assertion = new Assertion( issuer: $issuer, - issueInstant: self::$clock->now(), + id: IDValue::fromString('phpunit'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), subject: $subject, conditions: $conditions, statements: [$authnStatement], @@ -1126,25 +1175,32 @@ public function testNameIdEncryption(): void $this->assertInstanceOf(EncryptedID::class, $identifier); $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $identifier->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $identifier->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), ); $nameID = $identifier->decrypt($decryptor); $this->assertInstanceOf(NameID::class, $nameID); - $this->assertEquals('just_a_basic_identifier', $nameID->getContent()); - $this->assertEquals(C::NAMEID_TRANSIENT, $nameID->getFormat()); + $this->assertEquals('just_a_basic_identifier', $nameID->getContent()->getValue()); + $this->assertEquals(C::NAMEID_TRANSIENT, $nameID->getFormat()->getValue()); } public function testMarshallingElementOrdering(): void { // Create an Issuer - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); // Create the conditions $conditions = new Conditions( - audienceRestriction: [new AudienceRestriction([new Audience(C::ENTITY_SP), new Audience(C::ENTITY_OTHER)])], + audienceRestriction: [ + new AudienceRestriction([ + new Audience(SAMLAnyURIValue::fromString(C::ENTITY_SP)), + new Audience(SAMLAnyURIValue::fromString(C::ENTITY_OTHER)), + ]), + ], ); // Create AttributeStatement @@ -1152,14 +1208,19 @@ public function testMarshallingElementOrdering(): void // Attribute [ new Attribute( - name: 'name1', - nameFormat: C::NAMEFORMAT_UNSPECIFIED, - attributeValue: [new AttributeValue('value1'), new AttributeValue('value2')], + name: SAMLStringValue::fromString('name1'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_UNSPECIFIED), + attributeValue: [ + new AttributeValue('value1'), + new AttributeValue('value2'), + ], ), new Attribute( - name: 'name2', - nameFormat: C::NAMEFORMAT_UNSPECIFIED, - attributeValue: [new AttributeValue('value3')], + name: SAMLStringValue::fromString('name2'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_UNSPECIFIED), + attributeValue: [ + new AttributeValue('value3'), + ], ), ], ); @@ -1167,16 +1228,21 @@ public function testMarshallingElementOrdering(): void // Create the statements $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AUTHNCONTEXT_CLASS_REF_URN), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AUTHNCONTEXT_CLASS_REF_URN), + ), null, null, ), - self::$clock->now(), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), ); // Create Subject $subject = new Subject( - new NameID("just_a_basic_identifier", C::NAMEID_TRANSIENT), + new NameID( + value: SAMLStringValue::fromString("just_a_basic_identifier"), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), + ), ); $statements = [$authnStatement, $attributeStatement]; @@ -1184,7 +1250,8 @@ public function testMarshallingElementOrdering(): void // Create a signed assertion $assertion = new Assertion( issuer: $issuer, - issueInstant: self::$clock->now(), + id: IDValue::fromString('phpunit'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), subject: $subject, conditions: $conditions, statements: $statements, @@ -1264,7 +1331,7 @@ public function testEncryption(): void $doc = DOMDocumentFactory::fromString(strval($encass)); $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encass->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encass->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::OTHER_PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/AssertionURIRefTest.php b/tests/SAML2/XML/saml/AssertionURIRefTest.php index 069b3f78a0..802863921e 100644 --- a/tests/SAML2/XML/saml/AssertionURIRefTest.php +++ b/tests/SAML2/XML/saml/AssertionURIRefTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AssertionURIRef; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AssertionURIRef}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $assertionURIRef = new AssertionURIRef('urn:x-simplesamlphp:reference'); + $assertionURIRef = new AssertionURIRef( + SAMLAnyURIValue::fromString('urn:x-simplesamlphp:reference'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/saml/AttributeStatementTest.php b/tests/SAML2/XML/saml/AttributeStatementTest.php index d340df880b..664c638218 100644 --- a/tests/SAML2/XML/saml/AttributeStatementTest.php +++ b/tests/SAML2/XML/saml/AttributeStatementTest.php @@ -4,17 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\SAML2\XML\saml\AttributeStatement; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -55,16 +54,22 @@ public function testMarshalling(): void $attrStatement = new AttributeStatement( [ new Attribute( - name: 'urn:ServiceID', - attributeValue: [new AttributeValue(1)], + name: SAMLStringValue::fromString('urn:ServiceID'), + attributeValue: [ + new AttributeValue(1), + ], ), new Attribute( - name: 'urn:EntityConcernedID', - attributeValue: [new AttributeValue(1)], + name: SAMLStringValue::fromString('urn:EntityConcernedID'), + attributeValue: [ + new AttributeValue(1), + ], ), new Attribute( - name: 'urn:EntityConcernedSubID', - attributeValue: [new AttributeValue(1)], + name: SAMLStringValue::fromString('urn:EntityConcernedSubID'), + attributeValue: [ + new AttributeValue(1), + ], ), ], ); diff --git a/tests/SAML2/XML/saml/AttributeTest.php b/tests/SAML2/XML/saml/AttributeTest.php index 9b264f8a32..2faea67734 100644 --- a/tests/SAML2/XML/saml/AttributeTest.php +++ b/tests/SAML2/XML/saml/AttributeTest.php @@ -5,21 +5,17 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\saml\EncryptedAttribute; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Attribute, AttributeValue, EncryptedAttribute}; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\StringValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -79,13 +75,13 @@ public static function tearDownAfterClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $attribute = new Attribute( - 'TheName', - C::NAMEFORMAT_BASIC, - 'TheFriendlyName', + SAMLStringValue::fromString('TheName'), + SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), + SAMLStringValue::fromString('TheFriendlyName'), [ new AttributeValue('FirstValue'), new AttributeValue('SecondValue'), @@ -138,7 +134,7 @@ public function testEncryption(): void $encattr = EncryptedAttribute::fromXML($doc->documentElement); $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encattr->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encattr->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/AttributeValueTest.php b/tests/SAML2/XML/saml/AttributeValueTest.php index 385f6579fa..5b505c2d49 100644 --- a/tests/SAML2/XML/saml/AttributeValueTest.php +++ b/tests/SAML2/XML/saml/AttributeValueTest.php @@ -5,16 +5,12 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AttributeValue, NameID}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AudienceRestrictionTest.php b/tests/SAML2/XML/saml/AudienceRestrictionTest.php index 79ede6cdde..94eac4f014 100644 --- a/tests/SAML2/XML/saml/AudienceRestrictionTest.php +++ b/tests/SAML2/XML/saml/AudienceRestrictionTest.php @@ -4,15 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\AudienceRestriction; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Audience, AudienceRestriction}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -52,8 +49,12 @@ public function testMarshalling(): void { $condition = new AudienceRestriction( [ - new Audience('urn:test:audience1'), - new Audience('urn:test:audience2'), + new Audience( + SAMLAnyURIValue::fromString('urn:test:audience1'), + ), + new Audience( + SAMLAnyURIValue::fromString('urn:test:audience2'), + ), ], ); diff --git a/tests/SAML2/XML/saml/AudienceTest.php b/tests/SAML2/XML/saml/AudienceTest.php index 09acf3cdce..27c50eae10 100644 --- a/tests/SAML2/XML/saml/AudienceTest.php +++ b/tests/SAML2/XML/saml/AudienceTest.php @@ -4,15 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractConditionType; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{AbstractConditionType, AbstractSamlElement, Audience}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -48,7 +45,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $audience = new Audience('urn:test:audience1'); + $audience = new Audience( + SAMLAnyURIValue::fromString('urn:test:audience1'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php b/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php index 0859bd356b..4892021c5e 100644 --- a/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php +++ b/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $authenticatingAuthority = new AuthenticatingAuthority('https://idp.example.com/SAML2'); + $authenticatingAuthority = new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/saml/AuthnContextClassRefTest.php b/tests/SAML2/XML/saml/AuthnContextClassRefTest.php index 17c77cb8de..749b6b37e2 100644 --- a/tests/SAML2/XML/saml/AuthnContextClassRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextClassRefTest.php @@ -4,15 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthnContextClassRef}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -48,7 +46,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $authnContextClassRef = new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT); + $authnContextClassRef = new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php index bba871b3c9..6d37552a01 100644 --- a/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthnContextDeclRef}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -49,7 +47,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $authnContextDeclRef = new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'); + $authnContextDeclRef = new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/saml/AuthnContextDeclTest.php b/tests/SAML2/XML/saml/AuthnContextDeclTest.php index 93a92706a0..c5e4b93481 100644 --- a/tests/SAML2/XML/saml/AuthnContextDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextDeclTest.php @@ -4,16 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthnContextDecl}; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\StringValue; use function dirname; use function strval; @@ -66,7 +63,9 @@ public function testMarshalling(): void $authnContextDecl = new AuthnContextDecl( [$chunk], - [new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1')], + [ + new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1')), + ], ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/AuthnContextTest.php b/tests/SAML2/XML/saml/AuthnContextTest.php index 9ff1a39f45..9ae8afb7fe 100644 --- a/tests/SAML2/XML/saml/AuthnContextTest.php +++ b/tests/SAML2/XML/saml/AuthnContextTest.php @@ -5,17 +5,19 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + AuthenticatingAuthority, + AuthnContext, + AuthnContextClassRef, + AuthnContextDecl, + AuthnContextDeclRef, +}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\TooManyElementsException; @@ -52,9 +54,16 @@ public static function setUpBeforeClass(): void */ public function testMarshallingIllegalCombination(): void { - $authnContextClassRef = new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT); + $authnContextClassRef = new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ); $authnContextDecl = AuthnContextDecl::fromXML(self::$decl->documentElement); - $authnContextDeclRef = new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'); + $authnContextDeclRef = new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ); + $authenticatingAuthority = new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ); $this->expectException(AssertionFailedException::class); $this->expectExceptionMessage('Can only have one of AuthnContextDecl/AuthnContextDeclRef'); @@ -63,9 +72,7 @@ public function testMarshallingIllegalCombination(): void $authnContextClassRef, $authnContextDecl, $authnContextDeclRef, - [ - new AuthenticatingAuthority('https://idp.example.com/SAML2'), - ], + [$authenticatingAuthority], ); } diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php index 16895212c1..afa1476183 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php @@ -4,18 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + AuthenticatingAuthority, + AuthnContext, + AuthnContextClassRef, + AuthnContextDeclRef, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -52,10 +53,18 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $authnContext = new AuthnContext( - authnContextClassRef: new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT), - authnContextDeclRef: new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'), + authnContextClassRef: new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ), + authnContextDeclRef: new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ), authnContextDecl: null, - authenticatingAuthorities: [new AuthenticatingAuthority('https://idp.example.com/SAML2')], + authenticatingAuthorities: [ + new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ), + ], ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php index 81af59d72f..b697778cec 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php @@ -4,20 +4,21 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + AuthenticatingAuthority, + AuthnContext, + AuthnContextClassRef, + AuthnContextDecl, +}; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\StringValue; use function dirname; use function strval; @@ -68,14 +69,20 @@ public function testMarshalling(): void $authnContextDecl = new AuthnContextDecl( [$chunk], - [new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1')], + [new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1'))], ); $authnContext = new AuthnContext( - authnContextClassRef: new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT), + authnContextClassRef: new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ), authnContextDecl: $authnContextDecl, authnContextDeclRef: null, - authenticatingAuthorities: [new AuthenticatingAuthority('https://idp.example.com/SAML2')], + authenticatingAuthorities: [ + new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ), + ], ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php index 0e27fa5d18..d164eb0a23 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php @@ -4,17 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority, AuthnContext, AuthnContextClassRef}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -51,10 +47,16 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $authnContext = new AuthnContext( - authnContextClassRef: new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT), + authnContextClassRef: new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ), authnContextDeclRef: null, authnContextDecl: null, - authenticatingAuthorities: [new AuthenticatingAuthority('https://idp.example.com/SAML2')], + authenticatingAuthorities: [ + new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ), + ], ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php index 17e30605a9..52eb2e0e38 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php @@ -4,13 +4,10 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority, AuthnContext, AuthnContextDeclRef}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; @@ -51,9 +48,15 @@ public function testMarshalling(): void { $authnContext = new AuthnContext( authnContextClassRef: null, - authnContextDeclRef: new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'), + authnContextDeclRef: new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ), authnContextDecl: null, - authenticatingAuthorities: [new AuthenticatingAuthority('https://idp.example.com/SAML2')], + authenticatingAuthorities: [ + new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ), + ], ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php index c8581a1e9e..8b15880ad1 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php @@ -4,18 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority, AuthnContext, AuthnContextDecl}; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\StringValue; use function dirname; use function strval; @@ -66,14 +62,18 @@ public function testMarshalling(): void $authnContextDecl = new AuthnContextDecl( [$chunk], - [new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1')], + [new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', StringValue::fromString('testval1'))], ); $authnContext = new AuthnContext( authnContextClassRef: null, authnContextDecl: $authnContextDecl, authnContextDeclRef: null, - authenticatingAuthorities: [new AuthenticatingAuthority('https://idp.example.com/SAML2')], + authenticatingAuthorities: [ + new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ), + ], ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/AuthnStatementTest.php b/tests/SAML2/XML/saml/AuthnStatementTest.php index 9faf5a0082..4d09851e18 100644 --- a/tests/SAML2/XML/saml/AuthnStatementTest.php +++ b/tests/SAML2/XML/saml/AuthnStatementTest.php @@ -4,24 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, DomainValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; -use SimpleSAML\SAML2\XML\saml\AuthnContext; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnStatement; -use SimpleSAML\SAML2\XML\saml\SubjectLocality; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + AuthenticatingAuthority, + AuthnContext, + AuthnContextClassRef, + AuthnStatement, + SubjectLocality, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\{MissingAttributeException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -61,15 +59,24 @@ public function testMarshalling(): void { $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ), null, null, - [new AuthenticatingAuthority('https://idp.example.com/SAML2')], + [ + new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ), + ], + ), + SAMLDateTimeValue::fromString('2020-03-23T23:37:24Z'), + SAMLDateTimeValue::fromString('2020-03-23T23:37:24Z'), + SAMLStringValue::fromString('123'), + new SubjectLocality( + SAMLStringValue::fromString('1.1.1.1'), + DomainValue::fromString('idp.example.org'), ), - new DateTimeImmutable('2020-03-23T23:37:24Z'), - new DateTimeImmutable('2020-03-23T23:37:24Z'), - '123', - new SubjectLocality('1.1.1.1', 'idp.example.org'), ); $this->assertEquals( @@ -85,15 +92,24 @@ public function testMarshallingElementOrdering(): void { $authnStatement = new AuthnStatement( new AuthnContext( - new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ), null, null, - [new AuthenticatingAuthority('https://idp.example.com/SAML2')], + [ + new AuthenticatingAuthority( + EntityIDValue::fromString('https://idp.example.com/SAML2'), + ), + ], + ), + SAMLDateTimeValue::fromString('2020-03-23T23:37:24Z'), + SAMLDateTimeValue::fromString('2020-03-23T23:37:24Z'), + SAMLStringValue::fromString('123'), + new SubjectLocality( + SAMLStringValue::fromString('1.1.1.1'), + DomainValue::fromString('idp.example.org'), ), - new DateTimeImmutable('2020-03-23T23:37:24Z'), - new DateTimeImmutable('2020-03-23T23:37:24Z'), - '123', - new SubjectLocality('1.1.1.1', 'idp.example.org'), ); // Marshall it to a \DOMElement diff --git a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php index 220b783cfb..d1f8483abc 100644 --- a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php +++ b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php @@ -5,18 +5,19 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\Decision; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AbstractStatement; -use SimpleSAML\SAML2\XML\saml\Action; -use SimpleSAML\SAML2\XML\saml\AuthzDecisionStatement; -use SimpleSAML\SAML2\XML\saml\Evidence; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + AbstractStatement, + Action, + AuthzDecisionStatement, + Evidence, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -61,11 +62,17 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $authzDecisionStatement = new AuthzDecisionStatement( - 'urn:x-simplesamlphp:resource', + SAMLAnyURIValue::fromString('urn:x-simplesamlphp:resource'), Decision::PERMIT, [ - new Action('urn:x-simplesamlphp:namespace', 'SomeAction'), - new Action('urn:x-simplesamlphp:namespace', 'OtherAction'), + new Action( + SAMLAnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + SAMLStringValue::fromString('SomeAction'), + ), + new Action( + SAMLAnyURIValue::fromString('urn:x-simplesamlphp:namespace'), + SAMLStringValue::fromString('OtherAction'), + ), ], Evidence::fromXML(self::$evidence->documentElement), ); diff --git a/tests/SAML2/XML/saml/BaseIDTest.php b/tests/SAML2/XML/saml/BaseIDTest.php index 67ed575e60..bf0b2c7dfa 100644 --- a/tests/SAML2/XML/saml/BaseIDTest.php +++ b/tests/SAML2/XML/saml/BaseIDTest.php @@ -4,21 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; -use SimpleSAML\SAML2\XML\saml\AbstractBaseID; -use SimpleSAML\SAML2\XML\saml\AbstractBaseIDType; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\UnknownID; -use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\Test\SAML2\CustomBaseID; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{ + AbstractBaseID, + AbstractBaseIDType, + AbstractSamlElement, + Audience, + UnknownID, +}; +use SimpleSAML\Test\SAML2\{Constants as C, CustomBaseID}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -79,9 +78,13 @@ public static function tearDownAfterClass(): void public function testMarshalling(): void { $baseId = new CustomBaseID( - [new Audience('urn:some:audience')], - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', + [ + new Audience( + SAMLAnyURIValue::fromString('urn:some:audience'), + ), + ], + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), ); $this->assertEquals( @@ -129,7 +132,10 @@ public function testUnmarshallingUnregistered(): void $this->assertInstanceOf(UnknownID::class, $baseId); $this->assertEquals('urn:x-simplesamlphp:namequalifier', $baseId->getNameQualifier()); $this->assertEquals('urn:x-simplesamlphp:spnamequalifier', $baseId->getSPNameQualifier()); - $this->assertEquals('urn:x-simplesamlphp:namespace:UnknownBaseIDType', $baseId->getXsiType()); + $this->assertEquals( + '{urn:x-simplesamlphp:namespace}ssp:UnknownBaseIDType', + $baseId->getXsiType()->getRawValue(), + ); $chunk = $baseId->getRawIdentifier(); $this->assertEquals('saml', $chunk->getPrefix()); diff --git a/tests/SAML2/XML/saml/ConditionTest.php b/tests/SAML2/XML/saml/ConditionTest.php index 3c4bd262bd..db0b156adb 100644 --- a/tests/SAML2/XML/saml/ConditionTest.php +++ b/tests/SAML2/XML/saml/ConditionTest.php @@ -4,21 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; -use SimpleSAML\SAML2\XML\saml\AbstractCondition; -use SimpleSAML\SAML2\XML\saml\AbstractConditionType; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\UnknownCondition; -use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\Test\SAML2\CustomCondition; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{ + AbstractCondition, + AbstractConditionType, + AbstractSamlElement, + Audience, + UnknownCondition, +}; +use SimpleSAML\Test\SAML2\{Constants as C, CustomCondition}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -78,9 +77,11 @@ public static function tearDownAfterClass(): void */ public function testMarshalling(): void { - $condition = new CustomCondition( - [new Audience('urn:some:audience')], - ); + $condition = new CustomCondition([ + new Audience( + SAMLAnyURIValue::fromString('urn:some:audience'), + ), + ]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -102,7 +103,10 @@ public function testUnmarshallingUnregistered(): void $condition = AbstractCondition::fromXML($element); $this->assertInstanceOf(UnknownCondition::class, $condition); - $this->assertEquals('urn:x-simplesamlphp:namespace:UnknownConditionType', $condition->getXsiType()); + $this->assertEquals( + '{urn:x-simplesamlphp:namespace}ssp:UnknownConditionType', + $condition->getXsiType()->getRawValue(), + ); $chunk = $condition->getRawCondition(); $this->assertEquals('saml', $chunk->getPrefix()); diff --git a/tests/SAML2/XML/saml/ConditionsTest.php b/tests/SAML2/XML/saml/ConditionsTest.php index 74140c1cf4..42de26b9d7 100644 --- a/tests/SAML2/XML/saml/ConditionsTest.php +++ b/tests/SAML2/XML/saml/ConditionsTest.php @@ -4,20 +4,21 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\AudienceRestriction; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\OneTimeUse; -use SimpleSAML\SAML2\XML\saml\ProxyRestriction; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + Audience, + AudienceRestriction, + Conditions, + OneTimeUse, + ProxyRestriction, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\NonNegativeIntegerValue; use function dirname; use function strval; @@ -56,22 +57,26 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $conditions = new Conditions( - new DateTimeImmutable('2014-07-17T01:01:18Z'), - new DateTimeImmutable('2024-01-18T06:21:48Z'), + SAMLDateTimeValue::fromString('2014-07-17T01:01:18Z'), + SAMLDateTimeValue::fromString('2024-01-18T06:21:48Z'), [], [ new AudienceRestriction( [ - new Audience('http://sp.example.com/demo1/metadata.php'), + new Audience( + SAMLAnyURIValue::fromString('http://sp.example.com/demo1/metadata.php'), + ), ], ), ], new OneTimeUse(), new ProxyRestriction( [ - new Audience('http://sp.example.com/demo2/metadata.php'), + new Audience( + SAMLAnyURIValue::fromString('http://sp.example.com/demo2/metadata.php'), + ), ], - 2, + NonNegativeIntegerValue::fromInteger(2), ), ); diff --git a/tests/SAML2/XML/saml/EncryptedAssertionTest.php b/tests/SAML2/XML/saml/EncryptedAssertionTest.php index 07487f386a..2f6b82747a 100644 --- a/tests/SAML2/XML/saml/EncryptedAssertionTest.php +++ b/tests/SAML2/XML/saml/EncryptedAssertionTest.php @@ -4,34 +4,39 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + Assertion, + EncryptedAssertion, + Issuer, + NameID, + Subject, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\RetrievalMethod; -use SimpleSAML\XMLSecurity\XML\ds\Transform; -use SimpleSAML\XMLSecurity\XML\ds\Transforms; -use SimpleSAML\XMLSecurity\XML\ds\XPath; -use SimpleSAML\XMLSecurity\XML\xenc\CipherData; -use SimpleSAML\XMLSecurity\XML\xenc\CipherValue; -use SimpleSAML\XMLSecurity\XML\xenc\EncryptedData; -use SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey; -use SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod; +use SimpleSAML\XMLSecurity\XML\ds\{ + KeyInfo, + RetrievalMethod, + Transform, + Transforms, + XPath, +}; +use SimpleSAML\XMLSecurity\XML\xenc\{ + CipherData, + CipherValue, + EncryptedData, + EncryptedKey, + EncryptionMethod, +}; use function dirname; use function strval; @@ -92,24 +97,42 @@ public static function tearDownAfterClass(): void */ public function testMarshalling(): void { - $transforms = new Transforms( - [new Transform(C::XPATH10_URI, new XPath('self::xenc:CipherValue[@Id="example1"]'))], + $transforms = new Transforms([ + new Transform( + SAMLAnyURIValue::fromString(C::XPATH10_URI), + new XPath( + StringValue::fromString('self::xenc:CipherValue[@Id="example1"]'), + ), + ), + ]); + + $retrievalMethod = new RetrievalMethod( + $transforms, + AnyURIValue::fromString('#Encrypted_KEY_ID'), + AnyURIValue::fromString(C::XMLENC_ENCRYPTEDKEY), ); - $retrievalMethod = new RetrievalMethod($transforms, '#Encrypted_KEY_ID', C::XMLENC_ENCRYPTEDKEY); $ek = new EncryptedKey( cipherData: new CipherData( - new CipherValue('sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU='), + new CipherValue( + Base64BinaryValue::fromString('sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU='), + ), + ), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString(C::KEY_TRANSPORT_OAEP_MGF1P), ), - encryptionMethod: new EncryptionMethod(C::KEY_TRANSPORT_OAEP_MGF1P), ); $ed = new EncryptedData( cipherData: new CipherData( - new CipherValue('mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5'), + new CipherValue( + Base64BinaryValue::fromString('mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5'), + ), + ), + type: AnyURIValue::fromString(C::XMLENC_ELEMENT), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString(C::BLOCK_ENC_AES256_GCM), ), - type: C::XMLENC_ELEMENT, - encryptionMethod: new EncryptionMethod(C::BLOCK_ENC_AES256_GCM), keyInfo: new KeyInfo([ $retrievalMethod, $ek, @@ -130,10 +153,16 @@ public function testMarshalling(): void public function testEncryption(): void { $assertion = new Assertion( - id: C::MSGID, - issueInstant: self::$clock->now(), - issuer: new Issuer('urn:x-simplesamlphp:issuer'), - subject: new Subject(new NameID('Someone')), + id: IDValue::fromString(C::MSGID), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + issuer: new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ), + subject: new Subject( + new NameID( + SAMLStringValue::fromString('Someone'), + ), + ), ); $encryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( @@ -148,7 +177,7 @@ public function testEncryption(): void $encAssertion = EncryptedAssertion::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encAssertion->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encAssertion->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::SELFSIGNED_PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/EncryptedAttributeTest.php b/tests/SAML2/XML/saml/EncryptedAttributeTest.php index 615981d495..a4ca2f3b7e 100644 --- a/tests/SAML2/XML/saml/EncryptedAttributeTest.php +++ b/tests/SAML2/XML/saml/EncryptedAttributeTest.php @@ -4,18 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\saml\EncryptedAttribute; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Attribute, AttributeValue, EncryptedAttribute}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -74,8 +69,10 @@ public static function tearDownAfterClass(): void public function testMarshalling(): void { $attribute = new Attribute( - name: 'urn:encrypted:attribute', - attributeValue: [new AttributeValue('very secret data')], + name: SAMLStringValue::fromString('urn:encrypted:attribute'), + attributeValue: [ + new AttributeValue('very secret data'), + ], ); $encryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( @@ -101,7 +98,7 @@ public function testDecryptAttribute(): void /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encryptedAttribute->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encryptedAttribute->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/EncryptedIDTest.php b/tests/SAML2/XML/saml/EncryptedIDTest.php index d2aa5b808b..f7fba6ff4d 100644 --- a/tests/SAML2/XML/saml/EncryptedIDTest.php +++ b/tests/SAML2/XML/saml/EncryptedIDTest.php @@ -5,34 +5,37 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use InvalidArgumentException; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\EncryptedID; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\UnknownID; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + Attribute, + Audience, + EncryptedID, + NameID, + UnknownID, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\Test\SAML2\CustomBaseID; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\xenc\CarriedKeyName; -use SimpleSAML\XMLSecurity\XML\xenc\CipherData; -use SimpleSAML\XMLSecurity\XML\xenc\CipherValue; -use SimpleSAML\XMLSecurity\XML\xenc\DataReference; -use SimpleSAML\XMLSecurity\XML\xenc\EncryptedData; -use SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey; -use SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod; -use SimpleSAML\XMLSecurity\XML\xenc\ReferenceList; +use SimpleSAML\XMLSecurity\XML\xenc\{ + CarriedKeyName, + CipherData, + CipherValue, + DataReference, + EncryptedData, + EncryptedKey, + EncryptionMethod, + ReferenceList, +}; use function dirname; use function strval; @@ -91,30 +94,46 @@ public function testMarshalling(): void { $ed = new EncryptedData( cipherData: new CipherData( - new CipherValue('720FAxwOXcv8ast9YvQutUoue+YA2FgLLNaD/FZrWiNexTkPyZ8CWrcf2zZj2zrOwTjQ9KJvzvCuzq4fM51sU1boOakLpz05NonDdMgeWW/eWcOJJfOZs0tYvYc5qZ/R+BzRnJsGG6w2ZmipEi88X/8uA85c'), + new CipherValue( + Base64BinaryValue::fromString('720FAxwOXcv8ast9YvQutUoue+YA2FgLLNaD/FZrWiNexTkPyZ8CWrcf2zZj2zrOwTjQ9KJvzvCuzq4fM51sU1boOakLpz05NonDdMgeWW/eWcOJJfOZs0tYvYc5qZ/R+BzRnJsGG6w2ZmipEi88X/8uA85c'), + ), + ), + type: AnyURIValue::fromString(C::XMLENC_ELEMENT), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2009xmlenc11#aes256-gcm'), ), - type: C::XMLENC_ELEMENT, - encryptionMethod: new EncryptionMethod('http://www.w3.org/2009xmlenc11#aes256-gcm'), keyInfo: new KeyInfo([ new EncryptedKey( cipherData: new CipherData( - new CipherValue('he5ZBjtfp/1/Y3PgE/CWspDPADig9vuZ7yZyYXDQ1wA/HBTPCldtL/p6UT5RCAFYUwN6kp3jnHkhK1yMjrI1SMw0n5NEc2wO9N5inQIeQOZ8XD9yD9M5fHvWz2ByNMGlB35RWMnBRHzDi1PRV7Irwcs9WoiODh3i6j2vYXP7cAo='), + new CipherValue( + Base64BinaryValue::fromString('he5ZBjtfp/1/Y3PgE/CWspDPADig9vuZ7yZyYXDQ1wA/HBTPCldtL/p6UT5RCAFYUwN6kp3jnHkhK1yMjrI1SMw0n5NEc2wO9N5inQIeQOZ8XD9yD9M5fHvWz2ByNMGlB35RWMnBRHzDi1PRV7Irwcs9WoiODh3i6j2vYXP7cAo='), + ), + ), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2009/xmlenc11#rsa-oaep'), ), - encryptionMethod: new EncryptionMethod('http://www.w3.org/2009/xmlenc11#rsa-oaep'), ), ]), ); $ek = new EncryptedKey( cipherData: new CipherData( - new CipherValue('he5ZBjtfp/1/Y3PgE/CWspDPADig9vuZ7yZyYXDQ1wA/HBTPCldtL/p6UT5RCAFYUwN6kp3jnHkhK1yMjrI1SMw0n5NEc2wO9N5inQIeQOZ8XD9yD9M5fHvWz2ByNMGlB35RWMnBRHzDi1PRV7Irwcs9WoiODh3i6j2vYXP7cAo='), + new CipherValue( + Base64BinaryValue::fromString('he5ZBjtfp/1/Y3PgE/CWspDPADig9vuZ7yZyYXDQ1wA/HBTPCldtL/p6UT5RCAFYUwN6kp3jnHkhK1yMjrI1SMw0n5NEc2wO9N5inQIeQOZ8XD9yD9M5fHvWz2ByNMGlB35RWMnBRHzDi1PRV7Irwcs9WoiODh3i6j2vYXP7cAo='), + ), + ), + id: IDValue::fromString('Encrypted_KEY_ID'), + recipient: StringValue::fromString(C::ENTITY_SP), + carriedKeyName: new CarriedKeyName( + StringValue::fromString('Name of the key'), ), - id: 'Encrypted_KEY_ID', - recipient: C::ENTITY_SP, - carriedKeyName: new CarriedKeyName('Name of the key'), - encryptionMethod: new EncryptionMethod('http://www.w3.org/2009/xmlenc11#rsa-oaep'), - referenceList: new ReferenceList( - [new DataReference('#Encrypted_DATA_ID')], + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2009/xmlenc11#rsa-oaep'), ), + referenceList: new ReferenceList([ + new DataReference( + AnyURIValue::fromString('#Encrypted_DATA_ID'), + ), + ]), ); $eid = new EncryptedID($ed, [$ek]); @@ -131,29 +150,46 @@ public function testMarshallingElementOrdering(): void { $ed = new EncryptedData( cipherData: new CipherData( - new CipherValue('iFz/8KASJCLCAHqaAKhZXWOG/TPZlgTxcQ25lTGxdSdEsGYz7cg5lfZAbcN3UITCP9MkJsyjMlRsQouIqBkoPCGZz8NXibDkQ8OUeE7JdkFgKvgUMXawp+uDL4gHR8L7l6SPAmWZU3Hx/Wg9pTJBOpTjwoS0'), + new CipherValue( + Base64BinaryValue::fromString('iFz/8KASJCLCAHqaAKhZXWOG/TPZlgTxcQ25lTGxdSdEsGYz7cg5lfZAbcN3UITCP9MkJsyjMlRsQouIqBkoPCGZz8NXibDkQ8OUeE7JdkFgKvgUMXawp+uDL4gHR8L7l6SPAmWZU3Hx/Wg9pTJBOpTjwoS0'), + ), + ), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2001/04/xmlenc#aes128-cbc'), ), - encryptionMethod: new EncryptionMethod('http://www.w3.org/2001/04/xmlenc#aes128-cbc'), + type: AnyURIValue::fromString(C::XMLENC_ELEMENT), keyInfo: new KeyInfo([ new EncryptedKey( cipherData: new CipherData( - new CipherValue('GMhpk09X+quNC/SsnxcDglZU/DCLAu9bMJ5bPcgaBK4s3F1eXciU8hlOYNaskSwP86HmA704NbzSDOHAgN6ckR+iCssxA7XCBjz0hltsgfn5p9Rh8qKtKltiXvxo/xXTcSXXZXNcE0R2KTya0P4DjZvYYgbIls/AH8ZyDV07ntI='), + new CipherValue( + Base64BinaryValue::fromString('GMhpk09X+quNC/SsnxcDglZU/DCLAu9bMJ5bPcgaBK4s3F1eXciU8hlOYNaskSwP86HmA704NbzSDOHAgN6ckR+iCssxA7XCBjz0hltsgfn5p9Rh8qKtKltiXvxo/xXTcSXXZXNcE0R2KTya0P4DjZvYYgbIls/AH8ZyDV07ntI='), + ), + ), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2009/xmlenc11#rsa-oaep'), ), - encryptionMethod: new EncryptionMethod('http://www.w3.org/2009/xmlenc11#rsa-oaep'), ), ]), ); $ek = new EncryptedKey( cipherData: new CipherData( - new CipherValue('GMhpk09X+quNC/SsnxcDglZU/DCLAu9bMJ5bPcgaBK4s3F1eXciU8hlOYNaskSwP86HmA704NbzSDOHAgN6ckR+iCssxA7XCBjz0hltsgfn5p9Rh8qKtKltiXvxo/xXTcSXXZXNcE0R2KTya0P4DjZvYYgbIls/AH8ZyDV07ntI='), + new CipherValue( + Base64BinaryValue::fromString('GMhpk09X+quNC/SsnxcDglZU/DCLAu9bMJ5bPcgaBK4s3F1eXciU8hlOYNaskSwP86HmA704NbzSDOHAgN6ckR+iCssxA7XCBjz0hltsgfn5p9Rh8qKtKltiXvxo/xXTcSXXZXNcE0R2KTya0P4DjZvYYgbIls/AH8ZyDV07ntI='), + ), + ), + id: IDValue::fromString('Encrypted_KEY_ID'), + recipient: StringValue::fromString(C::ENTITY_SP), + carriedKeyName: new CarriedKeyName( + StringValue::fromString('Name of the key'), ), - id: 'Encrypted_KEY_ID', - recipient: C::ENTITY_SP, - carriedKeyName: new CarriedKeyName('Name of the key'), - encryptionMethod: new EncryptionMethod('http://www.w3.org/2001/04/xmlenc#rsa-1_5'), - referenceList: new ReferenceList( - [new DataReference('#Encrypted_DATA_ID')], + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString('http://www.w3.org/2001/04/xmlenc#rsa-1_5'), ), + referenceList: new ReferenceList([ + new DataReference( + AnyURIValue::fromString('#Encrypted_DATA_ID'), + ), + ]), ); $eid = new EncryptedID($ed, [$ek]); $eidElement = $eid->toXML(); @@ -187,7 +223,11 @@ public function testEncryption(): void ); // test with a NameID - $nameid = new NameID('value', 'urn:x-simplesamlphp:namequalifier'); + $nameid = new NameID( + SAMLStringValue::fromString('value'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + ); + $encid = new EncryptedID($nameid->encrypt($encryptor)); /** @psalm-suppress ArgumentTypeCoercion */ $doc = DOMDocumentFactory::fromString(strval($encid)); @@ -195,7 +235,7 @@ public function testEncryption(): void $encid = EncryptedID::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), $privKey, ); $id = $encid->decrypt($decryptor); @@ -204,9 +244,13 @@ public function testEncryption(): void // test a custom BaseID that's registered $customId = new CustomBaseID( - [new Audience('urn:some:audience')], - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', + [ + new Audience( + SAMLAnyURIValue::fromString('urn:some:audience'), + ), + ], + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), ); $encid = new EncryptedID($customId->encrypt($encryptor)); @@ -216,7 +260,7 @@ public function testEncryption(): void $encid = EncryptedID::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), $privKey, ); $id = $encid->decrypt($decryptor); @@ -239,7 +283,7 @@ public function testEncryption(): void $encid = EncryptedID::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), $privKey, ); $id = $encid->decrypt($decryptor); @@ -248,7 +292,9 @@ public function testEncryption(): void $this->assertEquals(strval($unknownId), strval($id)); // test with unsupported ID - $attr = new Attribute('name'); + $attr = new Attribute( + SAMLStringValue::fromString('name'), + ); $encid = new EncryptedID($attr->encrypt($encryptor)); $this->expectException(InvalidArgumentException::class); diff --git a/tests/SAML2/XML/saml/EvidenceTest.php b/tests/SAML2/XML/saml/EvidenceTest.php index d862460232..8e341783fa 100644 --- a/tests/SAML2/XML/saml/EvidenceTest.php +++ b/tests/SAML2/XML/saml/EvidenceTest.php @@ -5,18 +5,18 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\AssertionIDRef; -use SimpleSAML\SAML2\XML\saml\AssertionURIRef; -use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; -use SimpleSAML\SAML2\XML\saml\Evidence; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + Assertion, + AssertionIDRef, + AssertionURIRef, + EncryptedAssertion, + Evidence, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/IssuerTest.php b/tests/SAML2/XML/saml/IssuerTest.php index 2baaca493d..2d2432eb8a 100644 --- a/tests/SAML2/XML/saml/IssuerTest.php +++ b/tests/SAML2/XML/saml/IssuerTest.php @@ -4,17 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameIDType; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Issuer, NameIDType}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -54,11 +51,11 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $issuer = new Issuer( - 'urn:x-simplesamlphp:issuer', - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', - 'urn:the:format', - 'TheSPProvidedID', + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + SAMLAnyURIValue::fromString('urn:the:format'), + SAMLStringValue::fromString('TheSPProvidedID'), ); $this->assertEquals( @@ -77,11 +74,11 @@ public function testMarshallingEntityFormat(): void $this->expectExceptionMessage('Illegal combination of attributes being used'); new Issuer( - 'urn:x-simplesamlphp:issuer', - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', - C::NAMEID_ENTITY, - 'TheSPProvidedID', + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + SAMLAnyURIValue::fromString(C::NAMEID_ENTITY), + SAMLStringValue::fromString('TheSPProvidedID'), ); } @@ -96,10 +93,10 @@ public function testMarshallingNoFormat(): void $this->expectExceptionMessage('Illegal combination of attributes being used'); new Issuer( - value: 'urn:x-simplesamlphp:issuer', - NameQualifier: 'urn:x-simplesamlphp:namequalifier', - SPNameQualifier: 'urn:x-simplesamlphp:spnamequalifier', - SPProvidedID: 'TheSPProvidedID', + value: SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + NameQualifier: SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SPNameQualifier: SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + SPProvidedID: SAMLStringValue::fromString('TheSPProvidedID'), ); } diff --git a/tests/SAML2/XML/saml/NameIDTest.php b/tests/SAML2/XML/saml/NameIDTest.php index 1ee59eb393..239fa2bd4f 100644 --- a/tests/SAML2/XML/saml/NameIDTest.php +++ b/tests/SAML2/XML/saml/NameIDTest.php @@ -4,16 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\NameIDType; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, NameID, NameIDType}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -62,11 +58,11 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $nameId = new NameID( - 'TheNameIDValue', - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', - 'urn:the:format', - 'TheSPProvidedID', + SAMLStringValue::fromString('TheNameIDValue'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + SAMLAnyURIValue::fromString('urn:the:format'), + SAMLStringValue::fromString('TheSPProvidedID'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/OneTimeUseTest.php b/tests/SAML2/XML/saml/OneTimeUseTest.php index da53a6b27c..1493a4a62b 100644 --- a/tests/SAML2/XML/saml/OneTimeUseTest.php +++ b/tests/SAML2/XML/saml/OneTimeUseTest.php @@ -4,15 +4,11 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractConditionType; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\OneTimeUse; +use SimpleSAML\SAML2\XML\saml\{AbstractConditionType, AbstractSamlElement, OneTimeUse}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/ProxyRestrictionTest.php b/tests/SAML2/XML/saml/ProxyRestrictionTest.php index a8bc6c1685..820e13b3fa 100644 --- a/tests/SAML2/XML/saml/ProxyRestrictionTest.php +++ b/tests/SAML2/XML/saml/ProxyRestrictionTest.php @@ -4,15 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\ProxyRestriction; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Audience, ProxyRestriction}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\NonNegativeIntegerValue; use function dirname; use function strval; @@ -52,10 +50,14 @@ public function testMarshalling(): void { $condition = new ProxyRestriction( [ - new Audience('urn:test:audience1'), - new Audience('urn:test:audience2'), + new Audience( + SAMLAnyURIValue::fromString('urn:test:audience1'), + ), + new Audience( + SAMLAnyURIValue::fromString('urn:test:audience2'), + ), ], - 2, + NonNegativeIntegerValue::fromInteger(2), ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/StatementTest.php b/tests/SAML2/XML/saml/StatementTest.php index 643d53a033..e863f23998 100644 --- a/tests/SAML2/XML/saml/StatementTest.php +++ b/tests/SAML2/XML/saml/StatementTest.php @@ -4,21 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\AbstractContainer; -use SimpleSAML\SAML2\Compat\ContainerSingleton; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\AbstractStatement; -use SimpleSAML\SAML2\XML\saml\AbstractStatementType; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\UnknownStatement; -use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\Test\SAML2\CustomStatement; +use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\{ + AbstractSamlElement, + AbstractStatement, + AbstractStatementType, + Audience, + UnknownStatement, +}; +use SimpleSAML\Test\SAML2\{Constants as C, CustomStatement}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -78,9 +77,11 @@ public static function tearDownAfterClass(): void */ public function testMarshalling(): void { - $statement = new CustomStatement( - [new Audience('urn:some:audience')], - ); + $statement = new CustomStatement([ + new Audience( + SAMLAnyURIValue::fromString('urn:some:audience'), + ), + ]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -122,7 +123,10 @@ public function testUnmarshallingUnregistered(): void $statement = AbstractStatement::fromXML($element); $this->assertInstanceOf(UnknownStatement::class, $statement); - $this->assertEquals('urn:x-simplesamlphp:namespace:UnknownStatementType', $statement->getXsiType()); + $this->assertEquals( + '{urn:x-simplesamlphp:namespace}ssp:UnknownStatementType', + $statement->getXsiType()->getRawValue(), + ); $chunk = $statement->getRawStatement(); $this->assertEquals('saml', $chunk->getPrefix()); diff --git a/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php index d9cecf5021..a6466b019c 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php @@ -4,20 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, SubjectConfirmationData}; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XML\{Attribute as XMLAttribute, Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{NCNameValue, StringValue}; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -57,17 +52,21 @@ public function testMarshalling(): void { $arbitrary = DOMDocumentFactory::fromString('Arbitrary Element'); - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $subjectConfirmationData = new SubjectConfirmationData( - new DateTimeImmutable('2001-04-19T04:25:21Z'), - new DateTimeImmutable('2009-02-13T23:31:30Z'), - C::ENTITY_SP, - 'SomeRequestID', - '127.0.0.1', + SAMLDateTimeValue::fromString('2001-04-19T04:25:21Z'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + EntityIDValue::fromString(C::ENTITY_SP), + NCNameValue::fromString('SomeRequestID'), + SAMLStringValue::fromString('127.0.0.1'), [ - new KeyInfo([new KeyName('SomeKey')]), + new KeyInfo([ + new KeyName( + StringValue::fromString('SomeKey'), + ), + ]), new Chunk($arbitrary->documentElement), ], [$attr1, $attr2], @@ -86,17 +85,21 @@ public function testMarshallingWithNonIPAddress(): void { $arbitrary = DOMDocumentFactory::fromString('Arbitrary Element'); - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $subjectConfirmationData = new SubjectConfirmationData( - new DateTimeImmutable('2001-04-19T04:25:21Z'), - new DateTimeImmutable('2009-02-13T23:31:30Z'), - C::ENTITY_SP, - 'SomeRequestID', - 'non-IP', + SAMLDateTimeValue::fromString('2001-04-19T04:25:21Z'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + EntityIDValue::fromString(C::ENTITY_SP), + NCNameValue::fromString('SomeRequestID'), + SAMLStringValue::fromString('non-IP'), [ - new KeyInfo([new KeyName('SomeKey')]), + new KeyInfo([ + new KeyName( + StringValue::fromString('SomeKey'), + ), + ]), new Chunk($arbitrary->documentElement), ], [$attr1, $attr2], @@ -104,15 +107,15 @@ public function testMarshallingWithNonIPAddress(): void $this->assertEquals( '2001-04-19T04:25:21Z', - $subjectConfirmationData->getNotBefore()->format(C::DATETIME_FORMAT), + $subjectConfirmationData->getNotBefore()->getValue(), ); $this->assertEquals( '2009-02-13T23:31:30Z', - $subjectConfirmationData->getNotOnOrAfter()->format(C::DATETIME_FORMAT), + $subjectConfirmationData->getNotOnOrAfter()->getValue(), ); - $this->assertEquals(C::ENTITY_SP, $subjectConfirmationData->getRecipient()); - $this->assertEquals('SomeRequestID', $subjectConfirmationData->getInResponseTo()); - $this->assertEquals('non-IP', $subjectConfirmationData->getAddress()); + $this->assertEquals(C::ENTITY_SP, $subjectConfirmationData->getRecipient()->getValue()); + $this->assertEquals('SomeRequestID', $subjectConfirmationData->getInResponseTo()->getValue()); + $this->assertEquals('non-IP', $subjectConfirmationData->getAddress()->getValue()); $attributes = $subjectConfirmationData->getAttributesNS(); $this->assertCount(2, $attributes); diff --git a/tests/SAML2/XML/saml/SubjectConfirmationTest.php b/tests/SAML2/XML/saml/SubjectConfirmationTest.php index c8ba3868e4..1105c6d4fd 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationTest.php @@ -4,27 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, NameID, SubjectConfirmation, SubjectConfirmationData}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\Exception\{MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{NCNameValue, StringValue}; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -66,25 +59,29 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $subjectConfirmation = new SubjectConfirmation( - C::CM_BEARER, + SAMLAnyURIValue::fromString(C::CM_BEARER), new NameID( - 'SomeNameIDValue', + SAMLStringValue::fromString('SomeNameIDValue'), null, - 'https://sp.example.org/authentication/sp/metadata', - C::NAMEID_TRANSIENT, + SAMLStringValue::fromString('https://sp.example.org/authentication/sp/metadata'), + SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), new SubjectConfirmationData( - new DateTimeImmutable('2001-04-19T04:25:21Z'), - new DateTimeImmutable('2009-02-13T23:31:30Z'), - C::ENTITY_SP, - 'SomeRequestID', - '127.0.0.1', + SAMLDateTimeValue::fromString('2001-04-19T04:25:21Z'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + EntityIDValue::fromString(C::ENTITY_SP), + NCNameValue::fromString('SomeRequestID'), + SAMLStringValue::fromString('127.0.0.1'), [ - new KeyInfo([new KeyName('SomeKey')]), + new KeyInfo([ + new KeyName( + StringValue::fromString('SomeKey'), + ), + ]), new Chunk(DOMDocumentFactory::fromString('Arbitrary Element')->documentElement), ], [$attr1, $attr2], @@ -103,8 +100,10 @@ public function testMarshalling(): void public function testMarshallingEmptySubjectConfirmationData(): void { $subjectConfirmation = new SubjectConfirmation( - C::CM_BEARER, - new NameID('SomeNameIDValue'), + SAMLAnyURIValue::fromString(C::CM_BEARER), + new NameID( + SAMLStringValue::fromString('SomeNameIDValue'), + ), new SubjectConfirmationData(), ); $ns_saml = C::NS_SAML; @@ -130,9 +129,13 @@ public function testMarshallingEmptySubjectConfirmationData(): void public function testMarshallingElementOrdering(): void { $subjectConfirmation = new SubjectConfirmation( - C::CM_BEARER, - new NameID('SomeNameIDValue'), - new SubjectConfirmationData(self::$clock->now()), + SAMLAnyURIValue::fromString(C::CM_BEARER), + new NameID( + SAMLStringValue::fromString('SomeNameIDValue'), + ), + new SubjectConfirmationData( + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ), ); // Marshall it to a \DOMElement @@ -203,7 +206,7 @@ public function testMultipleIdentifiers(): void $document = DOMDocumentFactory::fromString( << - SomeNameIDValue + SomeNameIDValue AnotherNameIDValue @@ -229,8 +232,8 @@ public function testManySubjectConfirmationDataThrowsException(): void << SomeNameIDValue - - + + XML , diff --git a/tests/SAML2/XML/saml/SubjectLocalityTest.php b/tests/SAML2/XML/saml/SubjectLocalityTest.php index ba886c8f8b..35f6a961cc 100644 --- a/tests/SAML2/XML/saml/SubjectLocalityTest.php +++ b/tests/SAML2/XML/saml/SubjectLocalityTest.php @@ -4,15 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\SubjectLocality; +use SimpleSAML\SAML2\Type\{DomainValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, SubjectLocality}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -51,8 +49,8 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $subjectLocality = new SubjectLocality( - '1.1.1.1', - 'idp.example.org', + SAMLStringValue::fromString('1.1.1.1'), + DomainValue::fromString('idp.example.org'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/SubjectTest.php b/tests/SAML2/XML/saml/SubjectTest.php index 2faa0acfa1..ef6a8b7986 100644 --- a/tests/SAML2/XML/saml/SubjectTest.php +++ b/tests/SAML2/XML/saml/SubjectTest.php @@ -4,29 +4,26 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use DateTimeImmutable; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\AbstractBaseID; -use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; -use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; -use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\Test\SAML2\CustomBaseID; -use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\SAML2\XML\saml\{ + AbstractBaseID, + AbstractSamlElement, + Audience, + NameID, + Subject, + SubjectConfirmation, + SubjectConfirmationData, +}; +use SimpleSAML\Test\SAML2\{Constants as C, CustomBaseID}; +use SimpleSAML\XML\{Attribute as XMLAttribute, Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\KeyName; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{NCNameValue, StringValue}; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; use function strval; @@ -96,17 +93,19 @@ public function testMarshalling(): void { $arbitrary = DOMDocumentFactory::fromString('Arbitrary Element'); - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $subjectConfirmationData = new SubjectConfirmationData( - new DateTimeImmutable('2001-04-19T04:25:21Z'), - new DateTimeImmutable('2009-02-13T23:31:30Z'), - C::ENTITY_SP, - 'SomeRequestID', - '127.0.0.1', + SAMLDateTimeValue::fromString('2001-04-19T04:25:21Z'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + EntityIDValue::fromString(C::ENTITY_SP), + NCNameValue::fromString('SomeRequestID'), + SAMLStringValue::fromString('127.0.0.1'), [ - new KeyInfo([new KeyName('SomeKey')]), + new KeyInfo([ + new KeyName(StringValue::fromString('SomeKey')), + ]), new Chunk($arbitrary->documentElement), ], [$attr1, $attr2], @@ -114,17 +113,19 @@ public function testMarshalling(): void $subject = new Subject( new NameID( - value: 'SomeNameIDValue', - SPNameQualifier: 'https://sp.example.org/authentication/sp/metadata', - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString('SomeNameIDValue'), + SPNameQualifier: SAMLStringValue::fromString('https://sp.example.org/authentication/sp/metadata'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), [ new SubjectConfirmation( - 'urn:oasis:names:tc:SAML:2.0:cm:bearer', + SAMLAnyURIValue::fromString('urn:oasis:names:tc:SAML:2.0:cm:bearer'), new NameID( - value: 'SomeOtherNameIDValue', - SPNameQualifier: 'https://sp.example.org/authentication/sp/metadata', - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString('SomeOtherNameIDValue'), + SPNameQualifier: SAMLStringValue::fromString( + 'https://sp.example.org/authentication/sp/metadata', + ), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), $subjectConfirmationData, ), @@ -144,17 +145,19 @@ public function testMarshallingElementOrdering(): void { $arbitrary = DOMDocumentFactory::fromString('Arbitrary Element'); - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $subjectConfirmationData = new SubjectConfirmationData( - new DateTimeImmutable('2001-04-19T04:25:21Z'), - new DateTimeImmutable('2009-02-13T23:31:30Z'), - C::ENTITY_SP, - 'SomeRequestID', - '127.0.0.1', + SAMLDateTimeValue::fromString('2001-04-19T04:25:21Z'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + EntityIDValue::fromString(C::ENTITY_SP), + NCNameValue::fromString('SomeRequestID'), + SAMLStringValue::fromString('127.0.0.1'), [ - new KeyInfo([new KeyName('SomeKey')]), + new KeyInfo([ + new KeyName(StringValue::fromString('SomeKey')), + ]), new Chunk($arbitrary->documentElement), ], [$attr1, $attr2], @@ -162,17 +165,19 @@ public function testMarshallingElementOrdering(): void $subject = new Subject( new NameID( - value: 'SomeNameIDValue', - SPNameQualifier: 'https://sp.example.org/authentication/sp/metadata', - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString('SomeNameIDValue'), + SPNameQualifier: SAMLStringValue::fromString('https://sp.example.org/authentication/sp/metadata'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), [ new SubjectConfirmation( - 'urn:oasis:names:tc:SAML:2.0:cm:bearer', + SAMLAnyURIValue::fromString('urn:oasis:names:tc:SAML:2.0:cm:bearer'), new NameID( - value: 'SomeOtherNameIDValue', - SPNameQualifier: 'https://sp.example.org/authentication/sp/metadata', - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString('SomeOtherNameIDValue'), + SPNameQualifier: SAMLStringValue::fromString( + 'https://sp.example.org/authentication/sp/metadata', + ), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), $subjectConfirmationData, ), @@ -201,17 +206,19 @@ public function testMarshallingBaseID(): void { $arbitrary = DOMDocumentFactory::fromString('Arbitrary Element'); - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', 'testval2'); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', StringValue::fromString('testval1')); + $attr2 = new XMLAttribute('urn:test:something', 'test', 'attr2', StringValue::fromString('testval2')); $subjectConfirmationData = new SubjectConfirmationData( - new DateTimeImmutable('2001-04-19T04:25:21Z'), - new DateTimeImmutable('2009-02-13T23:31:30Z'), - C::ENTITY_SP, - 'SomeRequestID', - '127.0.0.1', + SAMLDateTimeValue::fromString('2001-04-19T04:25:21Z'), + SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), + EntityIDValue::fromString(C::ENTITY_SP), + NCNameValue::fromString('SomeRequestID'), + SAMLStringValue::fromString('127.0.0.1'), [ - new KeyInfo([new KeyName('SomeKey')]), + new KeyInfo([ + new KeyName(StringValue::fromString('SomeKey')), + ]), new Chunk($arbitrary->documentElement), ], [$attr1, $attr2], @@ -219,17 +226,21 @@ public function testMarshallingBaseID(): void $subject = new Subject( new CustomBaseID( - [new Audience('urn:some:audience')], - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', + [ + new Audience(EntityIDValue::fromString('urn:some:audience')), + ], + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), ), [ new SubjectConfirmation( - 'urn:oasis:names:tc:SAML:2.0:cm:bearer', + SAMLAnyURIValue::fromString('urn:oasis:names:tc:SAML:2.0:cm:bearer'), new NameID( - value: 'SomeNameIDValue', - SPNameQualifier: 'https://sp.example.org/authentication/sp/metadata', - Format: C::NAMEID_TRANSIENT, + value: SAMLStringValue::fromString('SomeNameIDValue'), + SPNameQualifier: SAMLStringValue::fromString( + 'https://sp.example.org/authentication/sp/metadata', + ), + Format: SAMLAnyURIValue::fromString(C::NAMEID_TRANSIENT), ), $subjectConfirmationData, ), @@ -316,7 +327,7 @@ public function testMultipleIdentifiers(): void $document = DOMDocumentFactory::fromString( << - + urn:some:audience documentElement); - $this->assertEquals('2.0', $unsignedMessage->getVersion()); - $unsignedMessage->sign($signer); $signedMessage = MessageFactory::fromXML($unsignedMessage->toXML()); @@ -140,12 +140,25 @@ public function testIssuerParsedAsNameID(): void #[Group('Message')] public function testConvertIssuerToXML(): void { - $status = new Status(new StatusCode()); + $status = new Status( + new StatusCode( + SAMLAnyURIValue::fromString( + C::STATUS_SUCCESS, + ), + ), + ); // first, try with common Issuer objects (Format=entity) - $issuer = new Issuer('https://gateway.stepup.org/saml20/sp/metadata'); + $issuer = new Issuer( + SAMLStringValue::fromString('https://gateway.stepup.org/saml20/sp/metadata'), + ); - $response = new Response($status, self::$clock->now(), $issuer); + $response = new Response( + id: IDValue::fromString('SomeIDValue'), + status: $status, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + issuer: $issuer, + ); $xml = $response->toXML(); $xpCache = XPath::getXPath($xml); $xml_issuer = XPath::xpQuery($xml, './saml_assertion:Issuer', $xpCache); @@ -156,13 +169,18 @@ public function testConvertIssuerToXML(): void // now, try an Issuer with another format and attributes $issuer = new Issuer( - 'https://gateway.stepup.org/saml20/sp/metadata', - 'urn:x-simplesamlphp:namequalifier', - 'urn:x-simplesamlphp:spnamequalifier', - C::NAMEID_UNSPECIFIED, - 'SomeSPProvidedID', + SAMLStringValue::fromString('https://gateway.stepup.org/saml20/sp/metadata'), + SAMLStringValue::fromString('urn:x-simplesamlphp:namequalifier'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + SAMLAnyURIValue::fromString(C::NAMEID_UNSPECIFIED), + SAMLStringValue::fromString('SomeSPProvidedID'), + ); + $response = new Response( + id: IDValue::fromString('SomeIDValue'), + status: $status, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + issuer: $issuer, ); - $response = new Response($status, self::$clock->now(), $issuer); $xml = $response->toXML(); $xpCache = XPath::getXPath($xml); $xml_issuer = XPath::xpQuery($xml, './saml_assertion:Issuer', $xpCache); @@ -176,7 +194,11 @@ public function testConvertIssuerToXML(): void $this->assertEquals($issuer->getSPProvidedID(), $xml_issuer->getAttribute('SPProvidedID')); // finally, make sure we can skip the Issuer by setting it to null - $response = new Response($status, self::$clock->now()); + $response = new Response( + id: IDValue::fromString('SomeIDValue'), + status: $status, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); $xml = $response->toXML(); $xpCache = XPath::getXPath($xml); diff --git a/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php b/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php index fe35fce085..77e968a488 100644 --- a/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php +++ b/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php @@ -4,26 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, DomainValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; -use SimpleSAML\SAML2\XML\samlp\Extensions; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; -use SimpleSAML\SAML2\XML\samlp\StatusMessage; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractSamlpElement, + AbstractStatusResponse, + Extensions, + Response, + Status, + StatusCode, + StatusMessage, +}; use SimpleSAML\SAML2\XML\shibmd\Scope; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\Exception\MissingElementException; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -56,17 +58,23 @@ public function testMarshalling(): void { $status = new Status( new StatusCode( - C::STATUS_SUCCESS, + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), [ new StatusCode( - 'urn:test:OurSubStatusCode', + SAMLAnyURIValue::fromString('urn:test:OurSubStatusCode'), ), ], ), - new StatusMessage('OurMessageText'), + new StatusMessage( + SAMLStringValue::fromString('OurMessageText'), + ), ); - $response = new Response($status, self::$clock->now()); + $response = new Response( + id: IDValue::fromString('SomeIDValue'), + status: $status, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); $responseElement = $response->toXML(); @@ -96,21 +104,27 @@ public function testMarshallingSignedResponseElementOrdering(): void { $status = new Status( new StatusCode( - C::STATUS_SUCCESS, + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), [ - new StatusCode('urn:test:OurSubStatusCode'), + new StatusCode( + SAMLAnyURIValue::fromString('urn:test:OurSubStatusCode'), + ), ], ), - new StatusMessage('OurMessageText'), + new StatusMessage( + SAMLStringValue::fromString('OurMessageText'), + ), ); - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); - $scope = new Scope("scope"); + $scope = new Scope( + DomainValue::fromString('scope.org'), + ); - $extensions = new Extensions([ - new Chunk($scope->toXML()), - ]); + $extensions = new Extensions([$scope]); $signer = (new SignatureAlgorithmFactory())->getAlgorithm( C::SIG_RSA_SHA256, @@ -118,7 +132,8 @@ public function testMarshallingSignedResponseElementOrdering(): void ); $response = new Response( - issueInstant: self::$clock->now(), + id: IDValue::fromString('SomeIDValue'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), status: $status, issuer: $issuer, extensions: $extensions, diff --git a/tests/SAML2/XML/samlp/ArtifactResolveTest.php b/tests/SAML2/XML/samlp/ArtifactResolveTest.php index 25b30f027c..f6e6621021 100644 --- a/tests/SAML2/XML/samlp/ArtifactResolveTest.php +++ b/tests/SAML2/XML/samlp/ArtifactResolveTest.php @@ -4,19 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractRequest; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\Artifact; -use SimpleSAML\SAML2\XML\samlp\ArtifactResolve; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractRequest, + AbstractSamlpElement, + Artifact, + ArtifactResolve, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{Base64BinaryValue, IDValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -53,15 +54,16 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $issuer = new Issuer('https://ServiceProvider.com/SAML'); - $artifact = 'AAQAADWNEw5VT47wcO4zX/iEzMmFQvGknDfws2ZtqSGdkNSbsW1cmVR0bzU='; + $issuer = new Issuer( + SAMLStringValue::fromString('https://ServiceProvider.com/SAML'), + ); + $artifact = Base64BinaryValue::fromString('AAQAADWNEw5VT47wcO4zX/iEzMmFQvGknDfws2ZtqSGdkNSbsW1cmVR0bzU='); $artifactResolve = new ArtifactResolve( + IDValue::fromString('_6c3a4f8b9c2d'), new Artifact($artifact), - new DateTimeImmutable('2004-01-21T19:00:49Z'), + SAMLDateTimeValue::fromString('2004-01-21T19:00:49Z'), $issuer, - '_6c3a4f8b9c2d', - '2.0', ); $this->assertEquals( diff --git a/tests/SAML2/XML/samlp/ArtifactResponseTest.php b/tests/SAML2/XML/samlp/ArtifactResponseTest.php index b589aa0afd..388d8004b4 100644 --- a/tests/SAML2/XML/samlp/ArtifactResponseTest.php +++ b/tests/SAML2/XML/samlp/ArtifactResponseTest.php @@ -4,23 +4,24 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; -use SimpleSAML\SAML2\XML\samlp\ArtifactResponse; -use SimpleSAML\SAML2\XML\samlp\AuthnRequest; -use SimpleSAML\SAML2\XML\samlp\NameIDPolicy; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractSamlpElement, + AbstractStatusResponse, + ArtifactResponse, + AuthnRequest, + NameIDPolicy, + Status, + StatusCode, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -57,20 +58,22 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $issuer2 = new Issuer('urn:example:other'); - $id = '_306f8ec5b618f361c70b6ffb1480eade'; - $issueInstant = new DateTimeImmutable('2004-12-05T09:21:59Z'); - $destination = 'https://idp.example.org/SAML2/SSO/Artifact'; - $protocolBinding = C::BINDING_HTTP_ARTIFACT; - $assertionConsumerServiceURL = 'https://sp.example.com/SAML2/SSO/Artifact'; + $issuer2 = new Issuer( + SAMLStringValue::fromString('urn:example:other'), + ); + $id = IDValue::fromString('_306f8ec5b618f361c70b6ffb1480eade'); + $issueInstant = SAMLDateTimeValue::fromString('2004-12-05T09:21:59Z'); + $destination = SAMLAnyURIValue::fromString('https://idp.example.org/SAML2/SSO/Artifact'); + $protocolBinding = SAMLAnyURIValue::fromString(C::BINDING_HTTP_ARTIFACT); + $assertionConsumerServiceURL = SAMLAnyURIValue::fromString('https://sp.example.com/SAML2/SSO/Artifact'); $nameIdPolicy = new NameIDPolicy( - Format: C::NAMEID_EMAIL_ADDRESS, - AllowCreate: false, + Format: SAMLAnyURIValue::fromString(C::NAMEID_EMAIL_ADDRESS), + AllowCreate: BooleanValue::fromBoolean(false), ); $authnRequest = new AuthnRequest( nameIdPolicy: $nameIdPolicy, - issueInstant: new DateTimeImmutable('2004-12-05T09:21:59Z'), + issueInstant: SAMLDateTimeValue::fromString('2004-12-05T09:21:59Z'), assertionConsumerServiceURL: $assertionConsumerServiceURL, protocolBinding: $protocolBinding, issuer: $issuer2, @@ -78,14 +81,20 @@ public function testMarshalling(): void destination: $destination, ); - $status = new Status(new StatusCode()); - $issuer1 = new Issuer('https://sp.example.com/SAML2'); + $status = new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ); + $issuer1 = new Issuer( + SAMLStringValue::fromString('https://sp.example.com/SAML2'), + ); $artifactResponse = new ArtifactResponse( status: $status, issuer: $issuer1, - id: '_d84a49e5958803dedcff4c984c2b0d95', - issueInstant: new DateTimeImmutable('2004-12-05T09:21:59Z'), - inResponseTo: '_cce4ee769ed970b501d680f697989d14', + id: IDValue::fromString('_d84a49e5958803dedcff4c984c2b0d95'), + issueInstant: SAMLDateTimeValue::fromString('2004-12-05T09:21:59Z'), + inResponseTo: NCNameValue::fromString('_cce4ee769ed970b501d680f697989d14'), message: $authnRequest, ); diff --git a/tests/SAML2/XML/samlp/ArtifactTest.php b/tests/SAML2/XML/samlp/ArtifactTest.php index 0cde2283a9..9ace382d02 100644 --- a/tests/SAML2/XML/samlp/ArtifactTest.php +++ b/tests/SAML2/XML/samlp/ArtifactTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\Artifact; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, Artifact}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\Base64BinaryValue; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $artifact = new Artifact('AAQAAM0ARI+cUaUKAx19/KC3fOV/vznNj8oE0JKKPQC8nTesXxPke7uRy+8='); + $artifact = new Artifact( + Base64BinaryValue::fromString('AAQAAM0ARI+cUaUKAx19/KC3fOV/vznNj8oE0JKKPQC8nTesXxPke7uRy+8='), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/samlp/AssertionIDRequestTest.php b/tests/SAML2/XML/samlp/AssertionIDRequestTest.php index 8b91d21be8..5ec5300353 100644 --- a/tests/SAML2/XML/samlp/AssertionIDRequestTest.php +++ b/tests/SAML2/XML/samlp/AssertionIDRequestTest.php @@ -4,19 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\AssertionIDRef; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractRequest; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AssertionIDRequest; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{AssertionIDRef, Issuer}; +use SimpleSAML\SAML2\XML\samlp\{AbstractMessage, AbstractRequest, AbstractSamlpElement, AssertionIDRequest}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -59,11 +54,20 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $assertionIDRequest = new AssertionIDRequest( - assertionIDRef: [new AssertionIDRef('_abc123'), new AssertionIDRef('_def456')], - issuer: new Issuer('https://gateway.stepup.org/saml20/sp/metadata'), - id: '_2b0226190ca1c22de6f66e85f5c95158', - issueInstant: new DateTimeImmutable('2014-09-22T13:42:00Z'), - destination: 'https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO', + assertionIDRef: [ + new AssertionIDRef( + NCNameValue::fromString('_abc123'), + ), + new AssertionIDRef( + NCNameValue::fromString('_def456'), + ), + ], + issuer: new Issuer( + SAMLStringValue::fromString('https://gateway.stepup.org/saml20/sp/metadata'), + ), + id: IDValue::fromString('_2b0226190ca1c22de6f66e85f5c95158'), + issueInstant: SAMLDateTimeValue::fromString('2014-09-22T13:42:00Z'), + destination: SAMLAnyURIValue::fromString('https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/samlp/AttributeQueryTest.php b/tests/SAML2/XML/samlp/AttributeQueryTest.php index a706a366a7..a7279f9760 100644 --- a/tests/SAML2/XML/samlp/AttributeQueryTest.php +++ b/tests/SAML2/XML/samlp/AttributeQueryTest.php @@ -4,30 +4,25 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractRequest; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AbstractSubjectQuery; -use SimpleSAML\SAML2\XML\samlp\AttributeQuery; +use SimpleSAML\SAML2\XML\saml\{Attribute, AttributeValue, Issuer, NameID, Subject}; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractRequest, + AbstractSamlpElement, + AbstractSubjectQuery, + AttributeQuery, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\{MissingAttributeException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -73,20 +68,23 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $nameId = new NameID('urn:example:subject', null, null, C::NAMEID_UNSPECIFIED); + $nameId = new NameID( + value: SAMLStringValue::fromString('urn:example:subject'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_UNSPECIFIED), + ); $attributeQuery = new AttributeQuery( subject: new Subject($nameId), attributes: [ new Attribute( - name: 'test1', + name: SAMLStringValue::fromString('test1'), attributeValue: [ new AttributeValue('test1_attrv1'), new AttributeValue('test1_attrv2'), ], ), new Attribute( - name: 'test2', + name: SAMLStringValue::fromString('test2'), attributeValue: [ new AttributeValue('test2_attrv1'), new AttributeValue('test2_attrv2'), @@ -94,10 +92,10 @@ public function testMarshalling(): void ], ), new Attribute( - name: 'test3', + name: SAMLStringValue::fromString('test3'), ), new Attribute( - name: 'test4', + name: SAMLStringValue::fromString('test4'), attributeValue: [ new AttributeValue(4), new AttributeValue(23), @@ -105,11 +103,11 @@ public function testMarshalling(): void ), ], issuer: new Issuer( - value: 'https://example.org/', - Format: C::NAMEID_ENTITY, + value: SAMLStringValue::fromString('https://example.org/'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_ENTITY), ), - id: 'aaf23196-1773-2113-474a-fe114412ab72', - issueInstant: new DateTimeImmutable('2017-09-06T11:49:27Z'), + id: IDValue::fromString('aaf23196-1773-2113-474a-fe114412ab72'), + issueInstant: SAMLDateTimeValue::fromString('2017-09-06T11:49:27Z'), ); $this->assertEquals( @@ -121,22 +119,25 @@ public function testMarshalling(): void public function testAttributeNameFormat(): void { - $nameId = new NameID('NameIDValue'); + $nameId = new NameID( + SAMLStringValue::fromString('NameIDValue'), + ); $attributeQuery = new AttributeQuery( + id: IDValue::fromString('SomeIDValue'), subject: new Subject($nameId), - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), attributes: [ new Attribute( - name: 'test1', - nameFormat: C::NAMEFORMAT_BASIC, + name: SAMLStringValue::fromString('test1'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), attributeValue: [ new AttributeValue('test1_attrv1'), new AttributeValue('test1_attrv2'), ], ), new Attribute( - name: 'test2', - nameFormat: C::NAMEFORMAT_BASIC, + name: SAMLStringValue::fromString('test2'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), attributeValue: [ new AttributeValue('test2_attrv1'), new AttributeValue('test2_attrv2'), @@ -144,8 +145,8 @@ public function testAttributeNameFormat(): void ], ), new Attribute( - name: 'test3', - nameFormat: C::NAMEFORMAT_BASIC, + name: SAMLStringValue::fromString('test3'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), ), ], ); diff --git a/tests/SAML2/XML/samlp/AuthnQueryTest.php b/tests/SAML2/XML/samlp/AuthnQueryTest.php index 43c69598b6..9ec7e10f4a 100644 --- a/tests/SAML2/XML/samlp/AuthnQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthnQueryTest.php @@ -4,25 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\Comparison; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractRequest; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AbstractSubjectQuery; -use SimpleSAML\SAML2\XML\samlp\AuthnQuery; -use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; +use SimpleSAML\SAML2\XML\saml\{AuthnContextDeclRef, Issuer, NameID, Subject}; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractRequest, + AbstractSamlpElement, + AbstractSubjectQuery, + AuthnQuery, + RequestedAuthnContext, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -62,20 +60,25 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $nameId = new NameID('urn:example:subject', null, null, C::NAMEID_UNSPECIFIED); - $authnContextDeclRef = new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'); + $nameId = new NameID( + value: SAMLStringValue::fromString('urn:example:subject'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_UNSPECIFIED), + ); + $authnContextDeclRef = new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ); $requestedAuthnContext = new RequestedAuthnContext([$authnContextDeclRef], Comparison::EXACT); $authnQuery = new AuthnQuery( + id: IDValue::fromString('aaf23196-1773-2113-474a-fe114412ab72'), subject: new Subject($nameId), requestedAuthnContext: $requestedAuthnContext, issuer: new Issuer( - value: 'https://example.org/', - Format: C::NAMEID_ENTITY, + value: SAMLStringValue::fromString('https://example.org/'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_ENTITY), ), - id: 'aaf23196-1773-2113-474a-fe114412ab72', - issueInstant: new DateTimeImmutable('2017-09-06T11:49:27Z'), - sessionIndex: 'phpunit', + issueInstant: SAMLDateTimeValue::fromString('2017-09-06T11:49:27Z'), + sessionIndex: SAMLStringValue::fromString('phpunit'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/samlp/AuthnRequestTest.php b/tests/SAML2/XML/samlp/AuthnRequestTest.php index 45a9761d36..e96477b514 100644 --- a/tests/SAML2/XML/samlp/AuthnRequestTest.php +++ b/tests/SAML2/XML/samlp/AuthnRequestTest.php @@ -4,45 +4,46 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\Comparison; -use SimpleSAML\SAML2\XML\saml\Audience; -use SimpleSAML\SAML2\XML\saml\AudienceRestriction; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\Conditions; -use SimpleSAML\SAML2\XML\saml\EncryptedID; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\OneTimeUse; -use SimpleSAML\SAML2\XML\saml\ProxyRestriction; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AuthnRequest; -use SimpleSAML\SAML2\XML\samlp\GetComplete; -use SimpleSAML\SAML2\XML\samlp\IDPEntry; -use SimpleSAML\SAML2\XML\samlp\IDPList; -use SimpleSAML\SAML2\XML\samlp\NameIDPolicy; -use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; -use SimpleSAML\SAML2\XML\samlp\RequesterID; -use SimpleSAML\SAML2\XML\samlp\Scoping; +use SimpleSAML\SAML2\XML\saml\{ + Audience, + AudienceRestriction, + AuthnContextClassRef, + Conditions, + EncryptedID, + Issuer, + NameID, + OneTimeUse, + ProxyRestriction, + Subject, +}; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractSamlpElement, + AuthnRequest, + GetComplete, + IDPEntry, + IDPList, + NameIDPolicy, + RequestedAuthnContext, + RequesterID, + Scoping, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\{MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{BooleanValue, IDValue, NonNegativeIntegerValue, UnsignedShortValue}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; -use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; -use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; +use SimpleSAML\XMLSecurity\TestUtils\{PEMCertificatesMock, SignedElementTestTrait}; use function dirname; use function strval; @@ -88,17 +89,19 @@ public function testMarshalling(): void { $subject = new Subject( new NameID( - value: 'user@example.org', - Format: C::NAMEID_UNSPECIFIED, + value: SAMLStringValue::fromString('user@example.org'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_UNSPECIFIED), ), ); $authnRequest = new AuthnRequest( subject: $subject, - issuer: new Issuer('https://gateway.stepup.org/saml20/sp/metadata'), - id: '_2b0226190ca1c22de6f66e85f5c95158', - issueInstant: new DateTimeImmutable('2014-09-22T13:42:00Z'), - destination: 'https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO', + issuer: new Issuer( + SAMLStringValue::fromString('https://gateway.stepup.org/saml20/sp/metadata'), + ), + id: IDValue::fromString('_2b0226190ca1c22de6f66e85f5c95158'), + issueInstant: SAMLDateTimeValue::fromString('2014-09-22T13:42:00Z'), + destination: SAMLAnyURIValue::fromString('https://tiqr.stepup.org/idp/profile/saml2/Redirect/SSO'), ); $this->assertEquals( @@ -113,59 +116,84 @@ public function testMarshallingElementOrdering(): void // Create RequestedAuthnContext $rac = new RequestedAuthnContext( [ - new AuthnContextClassRef('urn:test:accr1'), - new AuthnContextClassRef('urn:test:accr2'), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString('urn:test:accr1'), + ), + new AuthnContextClassRef( + SAMLAnyURIValue::fromString('urn:test:accr2'), + ), ], Comparison::BETTER, ); // Create Subject $subject = new Subject( - new Issuer('urn:x-simplesamlphp:issuer'), + new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ), ); // Create NameIDPolicy $nameIdPolicy = new NameIDPolicy( - 'urn:the:format', - 'urn:x-simplesamlphp:spnamequalifier', - true, + SAMLAnyURIValue::fromString('urn:the:format'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + BooleanValue::fromBoolean(true), ); // Create Conditions $conditions = new Conditions( - new DateTimeImmutable('1970-01-01T01:33:31Z'), - new DateTimeImmutable('1970-01-02T01:33:31Z'), + SAMLDateTimeValue::fromString('1970-01-01T01:33:31Z'), + SAMLDateTimeValue::fromString('1970-01-02T01:33:31Z'), [], [ new AudienceRestriction( [ - new Audience('http://sp.example.com/demo1/metadata.php'), + new Audience( + SAMLAnyURIValue::fromstring('http://sp.example.com/demo1/metadata.php'), + ), ], ), ], new OneTimeUse(), new ProxyRestriction( [ - new Audience('http://sp.example.com/demo2/metadata.php'), + new Audience( + SAMLAnyURIValue::fromString('http://sp.example.com/demo2/metadata.php'), + ), ], - 2, + NonNegativeIntegerValue::fromInteger(2), ), ); // Create Scoping - $entry1 = new IDPEntry('urn:some:requester1', 'testName1', 'urn:test:testLoc1'); - $getComplete = new GetComplete('https://some/location'); + $entry1 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester1'), + SAMLStringValue::fromString('testName1'), + SAMLAnyURIValue::fromString('urn:test:testLoc1'), + ); + $getComplete = new GetComplete( + SAMLAnyURIValue::fromString('https://some/location'), + ); $list = new IDPList([$entry1], $getComplete); - $requesterId = new RequesterID('urn:some:requester'); - $scoping = new Scoping(2, $list, [$requesterId]); + $requesterId = new RequesterID( + EntityIDValue::fromString('urn:some:requester'), + ); + $scoping = new Scoping( + NonNegativeIntegerValue::fromInteger(2), + $list, + [$requesterId], + ); $authnRequest = new AuthnRequest( + id: IDValue::fromString('SomeIDValue'), requestedAuthnContext: $rac, - issueInstant: self::$clock->now(), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), subject: $subject, nameIdPolicy: $nameIdPolicy, conditions: $conditions, - issuer: new Issuer('https://gateway.stepup.org/saml20/sp/metadata'), + issuer: new Issuer( + SAMLStringValue::fromString('https://gateway.stepup.org/saml20/sp/metadata'), + ), scoping: $scoping, ); @@ -199,28 +227,27 @@ public function testUnmarshallingOfSimpleRequest(): void $xml = << - https://sp.example.com/SAML2 + https://sp.example.com/SAML2 AUTHNREQUEST; $authnRequest = AuthnRequest::fromXML(DOMDocumentFactory::fromString($xml)->documentElement); $issuer = $authnRequest->getIssuer(); - $this->assertEquals('2004-12-05T09:21:59Z', $authnRequest->getIssueInstant()->format(C::DATETIME_FORMAT)); - $this->assertEquals('https://idp.example.org/SAML2/SSO/Artifact', $authnRequest->getDestination()); - $this->assertEquals(C::BINDING_HTTP_ARTIFACT, $authnRequest->getProtocolBinding()); + $this->assertEquals('2004-12-05T09:21:59Z', $authnRequest->getIssueInstant()->getValue()); + $this->assertEquals('https://idp.example.org/SAML2/SSO/Artifact', $authnRequest->getDestination()->getValue()); + $this->assertEquals(C::BINDING_HTTP_ARTIFACT, $authnRequest->getProtocolBinding()->getValue()); $this->assertEquals( 'https://sp.example.com/SAML2/SSO/Artifact', - $authnRequest->getAssertionConsumerServiceURL(), + $authnRequest->getAssertionConsumerServiceURL()->getValue(), ); $this->assertInstanceOf(Issuer::class, $issuer); - $this->assertEquals('https://sp.example.com/SAML2', $issuer->getContent()); + $this->assertEquals('https://sp.example.com/SAML2', $issuer->getContent()->getValue()); } @@ -232,20 +259,19 @@ public function testExtensionOrdering(): void $xml = << - https://sp.example.com/SAML2 + https://sp.example.com/SAML2 - + user@example.org getAlgorithm( - $identifier->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $identifier->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::SELFSIGNED_PRIVATE_KEY), ); @@ -299,14 +325,13 @@ public function testScopeWithoutProviderIDThrowsException(): void $xmlRequest = << - https://sp.example.com/SAML2 + https://sp.example.com/SAML2 @@ -326,14 +351,17 @@ public function testScopeWithoutProviderIDThrowsException(): void public function testSettingProtocolBindingAndACSIndex(): void { // the Issuer - $issuer = new Issuer('https://sp.example.org/saml20/sp/metadata'); - $issueInstant = new DateTimeImmutable('2004-12-05T09:21:59Z'); - $destination = 'https://idp.example.org/idp/profile/saml2/Redirect/SSO'; - $protocolBinding = C::BINDING_HTTP_POST; - $assertionConsumerServiceIndex = 1; + $issuer = new Issuer( + SAMLStringValue::fromString('https://sp.example.org/saml20/sp/metadata'), + ); + $issueInstant = SAMLDateTimeValue::fromString('2004-12-05T09:21:59Z'); + $destination = SAMLAnyURIValue::fromString('https://idp.example.org/idp/profile/saml2/Redirect/SSO'); + $protocolBinding = SAMLAnyURIValue::fromString(C::BINDING_HTTP_POST); + $assertionConsumerServiceIndex = UnsignedShortValue::fromInteger(1); $this->expectException(ProtocolViolationException::class); new AuthnRequest( + id: IDValue::fromString('_306f8ec5b618f361c70b6ffb1480eadf'), assertionConsumerServiceIndex: $assertionConsumerServiceIndex, protocolBinding: $protocolBinding, issuer: $issuer, @@ -350,14 +378,19 @@ public function testSettingProtocolBindingAndACSIndex(): void public function testSettingACSUrlAndACSIndex(): void { // the Issuer - $issuer = new Issuer('https://sp.example.org/saml20/sp/metadata'); - $issueInstant = new DateTimeImmutable('2004-12-05T09:21:59Z'); - $destination = 'https://idp.example.org/idp/profile/saml2/Redirect/SSO'; - $assertionConsumerServiceIndex = 1; - $assertionConsumerServiceURL = "https://sp.example.org/authentication/sp/consume-assertion"; + $issuer = new Issuer( + SAMLStringValue::fromString('https://sp.example.org/saml20/sp/metadata'), + ); + $issueInstant = SAMLDateTimeValue::fromString('2004-12-05T09:21:59Z'); + $destination = SAMLAnyURIValue::fromString('https://idp.example.org/idp/profile/saml2/Redirect/SSO'); + $assertionConsumerServiceIndex = UnsignedShortValue::fromInteger(1); + $assertionConsumerServiceURL = SAMLAnyURIValue::fromString( + "https://sp.example.org/authentication/sp/consume-assertion", + ); $this->expectException(ProtocolViolationException::class); new AuthnRequest( + id: IDValue::fromString('SomeIDValue'), assertionConsumerServiceURL: $assertionConsumerServiceURL, assertionConsumerServiceIndex: $assertionConsumerServiceIndex, issuer: $issuer, @@ -375,17 +408,16 @@ public function testMultipleSubjectsThrowsException(): void $xml = << - https://gateway.example.org/saml20/sp/metadata - + https://gateway.example.org/saml20/sp/metadata + user@example.org - + aabbcc @@ -405,14 +437,13 @@ public function testMultipleNameIdsInSubjectThrowsException(): void $xml = << - https://gateway.example.org/saml20/sp/metadata - + https://gateway.example.org/saml20/sp/metadata + user@example.org aabbcc @@ -433,14 +464,13 @@ public function testEmptySubjectThrowsException(): void $xml = << - https://gateway.example.org/saml20/sp/metadata - + https://gateway.example.org/saml20/sp/metadata + AUTHNREQUEST; diff --git a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php index 3782aca38a..61ebded987 100644 --- a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php @@ -4,26 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\Action; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\Evidence; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\saml\Subject; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractRequest; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AbstractSubjectQuery; -use SimpleSAML\SAML2\XML\samlp\AuthzDecisionQuery; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{Action, Assertion, Evidence, Issuer, NameID, Subject}; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractRequest, + AbstractSamlpElement, + AbstractSubjectQuery, + AuthzDecisionQuery, +}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -71,25 +67,36 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $nameId = new NameID('urn:example:subject', null, null, C::NAMEID_UNSPECIFIED); + $nameId = new NameID( + value: SAMLStringValue::fromString('urn:example:subject'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_UNSPECIFIED), + ); $evidence = new Evidence( - assertion: [Assertion::fromXML(self::$assertion->documentElement)], + assertion: [ + Assertion::fromXML(self::$assertion->documentElement), + ], ); $authzDecisionQuery = new AuthzDecisionQuery( + id: IDValue::fromString('aaf23196-1773-2113-474a-fe114412ab72'), subject: new Subject($nameId), - resource: 'urn:x-simplesamlphp:resource', + resource: SAMLAnyURIValue::fromString('urn:x-simplesamlphp:resource'), action: [ - new Action(C::NAMESPACE, 'SomeAction'), - new Action('urn:x-simplesamlphp:alt-namespace', 'SomeOtherAction'), + new Action( + SAMLAnyURIValue::fromString(C::NAMESPACE), + SAMLStringValue::fromString('SomeAction'), + ), + new Action( + SAMLAnyURIValue::fromString('urn:x-simplesamlphp:alt-namespace'), + SAMLStringValue::fromString('SomeOtherAction'), + ), ], evidence: $evidence, issuer: new Issuer( - value: 'https://example.org/', - Format: C::NAMEID_ENTITY, + value: SAMLStringValue::fromString('https://example.org/'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_ENTITY), ), - id: 'aaf23196-1773-2113-474a-fe114412ab72', - issueInstant: new DateTimeImmutable('2017-09-06T11:49:27Z'), + issueInstant: SAMLDateTimeValue::fromString('2017-09-06T11:49:27Z'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/samlp/ExtensionsTest.php b/tests/SAML2/XML/samlp/ExtensionsTest.php index 0cf475d6bb..e4080cc763 100644 --- a/tests/SAML2/XML/samlp/ExtensionsTest.php +++ b/tests/SAML2/XML/samlp/ExtensionsTest.php @@ -4,17 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\Extensions; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, Extensions}; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/GetCompleteTest.php b/tests/SAML2/XML/samlp/GetCompleteTest.php index e821efaf3c..ef815bea77 100644 --- a/tests/SAML2/XML/samlp/GetCompleteTest.php +++ b/tests/SAML2/XML/samlp/GetCompleteTest.php @@ -4,15 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\GetComplete; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, GetComplete}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,10 +47,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $getComplete = new GetComplete('https://some/location'); - - $getCompleteElement = $getComplete->toXML(); - $this->assertEquals('https://some/location', $getCompleteElement->textContent); + $getComplete = new GetComplete( + SAMLAnyURIValue::fromString('https://some/location'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/samlp/IDPEntryTest.php b/tests/SAML2/XML/samlp/IDPEntryTest.php index 3e062a07c4..577850c1e6 100644 --- a/tests/SAML2/XML/samlp/IDPEntryTest.php +++ b/tests/SAML2/XML/samlp/IDPEntryTest.php @@ -4,15 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\IDPEntry; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, IDPEntry}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -54,7 +51,11 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $entry = new IDPEntry('urn:some:requester', 'testName', 'urn:test:testLoc'); + $entry = new IDPEntry( + EntityIDValue::fromString('urn:some:requester'), + SAMLStringValue::fromString('testName'), + SAMLAnyURIValue::fromString('urn:test:testLoc'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -71,9 +72,11 @@ public function testMarshallingNullables(): void $document->documentElement->removeAttribute('Name'); $document->documentElement->removeAttribute('Loc'); - $entry = new IDPEntry('urn:some:requester'); + $entry = new IDPEntry( + EntityIDValue::fromString('urn:some:requester'), + ); - $this->assertEquals('urn:some:requester', $entry->getProviderID()); + $this->assertEquals('urn:some:requester', $entry->getProviderID()->getValue()); $this->assertNull($entry->getName()); $this->assertNull($entry->getLoc()); diff --git a/tests/SAML2/XML/samlp/IDPListTest.php b/tests/SAML2/XML/samlp/IDPListTest.php index 11699a9f5e..f391d27eb4 100644 --- a/tests/SAML2/XML/samlp/IDPListTest.php +++ b/tests/SAML2/XML/samlp/IDPListTest.php @@ -4,19 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\GetComplete; -use SimpleSAML\SAML2\XML\samlp\IDPEntry; -use SimpleSAML\SAML2\XML\samlp\IDPList; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, GetComplete, IDPEntry, IDPList}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -60,9 +55,19 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $entry1 = new IDPEntry('urn:some:requester1', 'testName1', 'urn:test:testLoc1'); - $entry2 = new IDPEntry('urn:some:requester2', 'testName2', 'urn:test:testLoc2'); - $getComplete = new GetComplete('https://some/location'); + $entry1 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester1'), + SAMLStringValue::fromString('testName1'), + SAMLAnyURIValue::fromString('urn:test:testLoc1'), + ); + $entry2 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester2'), + SAMLStringValue::fromString('testName2'), + SAMLAnyURIValue::fromString('urn:test:testLoc2'), + ); + $getComplete = new GetComplete( + SAMLAnyURIValue::fromString('https://some/location'), + ); $list = new IDPList([$entry1, $entry2], $getComplete); $this->assertEquals( @@ -76,9 +81,19 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $entry1 = new IDPEntry('urn:some:requester1', 'testName1', 'urn:test:testLoc1'); - $entry2 = new IDPEntry('urn:some:requester2', 'testName2', 'urn:test:testLoc2'); - $getComplete = new GetComplete('https://some/location'); + $entry1 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester1'), + SAMLStringValue::fromString('testName1'), + SAMLAnyURIValue::fromString('urn:test:testLoc1'), + ); + $entry2 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester2'), + SAMLStringValue::fromString('testName2'), + SAMLAnyURIValue::fromString('urn:test:testLoc2'), + ); + $getComplete = new GetComplete( + SAMLAnyURIValue::fromString('https://some/location'), + ); $list = new IDPList([$entry1, $entry2], $getComplete); $listElement = $list->toXML(); @@ -109,7 +124,11 @@ public function testMarshallingNullables(): void XML ; - $entry1 = new IDPEntry('urn:some:requester1', 'testName1', 'urn:test:testLoc1'); + $entry1 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester1'), + SAMLStringValue::fromString('testName1'), + SAMLAnyURIValue::fromString('urn:test:testLoc1'), + ); $list = new IDPList([$entry1]); $entries = $list->getIdpEntry(); diff --git a/tests/SAML2/XML/samlp/LogoutRequestTest.php b/tests/SAML2/XML/samlp/LogoutRequestTest.php index 7ba2a57bed..bb74a1dfaa 100644 --- a/tests/SAML2/XML/samlp/LogoutRequestTest.php +++ b/tests/SAML2/XML/samlp/LogoutRequestTest.php @@ -4,30 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\EncryptedID; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\saml\NameID; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractRequest; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\LogoutRequest; -use SimpleSAML\SAML2\XML\samlp\SessionIndex; +use SimpleSAML\SAML2\XML\saml\{EncryptedID, Issuer, NameID}; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractRequest, + AbstractSamlpElement, + LogoutRequest, + SessionIndex, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\{MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; -use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; -use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; +use SimpleSAML\XMLSecurity\TestUtils\{PEMCertificatesMock, SignedElementTestTrait}; use function dirname; @@ -71,12 +69,17 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $nameId = new NameID('NameIDValue'); + $nameId = new NameID( + SAMLStringValue::fromString('NameIDValue'), + ); $logoutRequest = new LogoutRequest( + id: IDValue::fromString('SomeIDValue'), identifier: $nameId, - issueInstant: self::$clock->now(), - sessionIndexes: [new SessionIndex('SessionIndexValue')], + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + sessionIndexes: [ + new SessionIndex(SAMLStringValue::fromString('SessionIndexValue')), + ], ); $logoutRequestElement = $logoutRequest->toXML(); @@ -93,11 +96,17 @@ public function testMarshalling(): void $this->assertCount(1, $sessionIndexElements); $this->assertEquals('SessionIndexValue', $sessionIndexElements[0]->textContent); - $nameId = new NameID('NameIDValue'); + $nameId = new NameID( + SAMLStringValue::fromString('NameIDValue'), + ); $logoutRequest = new LogoutRequest( + id: IDValue::fromString('SomeIDValue'), identifier: $nameId, - issueInstant: self::$clock->now(), - sessionIndexes: [new SessionIndex('SessionIndexValue1'), new SessionIndex('SessionIndexValue2')], + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + sessionIndexes: [ + new SessionIndex(SAMLStringValue::fromString('SessionIndexValue1')), + new SessionIndex(SAMLStringValue::fromString('SessionIndexValue2')), + ], ); $logoutRequestElement = $logoutRequest->toXML(); @@ -113,12 +122,17 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $nameId = new NameID('NameIDValue'); + $nameId = new NameID( + SAMLStringValue::fromString('NameIDValue'), + ); $logoutRequest = new LogoutRequest( + id: IDValue::fromString('SomeIDValue'), identifier: $nameId, - issueInstant: self::$clock->now(), - sessionIndexes: [new SessionIndex('SessionIndexValue')], + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + sessionIndexes: [ + new SessionIndex(SAMLStringValue::fromString('SessionIndexValue')), + ], ); $logoutRequestElement = $logoutRequest->toXML(); @@ -159,12 +173,12 @@ public function testUnmarshalling(): void $sessionIndexes = $logoutRequest->getSessionIndexes(); $this->assertCount(2, $sessionIndexes); - $this->assertEquals('SomeSessionIndex1', $sessionIndexes[0]->getContent()); - $this->assertEquals('SomeSessionIndex2', $sessionIndexes[1]->getContent()); + $this->assertEquals('SomeSessionIndex1', $sessionIndexes[0]->getContent()->getValue()); + $this->assertEquals('SomeSessionIndex2', $sessionIndexes[1]->getContent()->getValue()); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm(), + $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::SELFSIGNED_PRIVATE_KEY), ); $identifier = $encid->decrypt($decryptor); @@ -181,7 +195,11 @@ public function testEncryptedNameId(): void dirname(__FILE__, 4) . '/resources/xml/saml_EncryptedID.xml', )->documentElement); - $logoutRequest = new LogoutRequest($eid, self::$clock->now()); + $logoutRequest = new LogoutRequest( + identifier: $eid, + id: IDValue::fromString('SomeIDValue'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); $logoutRequestElement = $logoutRequest->toXML(); $this->assertCount( 1, @@ -291,7 +309,7 @@ public function testGetNotOnOrAfter(): void $logoutRequestElement = $document->documentElement; $logoutRequest = LogoutRequest::fromXML($logoutRequestElement); - $this->assertEquals('2018-11-28T19:33:12Z', $logoutRequest->getNotOnOrAfter()->format(C::DATETIME_FORMAT)); + $this->assertEquals('2018-11-28T19:33:12Z', $logoutRequest->getNotOnOrAfter()->getValue()); } @@ -299,15 +317,22 @@ public function testGetNotOnOrAfter(): void */ public function testSetNotOnOrAfter(): void { - $nameId = new NameID('NameIDValue'); + $nameId = new NameID( + SAMLStringValue::fromString('NameIDValue'), + ); - $logoutRequest = new LogoutRequest($nameId, self::$clock->now(), self::$clock->now()); + $logoutRequest = new LogoutRequest( + IDValue::fromString('SomeIDValue'), + $nameId, + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + SAMLDateTimeValue::fromDateTime(self::$clock->now()), + ); $logoutRequestElement = $logoutRequest->toXML(); $logoutRequest2 = LogoutRequest::fromXML($logoutRequestElement); $this->assertEquals( - self::$clock->now()->format(C::DATETIME_FORMAT), - $logoutRequest2->getNotOnOrAfter()->format(C::DATETIME_FORMAT), + SAMLDateTimeValue::fromDateTime(self::$clock->now())->getValue(), + $logoutRequest2->getNotOnOrAfter()->getValue(), ); } @@ -342,10 +367,18 @@ public function testGetReason(): void */ public function testSetReason(): void { - $reason = "urn:simplesamlphp:reason-test"; - $nameId = new NameID('NameIDValue'); + $reason = SAMLStringValue::fromString("urn:simplesamlphp:reason-test"); + $nameId = new NameID( + SAMLStringValue::fromString('NameIDValue'), + ); - $logoutRequest = new LogoutRequest($nameId, self::$clock->now(), null, $reason); + $logoutRequest = new LogoutRequest( + id: IDValue::fromString('SomeIDValue'), + identifier: $nameId, + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), + notOnOrAfter: null, + reason: $reason, + ); $logoutRequestElement = $logoutRequest->toXML(); $logoutRequest2 = LogoutRequest::fromXML($logoutRequestElement); @@ -380,21 +413,25 @@ public function testWithOutSessionIndices(): void */ public function testSetSessionIndicesVariants(): void { - $nameId = new NameID('test'); + $nameId = new NameID( + SAMLStringValue::fromString('test'), + ); + $sessionIndexes = [ - new SessionIndex('SessionIndexValue1'), - new SessionIndex('SessionIndexValue2'), + new SessionIndex(SAMLStringValue::fromString('SessionIndexValue1')), + new SessionIndex(SAMLStringValue::fromString('SessionIndexValue2')), ]; $logoutRequest = new LogoutRequest( - issueInstant: self::$clock->now(), + id: IDValue::fromString('SomeIDValue'), + issueInstant: SAMLDateTimeValue::fromDateTime(self::$clock->now()), identifier: $nameId, sessionIndexes: $sessionIndexes, ); $sessionIndexes = $logoutRequest->getSessionIndexes(); $this->assertCount(2, $sessionIndexes); - $this->assertEquals('SessionIndexValue1', $sessionIndexes[0]->getContent()); - $this->assertEquals('SessionIndexValue2', $sessionIndexes[1]->getContent()); + $this->assertEquals('SessionIndexValue1', $sessionIndexes[0]->getContent()->getValue()); + $this->assertEquals('SessionIndexValue2', $sessionIndexes[1]->getContent()->getValue()); } } diff --git a/tests/SAML2/XML/samlp/LogoutResponseTest.php b/tests/SAML2/XML/samlp/LogoutResponseTest.php index d2affd040e..6274e7ae5b 100644 --- a/tests/SAML2/XML/samlp/LogoutResponseTest.php +++ b/tests/SAML2/XML/samlp/LogoutResponseTest.php @@ -4,21 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; -use SimpleSAML\SAML2\XML\samlp\LogoutResponse; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractSamlpElement, + AbstractStatusResponse, + LogoutResponse, + Status, + StatusCode, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -57,14 +58,22 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $issuer = new Issuer('urn:x-simplesamlphp:issuer'); - $status = new Status(new StatusCode(C::STATUS_SUCCESS)); + $issuer = new Issuer( + SAMLStringValue::fromString('urn:x-simplesamlphp:issuer'), + ); + $status = new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ); $logoutResponse = new LogoutResponse( - id: 's2a0da3504aff978b0f8c80f6a62c713c4a2f64c5b', - issueInstant: new DateTimeImmutable('2007-12-10T11:39:48Z'), - destination: 'http://somewhere.example.org/simplesaml/saml2/sp/AssertionConsumerService.php', - inResponseTo: '_bec424fa5103428909a30ff1e31168327f79474984', + id: IDValue::fromString('s2a0da3504aff978b0f8c80f6a62c713c4a2f64c5b'), + issueInstant: SAMLDateTimeValue::fromString('2007-12-10T11:39:48Z'), + destination: SAMLAnyURIValue::fromString( + 'http://somewhere.example.org/simplesaml/saml2/sp/AssertionConsumerService.php', + ), + inResponseTo: NCNameValue::fromString('_bec424fa5103428909a30ff1e31168327f79474984'), issuer: $issuer, status: $status, ); diff --git a/tests/SAML2/XML/samlp/MessageFactoryTest.php b/tests/SAML2/XML/samlp/MessageFactoryTest.php index d62f822770..ad3180a782 100644 --- a/tests/SAML2/XML/samlp/MessageFactoryTest.php +++ b/tests/SAML2/XML/samlp/MessageFactoryTest.php @@ -4,19 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\DataProvider; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\samlp\ArtifactResolve; -use SimpleSAML\SAML2\XML\samlp\ArtifactResponse; -use SimpleSAML\SAML2\XML\samlp\AttributeQuery; -use SimpleSAML\SAML2\XML\samlp\AuthnRequest; -use SimpleSAML\SAML2\XML\samlp\LogoutRequest; -use SimpleSAML\SAML2\XML\samlp\LogoutResponse; -use SimpleSAML\SAML2\XML\samlp\MessageFactory; -use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\{ + ArtifactResolve, + ArtifactResponse, + AttributeQuery, + AuthnRequest, + LogoutRequest, + LogoutResponse, + MessageFactory, + Response, +}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\InvalidDOMElementException; diff --git a/tests/SAML2/XML/samlp/NameIDPolicyTest.php b/tests/SAML2/XML/samlp/NameIDPolicyTest.php index 398762249d..d24f54fc30 100644 --- a/tests/SAML2/XML/samlp/NameIDPolicyTest.php +++ b/tests/SAML2/XML/samlp/NameIDPolicyTest.php @@ -4,16 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\NameIDPolicy; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, NameIDPolicy}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\BooleanValue; use function dirname; use function strval; @@ -56,9 +54,9 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $nameIdPolicy = new NameIDPolicy( - 'urn:the:format', - 'urn:x-simplesamlphp:spnamequalifier', - true, + SAMLAnyURIValue::fromString('urn:the:format'), + SAMLStringValue::fromString('urn:x-simplesamlphp:spnamequalifier'), + BooleanValue::fromBoolean(true), ); $this->assertEquals( @@ -77,7 +75,7 @@ public function testMarshallingFormatOnly(): void ); $nameIdPolicy = new NameIDPolicy( - 'urn:the:format', + SAMLAnyURIValue::fromString('urn:the:format'), ); $this->assertEquals( diff --git a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php index a22e493fd5..caeb0e61b2 100644 --- a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php +++ b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php @@ -4,19 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\Comparison; -use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; -use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; +use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, RequestedAuthnContext}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -51,9 +49,14 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $authnContextDeclRef = new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'); + $authnContextDeclRef = new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ); - $requestedAuthnContext = new RequestedAuthnContext([$authnContextDeclRef], Comparison::EXACT); + $requestedAuthnContext = new RequestedAuthnContext( + [$authnContextDeclRef], + Comparison::EXACT, + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -66,13 +69,20 @@ public function testMarshalling(): void */ public function testMarshallingWithMixedContextsFails(): void { - $authnContextDeclRef = new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'); - $authnContextClassRef = new AuthnContextClassRef(C::AC_PASSWORD_PROTECTED_TRANSPORT); + $authnContextDeclRef = new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ); + $authnContextClassRef = new AuthnContextClassRef( + SAMLAnyURIValue::fromString(C::AC_PASSWORD_PROTECTED_TRANSPORT), + ); - $this->expectException(AssertionFailedException::class); + $this->expectException(ProtocolViolationException::class); $this->expectExceptionMessage('You need either AuthnContextClassRef or AuthnContextDeclRef, not both.'); - new RequestedAuthnContext([$authnContextClassRef, $authnContextDeclRef], Comparison::EXACT); + new RequestedAuthnContext( + [$authnContextClassRef, $authnContextDeclRef], + Comparison::EXACT, + ); } @@ -80,9 +90,11 @@ public function testMarshallingWithMixedContextsFails(): void */ public function testMarshallingWithInvalidContentFails(): void { - $authnContextDeclRef = new AuthnContextDeclRef('https://example.org/relative/path/to/document.xml'); + $authnContextDeclRef = new AuthnContextDeclRef( + SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), + ); - $this->expectException(AssertionFailedException::class); + $this->expectException(SchemaViolationException::class); $this->expectExceptionMessage( 'Expected an instance of any of "' . AuthnContextClassRef::class . '", "' . AuthnContextDeclRef::class . '". Got: DOMDocument', @@ -115,7 +127,7 @@ public function testUnmarshallingWithMixedContextsFails(): void , ); - $this->expectException(AssertionFailedException::class); + $this->expectException(ProtocolViolationException::class); $this->expectExceptionMessage('You need either AuthnContextClassRef or AuthnContextDeclRef, not both.'); RequestedAuthnContext::fromXML($document->documentElement); diff --git a/tests/SAML2/XML/samlp/RequesterIDTest.php b/tests/SAML2/XML/samlp/RequesterIDTest.php index dd2ae47dc8..a06dfa098e 100644 --- a/tests/SAML2/XML/samlp/RequesterIDTest.php +++ b/tests/SAML2/XML/samlp/RequesterIDTest.php @@ -4,15 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\RequesterID; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, RequesterID}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -50,7 +47,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $requesterId = new RequesterID('urn:some:requester'); + $requesterId = new RequesterID( + EntityIDValue::fromString('urn:some:requester'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/samlp/ResponseTest.php b/tests/SAML2/XML/samlp/ResponseTest.php index f0a59c9a43..8a3c8815b1 100644 --- a/tests/SAML2/XML/samlp/ResponseTest.php +++ b/tests/SAML2/XML/samlp/ResponseTest.php @@ -4,22 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use DateTimeImmutable; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\AbstractMessage; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; -use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\XML\saml\{Assertion, Issuer}; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractMessage, + AbstractSamlpElement, + AbstractStatusResponse, + Response, + Status, + StatusCode, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -58,21 +58,29 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $status = new Status(new StatusCode()); - $issuer = new Issuer('https://IdentityProvider.com'); + $status = new Status( + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_SUCCESS), + ), + ); + $issuer = new Issuer( + SAMLStringValue::fromString('https://IdentityProvider.com'), + ); $assertion = DOMDocumentFactory::fromFile( dirname(__FILE__, 4) . '/resources/xml/saml_Assertion.xml', ); $response = new Response( - id: 'abc123', + id: IDValue::fromString('abc123'), status: $status, issuer: $issuer, - destination: 'https://example.org/metadata', - consent: C::CONSENT_EXPLICIT, - inResponseTo: 'PHPUnit', - issueInstant: new DateTimeImmutable('2021-03-25T16:53:26Z'), - assertions: [Assertion::fromXML($assertion->documentElement)], + destination: SAMLAnyURIValue::fromString('https://example.org/metadata'), + consent: SAMLAnyURIValue::fromString(C::CONSENT_EXPLICIT), + inResponseTo: NCNameValue::fromString('PHPUnit'), + issueInstant: SAMLDateTimeValue::fromString('2021-03-25T16:53:26Z'), + assertions: [ + Assertion::fromXML($assertion->documentElement), + ], ); $this->assertEquals( diff --git a/tests/SAML2/XML/samlp/ScopingTest.php b/tests/SAML2/XML/samlp/ScopingTest.php index 069cd9ef5c..6342792711 100644 --- a/tests/SAML2/XML/samlp/ScopingTest.php +++ b/tests/SAML2/XML/samlp/ScopingTest.php @@ -4,20 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\GetComplete; -use SimpleSAML\SAML2\XML\samlp\IDPEntry; -use SimpleSAML\SAML2\XML\samlp\IDPList; -use SimpleSAML\SAML2\XML\samlp\RequesterID; -use SimpleSAML\SAML2\XML\samlp\Scoping; +use SimpleSAML\SAML2\XML\samlp\{ + AbstractSamlpElement, + GetComplete, + IDPEntry, + IDPList, + RequesterID, + Scoping, +}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\NonNegativeIntegerValue; use function dirname; use function strval; @@ -52,12 +54,24 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $entry1 = new IDPEntry('urn:some:requester1', 'testName1', 'urn:test:testLoc1'); - $getComplete = new GetComplete('https://some/location'); + $entry1 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester1'), + SAMLStringValue::fromString('testName1'), + EntityIDValue::fromString('urn:test:testLoc1'), + ); + $getComplete = new GetComplete( + SAMLAnyURIValue::fromString('https://some/location'), + ); $list = new IDPList([$entry1], $getComplete); - $requesterId = 'urn:some:requester'; - - $scoping = new Scoping(2, $list, [new RequesterID($requesterId)]); + $requesterId = EntityIDValue::fromString('urn:some:requester'); + + $scoping = new Scoping( + NonNegativeIntegerValue::fromInteger(2), + $list, + [ + new RequesterID($requesterId), + ], + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -70,12 +84,24 @@ public function testMarshalling(): void */ public function testMarshallingElementOrdering(): void { - $entry1 = new IDPEntry('urn:some:requester1', 'testName1', 'urn:test:testLoc1'); - $getComplete = new GetComplete('https://some/location'); + $entry1 = new IDPEntry( + EntityIDValue::fromString('urn:some:requester1'), + SAMLStringValue::fromString('testName1'), + EntityIDValue::fromString('urn:test:testLoc1'), + ); + $getComplete = new GetComplete( + SAMLAnyURIValue::fromString('https://some/location'), + ); $list = new IDPList([$entry1], $getComplete); - $requesterId = 'urn:some:requester'; - - $scoping = new Scoping(2, $list, [new RequesterID($requesterId)]); + $requesterId = EntityIDValue::fromString('urn:some:requester'); + + $scoping = new Scoping( + NonNegativeIntegerValue::fromInteger(2), + $list, + [ + new RequesterID($requesterId), + ], + ); $scopingElement = $scoping->toXML(); diff --git a/tests/SAML2/XML/samlp/SessionIndexTest.php b/tests/SAML2/XML/samlp/SessionIndexTest.php index 8227b40f62..88681ac709 100644 --- a/tests/SAML2/XML/samlp/SessionIndexTest.php +++ b/tests/SAML2/XML/samlp/SessionIndexTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\SessionIndex; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, SessionIndex}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $sessionIndex = new SessionIndex('SomeSessionIndex1'); + $sessionIndex = new SessionIndex( + SAMLStringValue::fromString('SomeSessionIndex1'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/samlp/StatusCodeTest.php b/tests/SAML2/XML/samlp/StatusCodeTest.php index aae2f8d079..b869fb727a 100644 --- a/tests/SAML2/XML/samlp/StatusCodeTest.php +++ b/tests/SAML2/XML/samlp/StatusCodeTest.php @@ -4,15 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, StatusCode}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -49,9 +47,11 @@ public function testMarshalling(): void { $statusCode = new StatusCode( - C::STATUS_RESPONDER, + SAMLAnyURIValue::fromString(C::STATUS_RESPONDER), [ - new StatusCode(C::STATUS_REQUEST_DENIED), + new StatusCode( + SAMLAnyURIValue::fromString(C::STATUS_REQUEST_DENIED), + ), ], ); diff --git a/tests/SAML2/XML/samlp/StatusDetailTest.php b/tests/SAML2/XML/samlp/StatusDetailTest.php index db0aa86147..bf711661a9 100644 --- a/tests/SAML2/XML/samlp/StatusDetailTest.php +++ b/tests/SAML2/XML/samlp/StatusDetailTest.php @@ -4,16 +4,12 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\StatusDetail; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, StatusDetail}; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/StatusMessageTest.php b/tests/SAML2/XML/samlp/StatusMessageTest.php index 0f1e57ec36..537162e39f 100644 --- a/tests/SAML2/XML/samlp/StatusMessageTest.php +++ b/tests/SAML2/XML/samlp/StatusMessageTest.php @@ -4,14 +4,12 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\StatusMessage; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, StatusMessage}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -46,7 +44,9 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $statusMessage = new StatusMessage('Something went wrong'); + $statusMessage = new StatusMessage( + SAMLStringValue::fromString('Something went wrong'), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/samlp/StatusTest.php b/tests/SAML2/XML/samlp/StatusTest.php index 34f2e170e8..8eb2b54025 100644 --- a/tests/SAML2/XML/samlp/StatusTest.php +++ b/tests/SAML2/XML/samlp/StatusTest.php @@ -5,20 +5,14 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; use DOMDocument; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; -use SimpleSAML\SAML2\XML\samlp\Status; -use SimpleSAML\SAML2\XML\samlp\StatusCode; -use SimpleSAML\SAML2\XML\samlp\StatusDetail; -use SimpleSAML\SAML2\XML\samlp\StatusMessage; -use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, Status, StatusCode, StatusDetail, StatusMessage}; +use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; @@ -63,14 +57,16 @@ public function testMarshalling(): void { $status = new Status( new StatusCode( - C::STATUS_RESPONDER, + SAMLAnyURIValue::fromString(C::STATUS_RESPONDER), [ new StatusCode( - C::STATUS_REQUEST_DENIED, + SAMLAnyURIValue::fromString(C::STATUS_REQUEST_DENIED), ), ], ), - new StatusMessage('Something went wrong'), + new StatusMessage( + SAMLStringValue::fromString('Something went wrong'), + ), [ StatusDetail::fromXML( DOMDocumentFactory::fromFile( @@ -93,14 +89,16 @@ public function testMarshallingElementOrdering(): void { $status = new Status( new StatusCode( - C::STATUS_RESPONDER, + SAMLAnyURIValue::fromString(C::STATUS_RESPONDER), [ new StatusCode( - C::STATUS_REQUEST_DENIED, + SAMLAnyURIValue::fromString(C::STATUS_REQUEST_DENIED), ), ], ), - new StatusMessage('Something went wrong'), + new StatusMessage( + SAMLStringValue::fromString('Something went wrong'), + ), [ new StatusDetail([new Chunk(self::$detail->documentElement)]), ], diff --git a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php index 817663bc32..95cc7ca123 100644 --- a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php +++ b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php @@ -4,18 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\shibmd; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\shibmd\AbstractShibmdElement; -use SimpleSAML\SAML2\XML\shibmd\KeyAuthority; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\shibmd\{AbstractShibmdElement, KeyAuthority}; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\ds\X509Certificate; -use SimpleSAML\XMLSecurity\XML\ds\X509Data; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\{Base64BinaryValue, IDValue, UnsignedByteValue}; +use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, X509Certificate, X509Data}; use function dirname; use function strval; @@ -56,25 +53,29 @@ public function testMarshalling(): void [ new X509Data( [ - new X509Certificate('MIIG/DCCBOSgAwIBAgIIU2w5U7TnvlwwDQYJKoZIhvcNAQELBQAwZjELMAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjE3MDUGA1UEAwwuU3RhYXQgZGVyIE5lZGVybGFuZGVuIFByaXZhdGUgU2VydmljZXMgQ0EgLSBHMTAeFw0xNjExMDMxMDM2MTFaFw0yODExMTIwMDAwMDBaMIGAMQswCQYDVQQGEwJOTDEgMB4GA1UECgwXUXVvVmFkaXMgVHJ1c3RsaW5rIEIuVi4xFzAVBgNVBGEMDk5UUk5MLTMwMjM3NDU5MTYwNAYDVQQDDC1RdW9WYWRpcyBQS0lvdmVyaGVpZCBQcml2YXRlIFNlcnZpY2VzIENBIC0gRzEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCo9ep1FEPp6FQIgMT8wD5UoTDQoqkE43vWFx2ur6cxYQFpWXefd0dpdaugwOJ5igIilAoIrd+FdYxbJxQOkrbmkFX1mdW2mAf10+9BW5rn1HvwHG/nvZ8kyaeZuEyEUmVZ+EEFw+7hOru7YPkxA5U7N3IY409xAjiYS3Cti388bLPfE3Ci0Rt2WQlL3jbnSlAty2ZdJ5aCRkL3Cm8wERlwZ0lsLsTIQo1TCw6WfrDgEk+41MvP3eh+0wL3lWPnSPzwvI13Dd5PjT7Pte73oVpqRwgWl+2ZjGD7vwNf14rma3Khuwv74lWWJIr9EHu4miseqVlhk4mFpPC4zsKM6AeXfhZwKLmGAwM54yHw7hjvSPoBilpGiKdIdELMfFzWToSOjMXPQZyHSF5F13sj/hD+YLRBx95QsDa+1xWJq4hv+/t/WPuw1E+s8JYQ/5HKArYfGNMou20skdJyvYW5H+NcZ0guCaF6zdrUDkFv+uI+MkWQMxGw/mwqZX/cW4EC4PPG1j3NEK6/gfU7LT4W/M/GIBC6kJ+L5AJtDIvW8719oIp0UBmhF1nZyQSX6WdaplsM6CNYZ7SSq+kUC4k6Oalzsnv4kNy7ru6yzHoI33V6VXQcs2BevJjbf09YIHoh2cPKPB0nIvRNq9Lvpek0mi5lGzmDj+/DxRySLdPJbzzdCQIDAQABo4IBkTCCAY0wUgYIKwYBBQUHAQEERjBEMEIGCCsGAQUFBzAChjZodHRwOi8vY2VydC5wa2lvdmVyaGVpZC5ubC9Eb21Qcml2YXRlU2VydmljZXNDQS1HMS5jZXIwHQYDVR0OBBYEFLlsphO6uy80Y4MxLvl+SR3fAPVjMBIGA1UdEwEB/wQIMAYBAf8CAQAwHwYDVR0jBBgwFoAUPq+oD4eiLEF7FGwb89to05KnRKgwJQYIKwYBBQUHAQMEGTAXMBUGCCsGAQUFBwsCMAkGBwQAi+xJAQIwXQYDVR0gBFYwVDAMBgpghBABh2sBAggEMAwGCmCEEAGHawECCAUwNgYKYIQQAYdrAQIIBjAoMCYGCCsGAQUFBwIBFhpodHRwczovL2Nwcy5wa2lvdmVyaGVpZC5ubDBNBgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vY3JsLnBraW92ZXJoZWlkLm5sL0RvbVByaXZhdGVTZXJ2aWNlc0xhdGVzdENSTC1HMS5jcmwwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQCM9aEWB9EutS4/TKJ0hSrJljJSt0sAFxkoi6upCv7+C9Pjp+R5woGAwiBctbM5PyT+KpOKlDZKL3mrXSUc/71qNxsPlZR703c+HhlkvDCHbk9afrAXWtXz0sKVs8KaNS2W4k7O8xGNZVMjMwpanQdBcsTnFPu12OTj8BCv4aOFxIYnPqPHkl8VTAi2pTArCtTQk9vi6QaXPzSmfi/rDINCJUAOnA3BEeZZI+BD8yCzE2x9M1N0AIn3UZRfVMfLJdI68a67lt3fLh2ZbLcjE0Pi4arBqxzFyKa1LyVsnA1Yg5UCZQh8U9l+5DS5dNS9lDVSBcd9iUio+lg8LvAQ7biz+FFiLSqxVcWDuUg079d8JjPakm4JllmORlnSfWlcTHmgKmQOR0TgtXUL/7EDW2qbmRb5hUttT6ixBKnjtllnXmpOkx8hZn0F0hqjnIUsw8E0SdpYlrvIKszmowoKtZpszL/REVZybhfki5zj22GBMNBBP5MWTkltAZ8x2qu8iUw7MAUkBJy14cWmbqxue95JtT3a2/BnSMofYQNALQM4Ay9iZZyCUJIF/EYxg1OXmv65UthXpc4DdApICObyxY+/OABPJWHtxuG27SmMBx/MT3ZEs6vswVqGIsbPZydVSqerDskkP1AOl4iFEwmGOtfLB+VGn3werrg7IVfbCWEqdA=='), + new X509Certificate( + Base64BinaryValue::fromString('MIIG/DCCBOSgAwIBAgIIU2w5U7TnvlwwDQYJKoZIhvcNAQELBQAwZjELMAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjE3MDUGA1UEAwwuU3RhYXQgZGVyIE5lZGVybGFuZGVuIFByaXZhdGUgU2VydmljZXMgQ0EgLSBHMTAeFw0xNjExMDMxMDM2MTFaFw0yODExMTIwMDAwMDBaMIGAMQswCQYDVQQGEwJOTDEgMB4GA1UECgwXUXVvVmFkaXMgVHJ1c3RsaW5rIEIuVi4xFzAVBgNVBGEMDk5UUk5MLTMwMjM3NDU5MTYwNAYDVQQDDC1RdW9WYWRpcyBQS0lvdmVyaGVpZCBQcml2YXRlIFNlcnZpY2VzIENBIC0gRzEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCo9ep1FEPp6FQIgMT8wD5UoTDQoqkE43vWFx2ur6cxYQFpWXefd0dpdaugwOJ5igIilAoIrd+FdYxbJxQOkrbmkFX1mdW2mAf10+9BW5rn1HvwHG/nvZ8kyaeZuEyEUmVZ+EEFw+7hOru7YPkxA5U7N3IY409xAjiYS3Cti388bLPfE3Ci0Rt2WQlL3jbnSlAty2ZdJ5aCRkL3Cm8wERlwZ0lsLsTIQo1TCw6WfrDgEk+41MvP3eh+0wL3lWPnSPzwvI13Dd5PjT7Pte73oVpqRwgWl+2ZjGD7vwNf14rma3Khuwv74lWWJIr9EHu4miseqVlhk4mFpPC4zsKM6AeXfhZwKLmGAwM54yHw7hjvSPoBilpGiKdIdELMfFzWToSOjMXPQZyHSF5F13sj/hD+YLRBx95QsDa+1xWJq4hv+/t/WPuw1E+s8JYQ/5HKArYfGNMou20skdJyvYW5H+NcZ0guCaF6zdrUDkFv+uI+MkWQMxGw/mwqZX/cW4EC4PPG1j3NEK6/gfU7LT4W/M/GIBC6kJ+L5AJtDIvW8719oIp0UBmhF1nZyQSX6WdaplsM6CNYZ7SSq+kUC4k6Oalzsnv4kNy7ru6yzHoI33V6VXQcs2BevJjbf09YIHoh2cPKPB0nIvRNq9Lvpek0mi5lGzmDj+/DxRySLdPJbzzdCQIDAQABo4IBkTCCAY0wUgYIKwYBBQUHAQEERjBEMEIGCCsGAQUFBzAChjZodHRwOi8vY2VydC5wa2lvdmVyaGVpZC5ubC9Eb21Qcml2YXRlU2VydmljZXNDQS1HMS5jZXIwHQYDVR0OBBYEFLlsphO6uy80Y4MxLvl+SR3fAPVjMBIGA1UdEwEB/wQIMAYBAf8CAQAwHwYDVR0jBBgwFoAUPq+oD4eiLEF7FGwb89to05KnRKgwJQYIKwYBBQUHAQMEGTAXMBUGCCsGAQUFBwsCMAkGBwQAi+xJAQIwXQYDVR0gBFYwVDAMBgpghBABh2sBAggEMAwGCmCEEAGHawECCAUwNgYKYIQQAYdrAQIIBjAoMCYGCCsGAQUFBwIBFhpodHRwczovL2Nwcy5wa2lvdmVyaGVpZC5ubDBNBgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vY3JsLnBraW92ZXJoZWlkLm5sL0RvbVByaXZhdGVTZXJ2aWNlc0xhdGVzdENSTC1HMS5jcmwwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQCM9aEWB9EutS4/TKJ0hSrJljJSt0sAFxkoi6upCv7+C9Pjp+R5woGAwiBctbM5PyT+KpOKlDZKL3mrXSUc/71qNxsPlZR703c+HhlkvDCHbk9afrAXWtXz0sKVs8KaNS2W4k7O8xGNZVMjMwpanQdBcsTnFPu12OTj8BCv4aOFxIYnPqPHkl8VTAi2pTArCtTQk9vi6QaXPzSmfi/rDINCJUAOnA3BEeZZI+BD8yCzE2x9M1N0AIn3UZRfVMfLJdI68a67lt3fLh2ZbLcjE0Pi4arBqxzFyKa1LyVsnA1Yg5UCZQh8U9l+5DS5dNS9lDVSBcd9iUio+lg8LvAQ7biz+FFiLSqxVcWDuUg079d8JjPakm4JllmORlnSfWlcTHmgKmQOR0TgtXUL/7EDW2qbmRb5hUttT6ixBKnjtllnXmpOkx8hZn0F0hqjnIUsw8E0SdpYlrvIKszmowoKtZpszL/REVZybhfki5zj22GBMNBBP5MWTkltAZ8x2qu8iUw7MAUkBJy14cWmbqxue95JtT3a2/BnSMofYQNALQM4Ay9iZZyCUJIF/EYxg1OXmv65UthXpc4DdApICObyxY+/OABPJWHtxuG27SmMBx/MT3ZEs6vswVqGIsbPZydVSqerDskkP1AOl4iFEwmGOtfLB+VGn3werrg7IVfbCWEqdA=='), + ), ], ), ], - 'abc123', + IDValue::fromString('abc123'), ), new KeyInfo( [ new X509Data( [ - new X509Certificate('MIIFhDCCA2ygAwIBAgIEAJimITANBgkqhkiG9w0BAQsFADBiMQswCQYDVQQGEwJOTDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTMwMQYDVQQDDCpTdGFhdCBkZXIgTmVkZXJsYW5kZW4gUHJpdmF0ZSBSb290IENBIC0gRzEwHhcNMTMxMTE0MTM0ODU1WhcNMjgxMTEzMjMwMDAwWjBiMQswCQYDVQQGEwJOTDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTMwMQYDVQQDDCpTdGFhdCBkZXIgTmVkZXJsYW5kZW4gUHJpdmF0ZSBSb290IENBIC0gRzEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDaIMh56ynwnEhE7Ey54KpX5j1XDoxbHDCgXctute55RjmG2hy6fuq++q/dCSsj38Pi/KYn/PN13EF05k39IRvakb0AQNVyHifNKXfta6Tzi5QcM4BK09DB4Ckb6TdZTNUtWyEcAtRblYaVSQ4Xr5QODNqu2FGQucraVXqCIx81azlOE2JbZli9AZKn94pP57A11dUYhxMsh70YosJEKVB8Ue4ROksHhb/nnOISG+2y9FD5M8u8jYhp00TGZGVu5z0IFgtqX0i8GmrH0ub9AWjf/iU4MWjGVRSq0cwUHEeKRj/UD9a8xIEn9TxIfYj+6+s4tn9dW/4PV5jc6iGJx6ExTPfOR7VHpxS4XujrZb5Ba/+oj/ONdOfR0JSm2itCytbtjQBBL0oocIIqaqOna1cufHkcn9VleF7Zvz/8njQIpAU4J4nJ4pE5pQ3k4ORAGNnq5R9hAqqUQGDlo3Uj8PBou0nPzQ7JNgGkN+my/lGr4rceUNK/8CoGnYFUH+UyFtJkvlLlEkb688/IdNdGgY+vuXCAB6xfKlJjAGChFUBb6swbNeNctVEdUj7Weg4Jt5gXu78C2mjs9x5lcHOgMO4ZmvYJ3Ejp4k3nNa45HOIVkYrfQrrBHzBhR0BuReAagurcbtUjJFd7BtufGVLfU3CUn1l6u3/9eG4DGH6pq+dSKQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUKv25Kx76w4SHBtuB/4aXdQ3rAYswDQYJKoZIhvcNAQELBQADggIBAEvpmXMOOKdQwUPysrsdIkGJUFF+dvmsJDiOuAqV0A1nNTooL3esvDLEZAWZwKTOwRomnHzeCfS/QxRKTkVX21pfrHf9ufDKykpzjl9uAILTS76FJ6//R0RTIPMrzknQpG2fCLR5DFEbHWU/jWAxGmncfx6HQYl/azHaWbv0dhZOUjPdkGAQ6EPvHcyNU9yMkETdw0X6ioxqzMwkGM893oBrMmtduiqIf3/H6HTXoRKAc+/DXZIq/pAc6eVMa6x43kokluaam9L78yDrlHbGd2VYAr/HZ0TjDZTtI2t2/ySTb7JjC8wL8rSqxYmLpNrnhZzPW87sl2OCFC3re3ZhtJkIHNP85jj1gqewTC7DCW6llZdB3hBzfHWby0EX2RlcwgaMfNBEV5U0IogccdXV+S6zWK4F+yBr0sXUrdbdMFu+g3I9CbXxt0q4eVJtoaun4M2Z+bZMqZvy9FryBdSfhpgmJqwFz2luOhPOVCblCPhLrUeewrvuBXoZQWt1ZjuHfwJZ1dgjszVEqwY9S0SdqCg2ZlL9s3vDIrrd3wLWrcHLQMd9gwsppNv9c7JfIJdlcZLTmF9EuL6eCvVVrqBVqLHjva4erqYol6K/jbSfUtRCy8IlFU7LYu1KLehZKYvj3vekj3Cn08Aqljr/Q8Pw+OfUZTzKg4PVDQVfFqKtyosv'), + new X509Certificate( + Base64BinaryValue::fromString('MIIFhDCCA2ygAwIBAgIEAJimITANBgkqhkiG9w0BAQsFADBiMQswCQYDVQQGEwJOTDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTMwMQYDVQQDDCpTdGFhdCBkZXIgTmVkZXJsYW5kZW4gUHJpdmF0ZSBSb290IENBIC0gRzEwHhcNMTMxMTE0MTM0ODU1WhcNMjgxMTEzMjMwMDAwWjBiMQswCQYDVQQGEwJOTDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTMwMQYDVQQDDCpTdGFhdCBkZXIgTmVkZXJsYW5kZW4gUHJpdmF0ZSBSb290IENBIC0gRzEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDaIMh56ynwnEhE7Ey54KpX5j1XDoxbHDCgXctute55RjmG2hy6fuq++q/dCSsj38Pi/KYn/PN13EF05k39IRvakb0AQNVyHifNKXfta6Tzi5QcM4BK09DB4Ckb6TdZTNUtWyEcAtRblYaVSQ4Xr5QODNqu2FGQucraVXqCIx81azlOE2JbZli9AZKn94pP57A11dUYhxMsh70YosJEKVB8Ue4ROksHhb/nnOISG+2y9FD5M8u8jYhp00TGZGVu5z0IFgtqX0i8GmrH0ub9AWjf/iU4MWjGVRSq0cwUHEeKRj/UD9a8xIEn9TxIfYj+6+s4tn9dW/4PV5jc6iGJx6ExTPfOR7VHpxS4XujrZb5Ba/+oj/ONdOfR0JSm2itCytbtjQBBL0oocIIqaqOna1cufHkcn9VleF7Zvz/8njQIpAU4J4nJ4pE5pQ3k4ORAGNnq5R9hAqqUQGDlo3Uj8PBou0nPzQ7JNgGkN+my/lGr4rceUNK/8CoGnYFUH+UyFtJkvlLlEkb688/IdNdGgY+vuXCAB6xfKlJjAGChFUBb6swbNeNctVEdUj7Weg4Jt5gXu78C2mjs9x5lcHOgMO4ZmvYJ3Ejp4k3nNa45HOIVkYrfQrrBHzBhR0BuReAagurcbtUjJFd7BtufGVLfU3CUn1l6u3/9eG4DGH6pq+dSKQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUKv25Kx76w4SHBtuB/4aXdQ3rAYswDQYJKoZIhvcNAQELBQADggIBAEvpmXMOOKdQwUPysrsdIkGJUFF+dvmsJDiOuAqV0A1nNTooL3esvDLEZAWZwKTOwRomnHzeCfS/QxRKTkVX21pfrHf9ufDKykpzjl9uAILTS76FJ6//R0RTIPMrzknQpG2fCLR5DFEbHWU/jWAxGmncfx6HQYl/azHaWbv0dhZOUjPdkGAQ6EPvHcyNU9yMkETdw0X6ioxqzMwkGM893oBrMmtduiqIf3/H6HTXoRKAc+/DXZIq/pAc6eVMa6x43kokluaam9L78yDrlHbGd2VYAr/HZ0TjDZTtI2t2/ySTb7JjC8wL8rSqxYmLpNrnhZzPW87sl2OCFC3re3ZhtJkIHNP85jj1gqewTC7DCW6llZdB3hBzfHWby0EX2RlcwgaMfNBEV5U0IogccdXV+S6zWK4F+yBr0sXUrdbdMFu+g3I9CbXxt0q4eVJtoaun4M2Z+bZMqZvy9FryBdSfhpgmJqwFz2luOhPOVCblCPhLrUeewrvuBXoZQWt1ZjuHfwJZ1dgjszVEqwY9S0SdqCg2ZlL9s3vDIrrd3wLWrcHLQMd9gwsppNv9c7JfIJdlcZLTmF9EuL6eCvVVrqBVqLHjva4erqYol6K/jbSfUtRCy8IlFU7LYu1KLehZKYvj3vekj3Cn08Aqljr/Q8Pw+OfUZTzKg4PVDQVfFqKtyosv'), + ), ], ), ], - 'def456', + IDValue::fromString('def456'), ), ]; - $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', 'testval1'); - $keyAuthority = new KeyAuthority($keys, 2, [$attr1]); + $attr1 = new XMLAttribute('urn:test:something', 'test', 'attr1', SAMLStringValue::fromString('testval1')); + $keyAuthority = new KeyAuthority($keys, UnsignedByteValue::fromInteger(2), [$attr1]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), diff --git a/tests/SAML2/XML/shibmd/ScopeTest.php b/tests/SAML2/XML/shibmd/ScopeTest.php index 84ef04f5d6..03e7340c07 100644 --- a/tests/SAML2/XML/shibmd/ScopeTest.php +++ b/tests/SAML2/XML/shibmd/ScopeTest.php @@ -4,15 +4,14 @@ namespace SimpleSAML\Test\SAML2\XML\shibmd; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Group; +use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\shibmd\AbstractShibmdElement; -use SimpleSAML\SAML2\XML\shibmd\Scope; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\shibmd\{AbstractShibmdElement, Scope}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Type\BooleanValue; use function dirname; use function strval; @@ -48,7 +47,10 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { - $scope = new Scope("example.org", false); + $scope = new Scope( + SAMLStringValue::fromString('example.org'), + BooleanValue::fromBoolean(false), + ); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), @@ -57,35 +59,15 @@ public function testMarshalling(): void } - /** - * Marshalling a scope which does not specificy the value for - * regexp explicitly (expect it to default to 'false'). - */ - public function testMarshallingImplicitRegexpValue(): void - { - $scope = new Scope("example.org"); - - $document = DOMDocumentFactory::fromString(''); - $scopeElement = $scope->toXML($document->documentElement); - - $xpCache = XPath::getXPath($scopeElement); - /** @var \DOMElement[] $scopeElements */ - $scopeElements = XPath::xpQuery($scopeElement, '/root/shibmd:Scope', $xpCache); - $this->assertCount(1, $scopeElements); - $scopeElement = $scopeElements[0]; - - $this->assertEquals('example.org', $scopeElement->nodeValue); - $this->assertEquals('urn:mace:shibboleth:metadata:1.0', $scopeElement->namespaceURI); - $this->assertEquals('false', $scopeElement->getAttribute('regexp')); - } - - /** * Marshalling a scope which is in regexp form. */ public function testMarshallingRegexp(): void { - $scope = new Scope("^(.*\.)?example\.edu$", true); + $scope = new Scope( + SAMLStringValue::fromString('^(.*\.)?example\.edu$'), + BooleanValue::fromBoolean(true), + ); $document = DOMDocumentFactory::fromString(''); $scopeElement = $scope->toXML($document->documentElement); @@ -111,7 +93,7 @@ public function testUnmarshallingWithoutRegexpValue(): void $scope = Scope::fromXML(self::$xmlRepresentation->documentElement); $this->assertEquals('example.org', $scope->getContent()); - $this->assertFalse($scope->isRegexpScope()); + $this->assertFalse($scope->isRegexpScope()->toBoolean()); } @@ -126,6 +108,6 @@ public function testUnmarshallingRegexp(): void $scope = Scope::fromXML($document->documentElement); $this->assertEquals('^(.*|)example.edu$', $scope->getContent()); - $this->assertTrue($scope->isRegexpScope()); + $this->assertTrue($scope->isRegexpScope()->toBoolean()); } } diff --git a/tests/resources/xml/md_Extensions.xml b/tests/resources/xml/md_Extensions.xml index 9052cccbdc..881a2ce3e0 100644 --- a/tests/resources/xml/md_Extensions.xml +++ b/tests/resources/xml/md_Extensions.xml @@ -1,5 +1,5 @@ - SomeScope + SomeScope @@ -9,7 +9,7 @@ Example - 127.0.0.1 + 127.0.0.0/8 diff --git a/tests/resources/xml/md_RoleDescriptor.xml b/tests/resources/xml/md_RoleDescriptor.xml index 946c7f5a29..fe6048a5b7 100644 --- a/tests/resources/xml/md_RoleDescriptor.xml +++ b/tests/resources/xml/md_RoleDescriptor.xml @@ -1,5 +1,5 @@ - - + + Some @@ -18,7 +18,7 @@ Identity Providers R US, a Division of Lerxst Corp. https://IdentityProvider.com - + Test Company John Doe diff --git a/tests/resources/xml/mdui_Keywords.xml b/tests/resources/xml/mdui_Keywords.xml index 71e11d66fe..482778ac9e 100644 --- a/tests/resources/xml/mdui_Keywords.xml +++ b/tests/resources/xml/mdui_Keywords.xml @@ -1 +1 @@ -KLM+koninklijke luchtvaart+maatschappij +KLM koninklijke+luchtvaart+maatschappij diff --git a/tests/resources/xml/samlp_ArtifactResolve.xml b/tests/resources/xml/samlp_ArtifactResolve.xml index 0356c29528..cab08e88c1 100644 --- a/tests/resources/xml/samlp_ArtifactResolve.xml +++ b/tests/resources/xml/samlp_ArtifactResolve.xml @@ -1,4 +1,4 @@ - - https://ServiceProvider.com/SAML + + https://ServiceProvider.com/SAML AAQAADWNEw5VT47wcO4zX/iEzMmFQvGknDfws2ZtqSGdkNSbsW1cmVR0bzU= diff --git a/tests/resources/xml/samlp_ArtifactResponse.xml b/tests/resources/xml/samlp_ArtifactResponse.xml index b998066147..4fd5c3baa9 100644 --- a/tests/resources/xml/samlp_ArtifactResponse.xml +++ b/tests/resources/xml/samlp_ArtifactResponse.xml @@ -1,10 +1,10 @@ - - https://sp.example.com/SAML2 + + https://sp.example.com/SAML2 - urn:example:other + urn:example:other diff --git a/tests/resources/xml/samlp_AssertionIDRequest.xml b/tests/resources/xml/samlp_AssertionIDRequest.xml index 36c7f85f36..f1b7f0556e 100644 --- a/tests/resources/xml/samlp_AssertionIDRequest.xml +++ b/tests/resources/xml/samlp_AssertionIDRequest.xml @@ -1,5 +1,5 @@ - - https://gateway.stepup.org/saml20/sp/metadata - _abc123 - _def456 + + https://gateway.stepup.org/saml20/sp/metadata + _abc123 + _def456 diff --git a/tests/resources/xml/samlp_AttributeQuery.xml b/tests/resources/xml/samlp_AttributeQuery.xml index af91a1b965..c3f97ececc 100644 --- a/tests/resources/xml/samlp_AttributeQuery.xml +++ b/tests/resources/xml/samlp_AttributeQuery.xml @@ -1,19 +1,19 @@ - - https://example.org/ - + + https://example.org/ + urn:example:subject - + test1_attrv1 test1_attrv2 - + test2_attrv1 test2_attrv2 test2_attrv3 - - + + 4 23 diff --git a/tests/resources/xml/samlp_AuthnQuery.xml b/tests/resources/xml/samlp_AuthnQuery.xml index c4f9850187..7db034df10 100644 --- a/tests/resources/xml/samlp_AuthnQuery.xml +++ b/tests/resources/xml/samlp_AuthnQuery.xml @@ -1,9 +1,9 @@ - - https://example.org/ - + + https://example.org/ + urn:example:subject - https://example.org/relative/path/to/document.xml + https://example.org/relative/path/to/document.xml diff --git a/tests/resources/xml/samlp_AuthnRequest.xml b/tests/resources/xml/samlp_AuthnRequest.xml index ece73dcc1d..147ace7c52 100644 --- a/tests/resources/xml/samlp_AuthnRequest.xml +++ b/tests/resources/xml/samlp_AuthnRequest.xml @@ -1,6 +1,6 @@ - - https://gateway.stepup.org/saml20/sp/metadata - + + https://gateway.stepup.org/saml20/sp/metadata + user@example.org diff --git a/tests/resources/xml/samlp_AuthzDecisionQuery.xml b/tests/resources/xml/samlp_AuthzDecisionQuery.xml index 54bdd11e45..ded7f4c060 100644 --- a/tests/resources/xml/samlp_AuthzDecisionQuery.xml +++ b/tests/resources/xml/samlp_AuthzDecisionQuery.xml @@ -1,11 +1,11 @@ - - https://example.org/ - + + https://example.org/ + urn:example:subject - SomeAction - SomeOtherAction - + SomeAction + SomeOtherAction + urn:x-simplesamlphp:issuer diff --git a/tests/resources/xml/samlp_LogoutRequest.xml b/tests/resources/xml/samlp_LogoutRequest.xml index 2b4345bed1..5e00e9116b 100644 --- a/tests/resources/xml/samlp_LogoutRequest.xml +++ b/tests/resources/xml/samlp_LogoutRequest.xml @@ -1,6 +1,6 @@ - - urn:x-simplesamlphp:issuer - + + urn:x-simplesamlphp:issuer + diff --git a/tests/resources/xml/samlp_LogoutResponse.xml b/tests/resources/xml/samlp_LogoutResponse.xml index 20b24d5dd7..252fe39aae 100644 --- a/tests/resources/xml/samlp_LogoutResponse.xml +++ b/tests/resources/xml/samlp_LogoutResponse.xml @@ -1,5 +1,5 @@ - - urn:x-simplesamlphp:issuer + + urn:x-simplesamlphp:issuer diff --git a/tests/resources/xml/samlp_Response.xml b/tests/resources/xml/samlp_Response.xml index 6bbfab3366..dbf0d43942 100644 --- a/tests/resources/xml/samlp_Response.xml +++ b/tests/resources/xml/samlp_Response.xml @@ -1,5 +1,5 @@ - - https://IdentityProvider.com + + https://IdentityProvider.com From 6a4c6fb2db2af0a5498d9c29d8374207357c4a52 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 28 Apr 2025 21:17:04 +0200 Subject: [PATCH 02/34] Fix interoperability-tests --- tests/InterOperability/EntitiesDescriptorTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/InterOperability/EntitiesDescriptorTest.php b/tests/InterOperability/EntitiesDescriptorTest.php index 1f59643307..1f3929b732 100644 --- a/tests/InterOperability/EntitiesDescriptorTest.php +++ b/tests/InterOperability/EntitiesDescriptorTest.php @@ -91,7 +91,7 @@ public static function provideMetadata(): array DOMDocumentFactory::fromFile('/tmp/metadata/grnet.xml')->documentElement, ], 'EduID' => [ - DOMDocumentFactory::fromFile('eduid.xml')->documentElement, + DOMDocumentFactory::fromFile('/tmp/metadata/eduid.xml')->documentElement, ], ]; } From a9feaa44329e4e4edeae6584d413874d04386dd1 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 28 Apr 2025 21:44:33 +0200 Subject: [PATCH 03/34] Allow tld as DomainValue --- src/Assert/DomainTrait.php | 2 +- tests/SAML2/Assert/DomainTest.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Assert/DomainTrait.php b/src/Assert/DomainTrait.php index 0d3c3c7527..7b1f43190a 100644 --- a/src/Assert/DomainTrait.php +++ b/src/Assert/DomainTrait.php @@ -14,7 +14,7 @@ trait DomainTrait { private static string $domain_regex = '/^ (?!\-) - (?:(?:[a-zA-Z\d][a-zA-Z\d\-]{0,61})?[a-zA-Z\d]\.){1,126} + (?:(?:[a-zA-Z\d][a-zA-Z\d\-]{0,61})?[a-zA-Z\d]\.){0,126} (?!\d+)[a-zA-Z\d]{1,63} $/Dxi'; diff --git a/tests/SAML2/Assert/DomainTest.php b/tests/SAML2/Assert/DomainTest.php index 4fbabcdfc2..cf07c635e3 100644 --- a/tests/SAML2/Assert/DomainTest.php +++ b/tests/SAML2/Assert/DomainTest.php @@ -45,7 +45,8 @@ public static function provideDomain(): array 'ipv4' => [false, '192.168.0.1'], 'ipv6' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B'], 'with scheme' => [false, 'https://simplesamlphp.org'], - 'tld' => [false, '.org'], + 'start with dot' => [false, '.org'], + 'tld' => [true, 'nl'], ]; } } From 64e2f309398162298a44680b9f99f427f7080260 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 28 Apr 2025 22:06:03 +0200 Subject: [PATCH 04/34] Fix codesniffer errors --- phpcs.xml | 2 ++ tests/SAML2/Binding/HTTPRedirectTest.php | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpcs.xml b/phpcs.xml index 5eabf531b4..da40d31fee 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -41,6 +41,8 @@ tests/SAML2/XML/saml/AuthnContextTest.php tests/SAML2/XML/saml/EncryptedAssertionTest.php tests/SAML2/XML/saml/EncryptedIDTest.php + tests/SAML2/XML/saml/SubjectConfirmationTest.php + tests/SAML2/XML/samlp/AuthnRequestTest.php tests/SAML2/XML/samlp/RequestedAuthnContextTest.php tests/SAML2/XML/samlp/StatusDetailTest.php tests/SAML2/XML/shibmd/KeyAuthorityTest.php diff --git a/tests/SAML2/Binding/HTTPRedirectTest.php b/tests/SAML2/Binding/HTTPRedirectTest.php index 9dad0ce0e1..ffae14d189 100644 --- a/tests/SAML2/Binding/HTTPRedirectTest.php +++ b/tests/SAML2/Binding/HTTPRedirectTest.php @@ -16,8 +16,6 @@ use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\{AbstractRequest, AuthnRequest, Response, Status, StatusCode}; use SimpleSAML\XML\Type\IDValue; -use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; -use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; /** * @package simplesamlphp\saml2 From 3ea81b501f75ffb50c6fffa9331c02fc35a90960 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 28 Apr 2025 22:47:30 +0200 Subject: [PATCH 05/34] Fix several phpstan-issues --- phpstan.neon | 2 +- src/Type/CIDRValue.php | 2 +- src/Type/DomainValue.php | 2 +- src/Type/EmailAddressValue.php | 2 +- src/Type/GeolocationValue.php | 2 +- src/Type/KeyTypesValue.php | 4 ++-- src/Type/ListOfStringsValue.php | 4 ++-- src/Utilities/ArrayCollection.php | 2 +- src/XML/idpdisc/DiscoveryResponse.php | 4 ++-- src/XML/md/AbstractIndexedEndpointType.php | 2 +- src/XML/md/AbstractLocalizedName.php | 2 +- src/XML/md/AbstractLocalizedURI.php | 2 +- src/XML/md/AbstractRoleDescriptorType.php | 2 +- src/XML/md/AttributeConsumingService.php | 2 +- src/XML/md/ContactPerson.php | 2 +- src/XML/md/KeyDescriptor.php | 4 ++-- src/XML/md/RequestedAttribute.php | 2 +- src/XML/mdui/UIInfo.php | 2 +- src/XML/samlp/AbstractMessage.php | 4 ++-- src/XML/samlp/ArtifactResolve.php | 6 +++--- src/XML/samlp/AssertionIDRequest.php | 6 +++--- src/XML/samlp/LogoutRequest.php | 2 +- src/XML/samlp/Response.php | 2 +- src/XML/samlp/StatusCode.php | 2 +- src/XML/shibmd/KeyAuthority.php | 4 ++-- 25 files changed, 35 insertions(+), 35 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 21cf5903a3..e007852f22 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,4 +1,4 @@ parameters: - level: 1 + level: 2 paths: - src diff --git a/src/Type/CIDRValue.php b/src/Type/CIDRValue.php index e129e77ad2..1e726b03bc 100644 --- a/src/Type/CIDRValue.php +++ b/src/Type/CIDRValue.php @@ -14,7 +14,7 @@ class CIDRValue extends SAMLStringValue /** * Validate the content of the element. * - * @param string $content The value to go in the XML textContent + * @param string $value The value to go in the XML textContent * @throws \Exception on failure * @return void */ diff --git a/src/Type/DomainValue.php b/src/Type/DomainValue.php index 687ed37860..a6f4182fa0 100644 --- a/src/Type/DomainValue.php +++ b/src/Type/DomainValue.php @@ -32,7 +32,7 @@ protected function sanitizeValue(string $value): string /** * Validate the content of the element. * - * @param string $content The value to go in the XML textContent + * @param string $value The value to go in the XML textContent * @throws \Exception on failure * @return void */ diff --git a/src/Type/EmailAddressValue.php b/src/Type/EmailAddressValue.php index 728a69f1d1..833f27e31b 100644 --- a/src/Type/EmailAddressValue.php +++ b/src/Type/EmailAddressValue.php @@ -32,7 +32,7 @@ protected function sanitizeValue(string $value): string /** * Validate the content of the element. * - * @param string $content The value to go in the XML textContent + * @param string $value The value to go in the XML textContent * @throws \Exception on failure * @return void */ diff --git a/src/Type/GeolocationValue.php b/src/Type/GeolocationValue.php index 5fb242f543..cc4bd929c4 100644 --- a/src/Type/GeolocationValue.php +++ b/src/Type/GeolocationValue.php @@ -30,7 +30,7 @@ protected function sanitizeValue(string $value): string /** * Validate the content of the element. * - * @param string $content The value to go in the XML textContent + * @param string $value The value to go in the XML textContent * @return void */ protected function validateValue(string $value): void diff --git a/src/Type/KeyTypesValue.php b/src/Type/KeyTypesValue.php index 96e01bc5d4..85f346043a 100644 --- a/src/Type/KeyTypesValue.php +++ b/src/Type/KeyTypesValue.php @@ -22,10 +22,10 @@ class KeyTypesValue extends SAMLStringValue * @throws \Exception on failure * @return void */ - protected function validateValue(string $value): void + protected function validateValue(string $content): void { Assert::oneOf( - $this->sanitizeValue($value), + $this->sanitizeValue($content), array_column(KeyTypesEnum::cases(), 'value'), SchemaViolationException::class, ); diff --git a/src/Type/ListOfStringsValue.php b/src/Type/ListOfStringsValue.php index f6aa416328..b3c6c919c6 100644 --- a/src/Type/ListOfStringsValue.php +++ b/src/Type/ListOfStringsValue.php @@ -48,7 +48,7 @@ protected function validateValue(string $value): void /** * Convert an array of xs:string items into a mdui:ListOfStrings * - * @param array<\SimpleSAML\SAML2\Type\StringValue> $keywords + * @param array<\SimpleSAML\SAML2\Type\SAMLStringValue> $keywords * @return static */ public static function fromArray(array $keywords): static @@ -67,7 +67,7 @@ public static function fromArray(array $keywords): static /** * Convert this mdui:ListOfStrings to an array of xs:string items * - * @return array<\SimpleSAML\SAML2\Type\StringValue> + * @return array<\SimpleSAML\SAML2\Type\SAMLStringValue> */ public function toArray(): array { diff --git a/src/Utilities/ArrayCollection.php b/src/Utilities/ArrayCollection.php index 54a0ef6c5b..63a36fbbde 100644 --- a/src/Utilities/ArrayCollection.php +++ b/src/Utilities/ArrayCollection.php @@ -54,7 +54,7 @@ public function get($key) /** - * @param \Closure $f + * @param \Closure $filterFunction * * @return \SimpleSAML\SAML2\Utilities\ArrayCollection */ diff --git a/src/XML/idpdisc/DiscoveryResponse.php b/src/XML/idpdisc/DiscoveryResponse.php index 0af57be668..f0ec80892c 100644 --- a/src/XML/idpdisc/DiscoveryResponse.php +++ b/src/XML/idpdisc/DiscoveryResponse.php @@ -54,13 +54,13 @@ public function __construct( SAMLAnyURIValue $binding, SAMLAnyURIValue $location, ?BooleanValue $isDefault = null, - ?SAMLAnyURIValue $unused = null, + ?SAMLAnyURIValue $responseLocation = null, // unused array $children = [], array $attributes = [], ) { Assert::same($binding->getValue(), C::BINDING_IDPDISC, ProtocolViolationException::class); Assert::null( - $unused, + $responseLocation, 'The \'ResponseLocation\' attribute must be omitted for idpdisc:DiscoveryResponse.', ); parent::__construct($index, $binding, $location, $isDefault, null, $children, $attributes); diff --git a/src/XML/md/AbstractIndexedEndpointType.php b/src/XML/md/AbstractIndexedEndpointType.php index 6c24af7c4c..c520f85a8d 100644 --- a/src/XML/md/AbstractIndexedEndpointType.php +++ b/src/XML/md/AbstractIndexedEndpointType.php @@ -40,7 +40,7 @@ abstract class AbstractIndexedEndpointType extends AbstractEndpointType implemen * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault - * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $responseLocation + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation * @param array $children * @param list<\SimpleSAML\XML\Attribute> $attributes */ diff --git a/src/XML/md/AbstractLocalizedName.php b/src/XML/md/AbstractLocalizedName.php index 9be5a270d8..820d71c325 100644 --- a/src/XML/md/AbstractLocalizedName.php +++ b/src/XML/md/AbstractLocalizedName.php @@ -33,7 +33,7 @@ abstract class AbstractLocalizedName extends AbstractMdElement implements Arrayi * LocalizedNameType constructor. * * @param \SimpleSAML\XML\Type\LanguageValue $language The language this string is localized in. - * @param \SimpleSAML\SAML2\Type\SAMLStringValue $value The localized string. + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $content The localized string. */ public function __construct( protected LanguageValue $language, diff --git a/src/XML/md/AbstractLocalizedURI.php b/src/XML/md/AbstractLocalizedURI.php index fd9641759b..ab2170c85a 100644 --- a/src/XML/md/AbstractLocalizedURI.php +++ b/src/XML/md/AbstractLocalizedURI.php @@ -28,7 +28,7 @@ abstract class AbstractLocalizedURI extends AbstractLocalizedName * LocalizedNameType constructor. * * @param \SimpleSAML\XML\Type\LanguageValue $language The language this string is localized in. - * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $value The localized string. + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $content The localized string. */ final public function __construct( protected LanguageValue $language, diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index a5f1bdcc13..2dea9113fb 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -91,7 +91,7 @@ public function __construct( /** * Collect the value of the errorURL property. * - * @return \SimpleSAML\SAML2\XML\SAMLAnyURIValue|null + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null */ public function getErrorURL(): ?SAMLAnyURIValue { diff --git a/src/XML/md/AttributeConsumingService.php b/src/XML/md/AttributeConsumingService.php index 994782e645..ad34c0eaac 100644 --- a/src/XML/md/AttributeConsumingService.php +++ b/src/XML/md/AttributeConsumingService.php @@ -27,7 +27,7 @@ final class AttributeConsumingService extends AbstractMdElement implements Schem /** * AttributeConsumingService constructor. * - * @param \SimpleSAML\XML\Type\UnsignedShort $index + * @param \SimpleSAML\XML\Type\UnsignedShortValue $index * @param \SimpleSAML\SAML2\XML\md\ServiceName[] $serviceName * @param \SimpleSAML\SAML2\XML\md\RequestedAttribute[] $requestedAttribute * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault diff --git a/src/XML/md/ContactPerson.php b/src/XML/md/ContactPerson.php index de7215fbbe..2431931bcf 100644 --- a/src/XML/md/ContactPerson.php +++ b/src/XML/md/ContactPerson.php @@ -56,7 +56,7 @@ final class ContactPerson extends AbstractMdElement implements /** * ContactPerson constructor. * - * @param \SimpleSAML\SAML2\SAMLStringValue $contactType + * @param \SimpleSAML\SAML2\Type\SAMLStringValue $contactType * @param \SimpleSAML\SAML2\XML\md\Company|null $company * @param \SimpleSAML\SAML2\XML\md\GivenName|null $givenName * @param \SimpleSAML\SAML2\XML\md\SurName|null $surName diff --git a/src/XML/md/KeyDescriptor.php b/src/XML/md/KeyDescriptor.php index 3f43f5d41f..6b64712e2b 100644 --- a/src/XML/md/KeyDescriptor.php +++ b/src/XML/md/KeyDescriptor.php @@ -28,7 +28,7 @@ final class KeyDescriptor extends AbstractMdElement implements SchemaValidatable * KeyDescriptor constructor. * * @param \SimpleSAML\XMLSecurity\XML\ds\KeyInfo $keyInfo - * @param \SimpleSAML\SAML2\XML\md\KeyTypesValue|null $use + * @param \SimpleSAML\SAML2\Type\KeyTypesValue|null $use * @param \SimpleSAML\SAML2\XML\md\EncryptionMethod[] $encryptionMethod */ public function __construct( @@ -44,7 +44,7 @@ public function __construct( /** * Collect the value of the use property. * - * @return \SimpleSAML\SAML2\XML\saml\KeyTypesValue|null + * @return \SimpleSAML\SAML2\Type\KeyTypesValue|null */ public function getUse(): ?KeyTypesValue { diff --git a/src/XML/md/RequestedAttribute.php b/src/XML/md/RequestedAttribute.php index b7771de68d..40df3d6857 100644 --- a/src/XML/md/RequestedAttribute.php +++ b/src/XML/md/RequestedAttribute.php @@ -52,7 +52,7 @@ public function __construct( /** * Collect the value of the isRequired-property * - * @return \SimpleSAML\SAML2\Type\BooleanValue|null + * @return \SimpleSAML\XML\Type\BooleanValue|null */ public function getIsRequired(): ?BooleanValue { diff --git a/src/XML/mdui/UIInfo.php b/src/XML/mdui/UIInfo.php index 073cedbe23..137fbcbb95 100644 --- a/src/XML/mdui/UIInfo.php +++ b/src/XML/mdui/UIInfo.php @@ -231,7 +231,7 @@ public function isEmptyElement(): bool /** * Test localized elements for multiple items with the same language * - * @param (\SimpleSAML\SAML2\XML\md\AbstractLocalizedURL| + * @param (\SimpleSAML\SAML2\XML\md\AbstractLocalizedURI| * \SimpleSAML\SAML2\XML\md\AbstractLocalizedName| * \SimpleSAML\SAML2\XML\mdui\Keywords)[] $elements * @return void diff --git a/src/XML/samlp/AbstractMessage.php b/src/XML/samlp/AbstractMessage.php index d36fc4a370..fd5c883548 100644 --- a/src/XML/samlp/AbstractMessage.php +++ b/src/XML/samlp/AbstractMessage.php @@ -51,7 +51,7 @@ abstract class AbstractMessage extends AbstractSamlpElement implements SignableE * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $issueInstant - * @param \SipmleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * @@ -94,7 +94,7 @@ public function getIssueInstant(): SAMLDateTimeValue /** * Retrieve the destination of this message. * - * @return \SimpleSAML\SAML\Type\SAMLAnyURIValue|null The destination of this message, + * @return \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null The destination of this message, * or NULL if no destination is given */ public function getDestination(): ?SAMLAnyURIValue diff --git a/src/XML/samlp/ArtifactResolve.php b/src/XML/samlp/ArtifactResolve.php index 5f3fe8a699..1d933f99da 100644 --- a/src/XML/samlp/ArtifactResolve.php +++ b/src/XML/samlp/ArtifactResolve.php @@ -33,10 +33,10 @@ class ArtifactResolve extends AbstractRequest implements SchemaValidatableElemen * * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Artifact $artifact - * @param \SimpleSAML\SAML2\Type\DateTimeValue $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $destination - * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * * @throws \Exception diff --git a/src/XML/samlp/AssertionIDRequest.php b/src/XML/samlp/AssertionIDRequest.php index a846be2a91..f02dc293d4 100644 --- a/src/XML/samlp/AssertionIDRequest.php +++ b/src/XML/samlp/AssertionIDRequest.php @@ -32,9 +32,9 @@ final class AssertionIDRequest extends AbstractRequest implements SchemaValidata * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\AssertionIDRef[] $assertionIDRef * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param \SimpleSAML\SAML2\Type\DateTimeValue|null $issueInstant - * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $destination - * @param \SimpleSAML\SAML2\Type\AnyURIValue|null $consent + * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $issueInstant + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException diff --git a/src/XML/samlp/LogoutRequest.php b/src/XML/samlp/LogoutRequest.php index e5f0f9eaa3..1626bd06e6 100644 --- a/src/XML/samlp/LogoutRequest.php +++ b/src/XML/samlp/LogoutRequest.php @@ -79,7 +79,7 @@ public function getNotOnOrAfter(): ?SAMLDateTimeValue /** * Retrieve the reason for this request. * - * @return \SimpleSAML\SAML2\Type\StringValue|null The reason for this request. + * @return \SimpleSAML\SAML2\Type\SAMLStringValue|null The reason for this request. */ public function getReason(): ?SAMLStringValue { diff --git a/src/XML/samlp/Response.php b/src/XML/samlp/Response.php index 89121fde2c..e08c722ee7 100644 --- a/src/XML/samlp/Response.php +++ b/src/XML/samlp/Response.php @@ -32,7 +32,7 @@ class Response extends AbstractStatusResponse implements SchemaValidatableElemen /** * Constructor for SAML 2 response messages. * - * @param \SimpleSAML\SAML2\IDValue $id + * @param \SimpleSAML\XML\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer diff --git a/src/XML/samlp/StatusCode.php b/src/XML/samlp/StatusCode.php index 0af581cfd8..c8d1af69cd 100644 --- a/src/XML/samlp/StatusCode.php +++ b/src/XML/samlp/StatusCode.php @@ -26,7 +26,7 @@ final class StatusCode extends AbstractSamlpElement implements SchemaValidatable /** * Initialize a samlp:StatusCode * - * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValueValue $Value + * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $Value * @param \SimpleSAML\SAML2\XML\samlp\StatusCode[] $subCodes */ public function __construct( diff --git a/src/XML/shibmd/KeyAuthority.php b/src/XML/shibmd/KeyAuthority.php index 2b2470bc71..e812ed59f2 100644 --- a/src/XML/shibmd/KeyAuthority.php +++ b/src/XML/shibmd/KeyAuthority.php @@ -52,9 +52,9 @@ public function __construct( /** * Collect the value of the VerifyDepth-property * - * @return \SimpleSAML\XML\Type\UnsigedByteValue|null + * @return \SimpleSAML\XML\Type\UnsignedByteValue|null */ - public function getVerifyDepth(): ?UnsignedByteValue + public function getVerifyDepth(): UnsignedByteValue|null { return $this->VerifyDepth; } From 38c11c6ffe4642aca9dcfdb1c171dda936fedaae Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 28 Apr 2025 22:49:28 +0200 Subject: [PATCH 06/34] generate baseline --- phpstan-baseline.neon | 286 ++++++++++++++++++++++++++++++++++++++++++ phpstan.neon | 2 + 2 files changed, 288 insertions(+) create mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000000..8b17eb89cd --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,286 @@ +parameters: + ignoreErrors: + - + message: "#^Call to an undefined method SimpleSAML\\\\SAML2\\\\XML\\\\samlp\\\\AbstractMessage\\:\\:addValidator\\(\\)\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to an undefined method SimpleSAML\\\\SAML2\\\\XML\\\\samlp\\\\ArtifactResponse\\:\\:validate\\(\\)\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to method addURLparameters\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\HTTP\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to method getString\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to static method addSign\\(\\) on an unknown class SimpleSAML\\\\Module\\\\saml\\\\Message\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Store\\\\StoreFactory\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to static method getMetadataHandler\\(\\) on an unknown class SimpleSAML\\\\Metadata\\\\MetaDataStorageHandler\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Instantiated class SimpleSAML\\\\Utils\\\\HTTP not found\\.$#" + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:validateSignature\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + count: 2 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Parameter \\$sp of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:setSPMetadata\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Property SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:\\$spMetadata has unknown class SimpleSAML\\\\Configuration as its type\\.$#" + count: 2 + path: src/Binding/HTTPArtifact.php + + - + message: "#^Call to an undefined method SimpleSAML\\\\XMLSecurity\\\\XML\\\\ds\\\\SignatureValue\\:\\:getContent\\(\\)\\.$#" + count: 1 + path: src/Binding/HTTPRedirect.php + + - + message: "#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + count: 1 + path: src/Certificate/PrivateKeyLoader.php + + - + message: "#^Access to property \\$passphrase on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + count: 2 + path: src/Certificate/PrivateKeyLoader.php + + - + message: "#^Call to method loadKey\\(\\) on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + count: 2 + path: src/Certificate/PrivateKeyLoader.php + + - + message: "#^Instantiated class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey not found\\.$#" + count: 2 + path: src/Certificate/PrivateKeyLoader.php + + - + message: "#^Method SimpleSAML\\\\SAML2\\\\Certificate\\\\PrivateKeyLoader\\:\\:convertPrivateKeyToRsaKey\\(\\) has invalid return type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + count: 2 + path: src/Certificate/PrivateKeyLoader.php + + - + message: "#^PHPDoc tag @param for parameter \\$qName with type SimpleSAML\\\\XML\\\\Type\\\\QNameValue\\|null is not subtype of native type SimpleSAML\\\\XML\\\\Type\\\\QNameValue\\.$#" + count: 1 + path: src/Compat/AbstractContainer.php + + - + message: "#^Call to method getArray\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 1 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Call to method getBoolean\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Call to method getString\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 10 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Call to method getValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 1 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Call to method hasValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 7 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForDecryptionProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:pluckConfiguration\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/Configuration/SimpleSAMLConverter.php + + - + message: "#^Access to property \\$key on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Call to an undefined method SimpleSAML\\\\SAML2\\\\XML\\\\samlp\\\\AbstractMessage\\:\\:addValidator\\(\\)\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Call to method getCertPath\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\Config\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Call to method getPublicKeys\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Call to method getString\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 3 + path: src/SOAPClient.php + + - + message: "#^Call to method getValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 3 + path: src/SOAPClient.php + + - + message: "#^Call to method hasValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + count: 5 + path: src/SOAPClient.php + + - + message: "#^Call to method loadPrivateKey\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\Crypto\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Call to method loadPublicKey\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\Crypto\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Config not found\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Crypto not found\\.$#" + count: 1 + path: src/SOAPClient.php + + - + message: "#^Parameter \\$dstMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/SOAPClient.php + + - + message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:validateSSL\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + count: 2 + path: src/SOAPClient.php + + - + message: "#^Parameter \\$srcMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + count: 2 + path: src/SOAPClient.php + + - + message: "#^Unsafe usage of new static\\(\\)\\.$#" + count: 2 + path: src/XML/md/AbstractEndpointType.php + + - + message: "#^Unsafe usage of new static\\(\\)\\.$#" + count: 2 + path: src/XML/md/AbstractIndexedEndpointType.php + + - + message: "#^Unsafe usage of new static\\(\\)\\.$#" + count: 2 + path: src/XML/md/AbstractLocalizedName.php + + - + message: "#^Call to an undefined static method SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractSignedMdElement\\:\\:getXsiTypeNamespaceURI\\(\\)\\.$#" + count: 1 + path: src/XML/md/AbstractSignedMdElement.php + + - + message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\AbstractElement\\:\\:getList\\(\\)\\.$#" + count: 1 + path: src/XML/md/ContactPerson.php + + - + message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\AbstractElement\\:\\:getList\\(\\)\\.$#" + count: 1 + path: src/XML/md/EntitiesDescriptor.php + + - + message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\AbstractElement\\:\\:getList\\(\\)\\.$#" + count: 1 + path: src/XML/md/Organization.php + + - + message: "#^Call to an undefined method DOMDocument\\:\\:setAttribute\\(\\)\\.$#" + count: 1 + path: src/XML/mdui/Keywords.php + + - + message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\Type\\\\ValueTypeInterface\\:\\:toArray\\(\\)\\.$#" + count: 1 + path: src/XML/mdui/Keywords.php + + - + message: "#^Unsafe usage of new static\\(\\)\\.$#" + count: 1 + path: src/XML/saml/Attribute.php + + - + message: "#^Unsafe usage of new static\\(\\)\\.$#" + count: 1 + path: src/XML/saml/EncryptedAttribute.php + + - + message: "#^Unsafe usage of new static\\(\\)\\.$#" + count: 1 + path: src/XML/saml/EncryptedID.php + + - + message: "#^Unsafe usage of new static\\(\\)\\.$#" + count: 1 + path: src/XML/saml/NameIDType.php diff --git a/phpstan.neon b/phpstan.neon index e007852f22..de03d2c724 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,3 +2,5 @@ parameters: level: 2 paths: - src +includes: + - phpstan-baseline.neon From cd2a381a8607f189b882d3c59a722c2e4c97bfab Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 28 Apr 2025 23:34:08 +0200 Subject: [PATCH 07/34] Fix phpstan-dev issues and generate a baseline --- phpstan-baseline-dev.neon | 3824 ++++++++++++++++- src/Type/ListOfStringsValue.php | 2 +- tests/SAML2/CustomRoleDescriptor.php | 4 +- tests/SAML2/XML/md/RoleDescriptorTest.php | 2 +- tests/SAML2/XML/md/ServiceNameTest.php | 2 +- tests/bin/authnrequest.php | 12 +- tests/bin/encryptedattribute.php | 7 +- tests/bin/encryptedid.php | 3 +- tests/bin/entityattributes.php | 74 +- tests/bin/logoutrequest.php | 14 +- .../signedresponse_with_signedassertion.php | 18 +- .../signedresponse_with_unsignedassertion.php | 18 +- .../unsignedresponse_with_signedassertion.php | 18 +- 13 files changed, 3924 insertions(+), 74 deletions(-) diff --git a/phpstan-baseline-dev.neon b/phpstan-baseline-dev.neon index 15d7c20a36..a395860c1f 100644 --- a/phpstan-baseline-dev.neon +++ b/phpstan-baseline-dev.neon @@ -1,5 +1,41 @@ parameters: ignoreErrors: + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + - message: '#^PHPDoc tag @var for property SimpleSAML\\Test\\SAML2\\Assertion\\Transformer\\NameIdDecryptionTransformerTest\:\:\$validator with type SimpleSAML\\SAML2\\Response\\Validation\\Validator is incompatible with native type SimpleSAML\\SAML2\\Signature\\Validator\.$#' identifier: property.phpDocType @@ -12,6 +48,24 @@ parameters: count: 2 path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php + - message: '#^PHPDoc tag @var for property SimpleSAML\\Test\\SAML2\\Assertion\\Validation\\AssertionValidatorTest\:\:\$validator with type SimpleSAML\\SAML2\\Response\\Validation\\Validator is incompatible with native type SimpleSAML\\SAML2\\Signature\\Validator\.$#' identifier: property.phpDocType @@ -30,24 +84,306 @@ parameters: count: 1 path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 7 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 7 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 9 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + - message: '#^Parameter \#1 \$serviceProvider of method SimpleSAML\\SAML2\\Assertion\\Validation\\ConstraintValidator\\SpIsValidAudience\:\:setServiceProvider\(\) expects SimpleSAML\\SAML2\\Configuration\\ServiceProvider, Mockery\\MockInterface given\.$#' identifier: argument.type count: 3 path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php + - message: '#^Parameter \#1 \$response of class SimpleSAML\\SAML2\\Assertion\\Validation\\ConstraintValidator\\SubjectConfirmationResponseToMatches constructor expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' identifier: argument.type count: 5 path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php + - message: '#^PHPDoc tag @var for property SimpleSAML\\Test\\SAML2\\XML\\saml\\SubjectConfirmationValidatorTest\:\:\$validator with type SimpleSAML\\SAML2\\Response\\Validation\\Validator is incompatible with native type SimpleSAML\\SAML2\\Signature\\Validator\.$#' identifier: property.phpDocType count: 1 path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/Binding/HTTPPostTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Binding/HTTPPostTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/Binding/HTTPPostTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Binding/HTTPPostTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/Binding/HTTPPostTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/Binding/HTTPRedirectTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/Binding/HTTPRedirectTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/Binding/HTTPRedirectTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Binding/HTTPRedirectTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/Binding/HTTPRedirectTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/Binding/SOAPTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\Artifact\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/Binding/SOAPTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Binding/SOAPTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Binding/SOAPTest.php + - message: '#^Parameter \#1 \$element of method SimpleSAML\\SAML2\\Certificate\\KeyCollection\:\:add\(\) expects SimpleSAML\\SAML2\\Certificate\\Key, string given\.$#' identifier: argument.type @@ -67,25 +403,3493 @@ parameters: path: tests/SAML2/Certificate/KeyLoaderTest.php - - message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\DestinationMatches\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomBaseID.php + + - + message: '#^Parameter \#2 \$NameQualifier of class SimpleSAML\\Test\\SAML2\\CustomBaseID constructor expects SimpleSAML\\SAML2\\Type\\SAMLStringValue\|null, string given\.$#' identifier: argument.type - count: 2 - path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php + count: 1 + path: tests/SAML2/CustomBaseID.php - - message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\IsSuccessful\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' + message: '#^Parameter \#3 \$SPNameQualifier of class SimpleSAML\\Test\\SAML2\\CustomBaseID constructor expects SimpleSAML\\SAML2\\Type\\SAMLStringValue\|null, string given\.$#' identifier: argument.type + count: 1 + path: tests/SAML2/CustomBaseID.php + + - + message: '#^Static method SimpleSAML\\XML\\AbstractElement\:\:getOptionalAttribute\(\) invoked with 4 parameters, 2\-3 required\.$#' + identifier: arguments.count count: 2 - path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php + path: tests/SAML2/CustomBaseID.php - - message: '#^Parameter \#1 \$xml of static method SimpleSAML\\SAML2\\XML\\saml\\Assertion\:\:fromXML\(\) expects DOMElement, DOMNode\|null given\.$#' - identifier: argument.type + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomCondition.php + + - + message: '#^Call to method getNamespacePrefix\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Call to method getNamespaceURI\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound count: 2 - path: tests/SAML2/Response/XmlSignatureWrappingTest.php + path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Parameter \#1 \$requestedAuthnContexts of class SimpleSAML\\SAML2\\XML\\samlp\\RequestedAuthnContext constructor expects array\, array\ given\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Class SimpleSAML\\XML\\Type\\DurationValue not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Class SimpleSAML\\XML\\Type\\IDValue not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \#3 \$ID of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XML\\Type\\IDValue\|null, string given\.$#' identifier: argument.type count: 1 - path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \#4 \$attrValue of class SimpleSAML\\XML\\Attribute constructor expects string, SimpleSAML\\XML\\Type\\QNameValue given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \#4 \$validUntil of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\|null, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \#5 \$cacheDuration of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XML\\Type\\DurationValue\|null, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \#7 \$errorURL of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\|null, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \$ID of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \$cacheDuration of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XML\\Type\\DurationValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Static method SimpleSAML\\XML\\AbstractElement\:\:getOptionalAttribute\(\) invoked with 4 parameters, 2\-3 required\.$#' + identifier: arguments.count + count: 4 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomStatement.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php + + - + message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\DestinationMatches\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php + + - + message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\IsSuccessful\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php + + - + message: '#^Parameter \#1 \$xml of static method SimpleSAML\\SAML2\\XML\\saml\\Assertion\:\:fromXML\(\) expects DOMElement, DOMNode\|null given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/Response/XmlSignatureWrappingTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Signature/ValidatorChainTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Signature/ValidatorChainTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Signature/ValidatorChainTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Type/EntityIDValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Type/ListOfStringsValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Type/SAMLAnyURIValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Type/SAMLDateTimeValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/Type/SAMLStringValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/UtilsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/UtilsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/UtilsTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/UtilsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/alg/DigestMethodTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/alg/SigningMethodTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/alg/SigningMethodTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/ecp/RelayStateTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\ecp\\RelayState does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/ecp/RelayStateTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/ecp/RequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/ecp/RequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 7 + path: tests/SAML2/XML/ecp/RequestTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/ecp/RequestTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/ecp/RequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/ecp/ResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/emd/RepublishRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/emd/RepublishTargetTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/init/RequestInitiatorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/init/RequestInitiatorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/AdditionalMetadataLocationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/AffiliateMemberTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AffiliateMember does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/AffiliateMemberTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AffiliateMember does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 11 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AttributeProfile does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 3 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 8 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 5 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/AttributeProfileTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AttributeProfile does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/AttributeProfileTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 12 + path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 8 + path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/CompanyTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\Company does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/CompanyTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 6 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\Company does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\GivenName does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\SurName does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\TelephoneNumber does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/EmailAddressTest.php + + - + message: '#^Cannot call abstract static method SimpleSAML\\XML\\SerializableElementInterface\:\:fromXML\(\)\.$#' + identifier: staticMethod.callToAbstract + count: 2 + path: tests/SAML2/XML/md/EmailAddressTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/EmailAddressTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/md/EncryptionMethodTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSecurity\\Type\\KeySizeValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EncryptionMethodTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EncryptionMethodTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/EndpointTypeTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EndpointTypeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/EntitiesDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/EntitiesDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/EntitiesDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EntitiesDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EntitiesDescriptorTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 6 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 6 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 20 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 12 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 8 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AffiliateMember does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 6 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/ExtensionsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/ExtensionsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/ExtensionsTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/ExtensionsTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/ExtensionsTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/ExtensionsTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/ExtensionsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/GivenNameTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\GivenName does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/GivenNameTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 34 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AttributeProfile does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 3 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/KeyDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/KeyDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/NameIDFormatTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/NameIDFormatTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/NameIDMappingServiceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationDisplayNameTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationDisplayNameTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationNameTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationNameTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/OrganizationTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/md/OrganizationTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationURLTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/OrganizationURLTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 7 + path: tests/SAML2/XML/md/PDPDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/PDPDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 3 + path: tests/SAML2/XML/md/PDPDescriptorTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/md/RequestedAttributeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/RequestedAttributeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/md/RequestedAttributeTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/RequestedAttributeTest.php + + - + message: '#^Class SimpleSAML\\Test\\SAML2\\XML\\md\\AssertionFailedException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/RequestedAttributeTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/RequestedAttributeTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 9 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\AnyURIValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\Company does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\GivenName does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\SurName does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\TelephoneNumber does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 20 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 8 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/ServiceDescriptionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/ServiceDescriptionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/ServiceNameTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/ServiceNameTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/SingleSignOnServiceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/SurNameTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\SurName does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/SurNameTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/md/TelephoneNumberTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\md\\TelephoneNumber does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/md/TelephoneNumberTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:FromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdattr/EntityAttributesTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 8 + path: tests/SAML2/XML/mdattr/EntityAttributesTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdattr/EntityAttributesTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 8 + path: tests/SAML2/XML/mdattr/EntityAttributesTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdattr/EntityAttributesTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/mdattr/EntityAttributesTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/mdrpi/PublicationPathTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/mdrpi/PublicationPathTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/PublicationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/mdrpi/PublicationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/UsagePolicyTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/UsagePolicyTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/DescriptionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdui/DescriptionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\mdui\\GeolocationHint\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\GeolocationValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\DomainHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\GeolocationHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/mdui/DiscoHintsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/DisplayNameTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdui/DisplayNameTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/DomainHintTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\DomainHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/mdui/DomainHintTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\GeolocationValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/GeolocationHintTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\GeolocationHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/mdui/GeolocationHintTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/IPHintTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/mdui/IPHintTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/InformationURLTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdui/InformationURLTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/KeywordsTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/mdui/KeywordsTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\mdui\\Logo\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 3 + path: tests/SAML2/XML/mdui/LogoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/LogoTest.php + + - + message: '#^Call to method toInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/XML/mdui/LogoTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/mdui/LogoTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdui/LogoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/mdui/PrivacyStatementURLTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdui/PrivacyStatementURLTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/mdui/UIInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/mdui/UIInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 7 + path: tests/SAML2/XML/mdui/UIInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/mdui/UIInfoTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/XML/mdui/UIInfoTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 16 + path: tests/SAML2/XML/mdui/UIInfoTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/mdui/UIInfoTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/ActionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/ActionTest.php + + - + message: '#^Cannot call abstract static method SimpleSAML\\XML\\SerializableElementInterface\:\:fromXML\(\)\.$#' + identifier: staticMethod.callToAbstract + count: 2 + path: tests/SAML2/XML/saml/AdviceTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionIDRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AssertionIDRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AssertionIDRefTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\DomainValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 4 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 5 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 4 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 6 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 18 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 10 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 22 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 6 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 7 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 4 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionURIRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AssertionURIRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AssertionURIRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/saml/AttributeStatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AttributeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AttributeTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/saml/AttributeTest.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 1 + path: tests/SAML2/XML/saml/AttributeTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AttributeValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AudienceRestrictionTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/saml/AudienceRestrictionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AudienceTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AudienceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextClassRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextClassRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextDeclRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextDeclRefTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextDeclTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AuthnContextTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/saml/AuthzDecisionStatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/AuthzDecisionStatementTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/BaseIDTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/BaseIDTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/BaseIDTest.php + + - + message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/BaseIDTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/BaseIDTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/ConditionTest.php + + - + message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/ConditionTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/ConditionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/ConditionsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/ConditionsTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/ConditionsTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/saml/ConditionsTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\AnyURIValue\.$#' + identifier: class.notFound + count: 5 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 1 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedAttributeTest.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 1 + path: tests/SAML2/XML/saml/EncryptedAttributeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\AnyURIValue\.$#' + identifier: class.notFound + count: 10 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 3 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/EncryptedIDTest.php + + - + message: '#^Cannot call abstract static method SimpleSAML\\XML\\SerializableElementInterface\:\:fromXML\(\)\.$#' + identifier: staticMethod.callToAbstract + count: 2 + path: tests/SAML2/XML/saml/EvidenceTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/IssuerTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 12 + path: tests/SAML2/XML/saml/IssuerTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/NameIDTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/saml/NameIDTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/ProxyRestrictionTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/ProxyRestrictionTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/saml/ProxyRestrictionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/StatementTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/StatementTest.php + + - + message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/StatementTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/StatementTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 6 + path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectLocalityTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectLocalityTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 8 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 6 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 15 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + identifier: class.notFound + count: 9 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 5 + path: tests/SAML2/XML/samlp/AbstractMessageTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/AbstractMessageTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/samlp/AbstractMessageTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/samlp/AbstractMessageTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/samlp/AbstractMessageTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/ArtifactResolveTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/ArtifactResolveTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/ArtifactResolveTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/ArtifactResolveTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\Artifact does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/ArtifactResolveTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/samlp/ArtifactResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/samlp/ArtifactResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/ArtifactResponseTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/ArtifactResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/ArtifactResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/ArtifactResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/ArtifactTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\Artifact does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/ArtifactTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AssertionIDRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 10 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/samlp/AuthnQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/samlp/AuthnQueryTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnQueryTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/AuthnQueryTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 3 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 12 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromstring\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 8 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\RequesterID does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/GetCompleteTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/GetCompleteTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/samlp/IDPEntryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/IDPEntryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/IDPEntryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/IDPEntryTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/samlp/IDPListTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 7 + path: tests/SAML2/XML/samlp/IDPListTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/samlp/IDPListTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/IDPListTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 4 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 9 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 13 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 7 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Cannot call method getValue\(\) on string\.$#' + identifier: method.nonObject + count: 1 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 6 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/LogoutResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/LogoutResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/LogoutResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/LogoutResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/LogoutResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/NameIDPolicyTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/NameIDPolicyTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/NameIDPolicyTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 3 + path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php + + - + message: '#^Parameter \#1 \$requestedAuthnContexts of class SimpleSAML\\SAML2\\XML\\samlp\\RequestedAuthnContext constructor expects array\, array\ given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/RequesterIDTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\RequesterID does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/RequesterIDTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/samlp/ResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/ResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/ResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/ResponseTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/ResponseTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 6 + path: tests/SAML2/XML/samlp/ScopingTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/ScopingTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/ScopingTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/ScopingTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/ScopingTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\RequesterID does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/ScopingTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/SessionIndexTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/SessionIndexTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/StatusCodeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/samlp/StatusMessageTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 1 + path: tests/SAML2/XML/samlp/StatusMessageTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/samlp/StatusTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/samlp/StatusTest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/SAML2/XML/samlp/StatusTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php + + - + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedByteValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\shibmd\\Scope\:\:getContent\(\)\.$#' + identifier: method.notFound + count: 2 + path: tests/SAML2/XML/shibmd/ScopeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/XML/shibmd/ScopeTest.php + + - + message: '#^Call to method toBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/shibmd/ScopeTest.php + + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/shibmd/ScopeTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/authnrequest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/authnrequest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/bin/authnrequest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/authnrequest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/bin/encryptedattribute.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/encryptedid.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 9 + path: tests/bin/entityattributes.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/entityattributes.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 21 + path: tests/bin/entityattributes.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/entityattributes.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/bin/entityattributes.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/logoutrequest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/bin/logoutrequest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/logoutrequest.php + + - + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 2 + path: tests/bin/logoutrequest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/bin/signedresponse_with_signedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/signedresponse_with_signedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/signedresponse_with_signedassertion.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/signedresponse_with_signedassertion.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/signedresponse_with_signedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/bin/signedresponse_with_unsignedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/signedresponse_with_unsignedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/signedresponse_with_unsignedassertion.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/signedresponse_with_unsignedassertion.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/signedresponse_with_unsignedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/bin/unsignedresponse_with_signedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/unsignedresponse_with_signedassertion.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: tests/bin/unsignedresponse_with_signedassertion.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/unsignedresponse_with_signedassertion.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/bin/unsignedresponse_with_signedassertion.php diff --git a/src/Type/ListOfStringsValue.php b/src/Type/ListOfStringsValue.php index b3c6c919c6..47dfe9e6e1 100644 --- a/src/Type/ListOfStringsValue.php +++ b/src/Type/ListOfStringsValue.php @@ -48,7 +48,7 @@ protected function validateValue(string $value): void /** * Convert an array of xs:string items into a mdui:ListOfStrings * - * @param array<\SimpleSAML\SAML2\Type\SAMLStringValue> $keywords + * @param string[] $keywords * @return static */ public static function fromArray(array $keywords): static diff --git a/tests/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index 247b36b1b2..42028f19a0 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -46,7 +46,7 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor /** * CustomRoleDescriptor constructor. * - * @param \SimpleSAML\XML\Chunk[] $chunk + * @param \SimpleSAML\XML\SerializableElementInterface[] $chunk * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. @@ -101,7 +101,7 @@ public function __construct( /** * Get the value of the chunk-attribute. * - * @return \SimpleSAML\XML\Chunk[] + * @return \SimpleSAML\XML\SerializableElementInterface[] */ public function getChunk(): array { diff --git a/tests/SAML2/XML/md/RoleDescriptorTest.php b/tests/SAML2/XML/md/RoleDescriptorTest.php index c25836ad43..fede4323a9 100644 --- a/tests/SAML2/XML/md/RoleDescriptorTest.php +++ b/tests/SAML2/XML/md/RoleDescriptorTest.php @@ -267,7 +267,7 @@ public function testUnmarshallingUnregistered(): void $element = clone self::$xmlRepresentation->documentElement; $element->setAttributeNS(C::NS_XSI, 'xsi:type', 'ssp:UnknownRoleDescriptorType'); - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', 'ssp:UnknownRoleDescriptorType'); + $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptorType')); $type->toXML($element); $descriptor = AbstractRoleDescriptor::fromXML($element); diff --git a/tests/SAML2/XML/md/ServiceNameTest.php b/tests/SAML2/XML/md/ServiceNameTest.php index c4cb2fcced..f3172edca6 100644 --- a/tests/SAML2/XML/md/ServiceNameTest.php +++ b/tests/SAML2/XML/md/ServiceNameTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimplesAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceName}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\MissingAttributeException; diff --git a/tests/bin/authnrequest.php b/tests/bin/authnrequest.php index 8e936dc1df..a22a07fdd7 100644 --- a/tests/bin/authnrequest.php +++ b/tests/bin/authnrequest.php @@ -7,11 +7,13 @@ use DateTimeZone; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Compat\MockContainer; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\EncryptedID; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\saml\NameID; use SimpleSAML\SAML2\XML\saml\Subject; use SimpleSAML\SAML2\XML\samlp\AuthnRequest; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -25,18 +27,18 @@ PEMCertificatesMock::getPublicKey(PEMCertificatesMock::SELFSIGNED_PUBLIC_KEY), ); -$nid = new NameID('very secret'); +$nid = new NameID(SAMLStringValue::fromString('very secret')); $eid = new EncryptedID($nid->encrypt($encryptor)); -$issuer = new Issuer('https://gateway.example.org/saml20/sp/metadata'); +$issuer = new Issuer(SAMLStringValue::fromString('https://gateway.example.org/saml20/sp/metadata')); $subject = new Subject($eid); $authnRequest = new AuthnRequest( subject: $subject, - issueInstant: new DateTimeImmutable('now', new DateTimeZone('Z')), + issueInstant: SAMLDateTimeValue::fromDateTime(new DateTimeImmutable('now', new DateTimeZone('Z'))), issuer: $issuer, - id: '123', - destination: 'https://tiqr.example.org/idp/profile/saml2/Redirect/SSO', + id: IDValue::fromString('123'), + destination: SAMLAnyURIValue::fromString('https://tiqr.example.org/idp/profile/saml2/Redirect/SSO'), ); $authnRequest = $authnRequest->toXML(); diff --git a/tests/bin/encryptedattribute.php b/tests/bin/encryptedattribute.php index 05cbadc2a3..bedbfc537e 100644 --- a/tests/bin/encryptedattribute.php +++ b/tests/bin/encryptedattribute.php @@ -5,6 +5,7 @@ use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Compat\MockContainer; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\SAML2\XML\saml\EncryptedAttribute; @@ -21,8 +22,10 @@ PEMCertificatesMock::getPublicKey(PEMCertificatesMock::PUBLIC_KEY), ); $attribute = new Attribute( - name: 'urn:encrypted:attribute', - attributeValue: [new AttributeValue('very secret data')], + name: SAMLStringValue::fromString('urn:encrypted:attribute'), + attributeValue: [ + new AttributeValue(SAMLStringValue::fromString('very secret data')), + ], ); $encAttribute = new EncryptedAttribute($attribute->encrypt($encryptor)); diff --git a/tests/bin/encryptedid.php b/tests/bin/encryptedid.php index e4060f818e..e009b49e03 100644 --- a/tests/bin/encryptedid.php +++ b/tests/bin/encryptedid.php @@ -5,6 +5,7 @@ use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Compat\MockContainer; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\EncryptedID; use SimpleSAML\SAML2\XML\saml\NameID; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; @@ -19,7 +20,7 @@ C::KEY_TRANSPORT_OAEP, PEMCertificatesMock::getPublicKey(PEMCertificatesMock::SELFSIGNED_PUBLIC_KEY), ); -$nid = new NameID('very secret'); +$nid = new NameID(SAMLStringValue::fromString('very secret')); $eid = new EncryptedID($nid->encrypt($encryptor)); echo $eid->toXML()->ownerDocument->saveXML(); diff --git a/tests/bin/entityattributes.php b/tests/bin/entityattributes.php index 3ee164ca5d..6f098897ff 100644 --- a/tests/bin/entityattributes.php +++ b/tests/bin/entityattributes.php @@ -6,6 +6,7 @@ use DateTimeImmutable; use DateTimeZone; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Attribute; @@ -17,6 +18,7 @@ use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\saml\NameID; use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -28,45 +30,57 @@ ); $unsignedAssertion = new Assertion( - issuer: new Issuer('urn:x-simplesamlphp:issuer'), - issueInstant: new DateTimeImmutable('now', new DateTimeZone('Z')), - id: '_93af655219464fb403b34436cfb0c5cb1d9a5502', + issuer: new Issuer(SAMLStringValue::fromString('urn:x-simplesamlphp:issuer')), + issueInstant: SAMLDateTimeValue::fromDateTime(new DateTimeImmutable('now', new DateTimeZone('Z'))), + id: IDValue::fromString('_93af655219464fb403b34436cfb0c5cb1d9a5502'), subject: new Subject(new NameID( - value: 'some:entity', - Format: C::NAMEID_ENTITY, + value: SAMLStringValue::fromString('some:entity'), + Format: SAMLAnyURIValue::fromString(C::NAMEID_ENTITY), )), conditions: new Conditions( condition: [], audienceRestriction: [ new AudienceRestriction([ - new Audience('https://simplesamlphp.org/idp/metadata'), - new Audience('urn:x-simplesamlphp:phpunit:entity'), + new Audience(SAMLAnyURIValue::fromString('https://simplesamlphp.org/idp/metadata')), + new Audience(SAMLAnyURIValue::fromString('urn:x-simplesamlphp:phpunit:entity')), ]), ], ), statements: [new AttributeStatement([ new Attribute( - name: 'urn:mace:dir:attribute-def:uid', - nameFormat: C::NAMEFORMAT_URI, - attributeValue: [new AttributeValue('student2')], + name: SAMLStringValue::fromString('urn:mace:dir:attribute-def:uid'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + attributeValue: [ + new AttributeValue(SAMLStringValue::fromString('student2')), + ], ), new Attribute( - name: 'urn:mace:terena.org:attribute-def:schacHomeOrganization', - nameFormat: C::NAMEFORMAT_URI, - attributeValue: [new AttributeValue('university.example.org'), new AttributeValue('bbb.cc')], + name: SAMLStringValue::fromString('urn:mace:terena.org:attribute-def:schacHomeOrganization'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + attributeValue: [ + new AttributeValue(SAMLStringValue::fromString('university.example.org')), + new AttributeValue(SAMLStringValue::fromString('bbb.cc')), + ], ), new Attribute( - name: 'urn:schac:attribute-def:schacPersonalUniqueCode', - nameFormat: C::NAMEFORMAT_URI, + name: SAMLStringValue::fromString('urn:schac:attribute-def:schacPersonalUniqueCode'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), attributeValue: [ - new AttributeValue('urn:schac:personalUniqueCode:nl:local:uvt.nl:memberid:524020'), - new AttributeValue('urn:schac:personalUniqueCode:nl:local:surfnet.nl:studentid:12345'), + new AttributeValue( + SAMLStringValue::fromString('urn:schac:personalUniqueCode:nl:local:uvt.nl:memberid:524020'), + ), + new AttributeValue( + SAMLStringValue::fromString('urn:schac:personalUniqueCode:nl:local:surfnet.nl:studentid:12345'), + ), ], ), new Attribute( - name: 'urn:mace:dir:attribute-def:eduPersonAffiliation', - nameFormat: C::NAMEFORMAT_URI, - attributeValue: [new AttributeValue('member'), new AttributeValue('student')], + name: SAMLStringValue::fromString('urn:mace:dir:attribute-def:eduPersonAffiliation'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_URI), + attributeValue: [ + new AttributeValue(SAMLStringValue::fromString('member')), + new AttributeValue(SAMLStringValue::fromString('student')), + ], ), ])], ); @@ -74,15 +88,23 @@ $signedAssertion = Assertion::fromXML($unsignedAssertion->toXML()); $entityAttributes = new EntityAttributes([ new Attribute( - name: 'attrib1', - nameFormat: C::NAMEFORMAT_BASIC, - attributeValue: [new AttributeValue('is'), new AttributeValue('really'), new AttributeValue('cool')], + name: SAMLStringValue::fromString('attrib1'), + nameFormat: SAMLAnyURIValue::fromString(C::NAMEFORMAT_BASIC), + attributeValue: [ + new AttributeValue(SAMLStringValue::fromString('is')), + new AttributeValue(SAMLStringValue::fromString('really')), + new AttributeValue(SAMLStringValue::fromString('cool')), + ], ), $signedAssertion, new Attribute( - name: 'foo', - nameFormat: 'urn:simplesamlphp:v1:simplesamlphp', - attributeValue: [new AttributeValue('is'), new AttributeValue('really'), new AttributeValue('cool')], + name: SAMLStringValue::fromString('foo'), + nameFormat: SAMLAnyURIValue::fromString('urn:simplesamlphp:v1:simplesamlphp'), + attributeValue: [ + new AttributeValue(SAMLStringValue::fromString('is')), + new AttributeValue(SAMLStringValue::fromString('really')), + new AttributeValue(SAMLStringValue::fromString('cool')), + ], ), ]); diff --git a/tests/bin/logoutrequest.php b/tests/bin/logoutrequest.php index addb3c341f..303ea833a0 100644 --- a/tests/bin/logoutrequest.php +++ b/tests/bin/logoutrequest.php @@ -7,11 +7,13 @@ use DateTimeZone; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Compat\MockContainer; +use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\EncryptedID; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\saml\NameID; use SimpleSAML\SAML2\XML\samlp\LogoutRequest; use SimpleSAML\SAML2\XML\samlp\SessionIndex; +use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -24,14 +26,18 @@ C::KEY_TRANSPORT_OAEP, PEMCertificatesMock::getPublicKey(PEMCertificatesMock::SELFSIGNED_PUBLIC_KEY), ); -$nid = new NameID('very secret'); +$nid = new NameID(SAMLStringValue::fromString('very secret')); $eid = new EncryptedID($nid->encrypt($encryptor)); $logoutRequest = new LogoutRequest( + id: IDValue::fromString('abc123'), identifier: $eid, - issueInstant: new DateTimeImmutable('now', new DateTimeZone('Z')), - sessionIndexes: [new SessionIndex('SomeSessionIndex1'), new SessionIndex('SomeSessionIndex2')], - issuer: new Issuer('urn:test:TheIssuer'), + issueInstant: SAMLDateTimeValue::fromDateTime(new DateTimeImmutable('now', new DateTimeZone('Z'))), + sessionIndexes: [ + new SessionIndex(SAMLStringValue::fromString('SomeSessionIndex1')), + new SessionIndex(SAMLStringValue::fromString('SomeSessionIndex2')), + ], + issuer: new Issuer(SAMLStringValue::fromString('urn:test:TheIssuer')), ); $logoutRequest = $logoutRequest->toXML(); diff --git a/tests/bin/signedresponse_with_signedassertion.php b/tests/bin/signedresponse_with_signedassertion.php index 4fe8b0044b..8213fce171 100644 --- a/tests/bin/signedresponse_with_signedassertion.php +++ b/tests/bin/signedresponse_with_signedassertion.php @@ -3,6 +3,7 @@ require_once(dirname(__FILE__, 3) . '/vendor/autoload.php'); +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\Response; @@ -10,6 +11,7 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -24,13 +26,15 @@ $signedAssertion = Assertion::fromXML($unsignedAssertion->toXML()); $unsignedResponse = new Response( - status: new Status(new StatusCode(C::STATUS_SUCCESS)), - issuer: new Issuer('https://IdentityProvider.com'), - issueInstant: new DateTimeImmutable('now', new DateTimeZone('Z')), - id: 'abc123', - inResponseTo: 'PHPUnit', - destination: C::ENTITY_OTHER, - consent: C::ENTITY_SP, + status: new Status( + new StatusCode(SAMLAnyURIValue::fromString(C::STATUS_SUCCESS)), + ), + issuer: new Issuer(SAMLStringValue::fromString('https://IdentityProvider.com')), + issueInstant: SAMLDateTimeValue::fromDateTime(new DateTimeImmutable('now', new DateTimeZone('Z'))), + id: IDValue::fromString('abc123'), + inResponseTo: NCNameValue::fromString('PHPUnit'), + destination: SAMLAnyURIValue::fromString(C::ENTITY_OTHER), + consent: SAMLAnyURIValue::fromString(C::ENTITY_SP), assertions: [$signedAssertion], ); diff --git a/tests/bin/signedresponse_with_unsignedassertion.php b/tests/bin/signedresponse_with_unsignedassertion.php index 344247ee31..1ad35bc45b 100644 --- a/tests/bin/signedresponse_with_unsignedassertion.php +++ b/tests/bin/signedresponse_with_unsignedassertion.php @@ -3,6 +3,7 @@ require_once(dirname(__FILE__, 3) . '/vendor/autoload.php'); +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\Response; @@ -10,6 +11,7 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -17,13 +19,15 @@ $unsignedAssertion = Assertion::fromXML($document->documentElement); $unsignedResponse = new Response( - status: new Status(new StatusCode(C::STATUS_SUCCESS)), - issuer: new Issuer('https://IdentityProvider.com'), - issueInstant: new DateTimeImmutable('now', new DateTimeZone('Z')), - id: 'abc123', - inResponseTo: 'PHPUnit', - destination: C::ENTITY_OTHER, - consent: C::ENTITY_SP, + status: new Status( + new StatusCode(SAMLAnyURIValue::fromString(C::STATUS_SUCCESS)), + ), + issuer: new Issuer(SAMLStringValue::fromString('https://IdentityProvider.com')), + issueInstant: SAMLDateTimeValue::fromDateTime(new DateTimeImmutable('now', new DateTimeZone('Z'))), + id: IDValue::fromString('abc123'), + inResponseTo: NCNameValue::fromString('PHPUnit'), + destination: SAMLAnyURIValue::fromString(C::ENTITY_OTHER), + consent: SAMLAnyURIValue::fromString(C::ENTITY_SP), assertions: [$unsignedAssertion], ); diff --git a/tests/bin/unsignedresponse_with_signedassertion.php b/tests/bin/unsignedresponse_with_signedassertion.php index c1e4715591..bff82610b3 100644 --- a/tests/bin/unsignedresponse_with_signedassertion.php +++ b/tests/bin/unsignedresponse_with_signedassertion.php @@ -3,6 +3,7 @@ require_once(dirname(__FILE__, 3) . '/vendor/autoload.php'); +use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\Response; @@ -10,6 +11,7 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -26,13 +28,15 @@ $signedAssertion = Assertion::fromXML($unsignedAssertion->toXML()); $unsignedResponse = new Response( - issueInstant: new DateTimeImmutable('now', new DateTimeZone('Z')), - status: new Status(new StatusCode(C::STATUS_SUCCESS)), - issuer: new Issuer('https://IdentityProvider.com'), - id: 'abc123', - inResponseTo: 'PHPUnit', - destination: C::ENTITY_OTHER, - consent: C::ENTITY_SP, + issueInstant: SAMLDateTimeValue::fromDateTime(new DateTimeImmutable('now', new DateTimeZone('Z'))), + status: new Status( + new StatusCode(SAMLAnyURIValue::fromString(C::STATUS_SUCCESS)), + ), + issuer: new Issuer(SAMLStringValue::fromString('https://IdentityProvider.com')), + id: IDValue::fromString('abc123'), + inResponseTo: NCNameValue::fromString('PHPUnit'), + destination: SAMLAnyURIValue::fromString(C::ENTITY_OTHER), + consent: SAMLAnyURIValue::fromString(C::ENTITY_SP), assertions: [$signedAssertion], ); From 4733ff83322d83639d2e290b779c330c34eb668c Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 17 Jun 2025 18:31:17 +0200 Subject: [PATCH 08/34] Add DecisionType-type --- src/Type/DecisionTypeValue.php | 57 +++++++++++++++++ src/XML/Decision.php | 15 ----- src/XML/saml/AuthzDecisionStatement.php | 29 +++------ src/XML/saml/DecisionTypeEnum.php | 12 ++++ tests/SAML2/Type/DecisionTypeValueTest.php | 63 +++++++++++++++++++ .../XML/saml/AuthzDecisionStatementTest.php | 6 +- 6 files changed, 145 insertions(+), 37 deletions(-) create mode 100644 src/Type/DecisionTypeValue.php delete mode 100644 src/XML/Decision.php create mode 100644 src/XML/saml/DecisionTypeEnum.php create mode 100644 tests/SAML2/Type/DecisionTypeValueTest.php diff --git a/src/Type/DecisionTypeValue.php b/src/Type/DecisionTypeValue.php new file mode 100644 index 0000000000..2b96db5b6b --- /dev/null +++ b/src/Type/DecisionTypeValue.php @@ -0,0 +1,57 @@ +sanitizeValue($value), + array_column(DecisionTypeEnum::cases(), 'value'), + SchemaViolationException::class, + ); + } + + + /** + * @param \SimpleSAML\SAML2\XML\saml\DecisionTypeEnum $value + * @return static + */ + public static function fromEnum(DecisionTypeEnum $value): static + { + return new static($value->value); + } + + + /** + * @return \SimpleSAML\SAML2\XML\saml\DecisionTypeEnum $value + */ + public function toEnum(): DecisionTypeEnum + { + return DecisionTypeEnum::from($this->getValue()); + } +} diff --git a/src/XML/Decision.php b/src/XML/Decision.php deleted file mode 100644 index cc5716ba78..0000000000 --- a/src/XML/Decision.php +++ /dev/null @@ -1,15 +0,0 @@ -decision; } @@ -130,16 +127,10 @@ public static function fromXML(DOMElement $xml): static TooManyElementsException::class, ); - $decision = self::getAttribute($xml, 'Decision', SAMLStringValue::class); - try { - $decision = Decision::from($decision->getValue()); - } catch (ValueError) { - throw new ProtocolViolationException(sprintf('Unknown value \'%s\' for Decision attribute.', $decision)); - } return new static( self::getAttribute($xml, 'Resource', AnyURIValue::class), - $decision, + self::getAttribute($xml, 'Decision', DecisionTypeValue::class), $action, array_pop($evidence), ); @@ -156,8 +147,8 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttribute('Resource', $this->getResource()->getValue()); - $e->setAttribute('Decision', $this->getDecision()->value); + $e->setAttribute('Resource', strval($this->getResource())); + $e->setAttribute('Decision', strval($this->getDecision())); foreach ($this->getAction() as $action) { $action->toXML($e); diff --git a/src/XML/saml/DecisionTypeEnum.php b/src/XML/saml/DecisionTypeEnum.php new file mode 100644 index 0000000000..0784232b86 --- /dev/null +++ b/src/XML/saml/DecisionTypeEnum.php @@ -0,0 +1,12 @@ +assertTrue($shouldPass); + } catch (SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * Test helpers + */ + public function testHelpers(): void + { + $x = DecisionTypeValue::fromEnum(DecisionTypeEnum::Deny); + $this->assertEquals(DecisionTypeEnum::Deny, $x->toEnum()); + + $y = DecisionTypeValue::fromString('Deny'); + $this->assertEquals(DecisionTypeEnum::Deny, $y->toEnum()); + } + + + /** + * @return array + */ + public static function provideDecisionType(): array + { + return [ + 'deny' => ['Deny', true], + 'indeterminate' => ['Indeterminate', true], + 'permit' => ['Permit', true], + 'undefined' => ['undefined', false], + 'empty' => ['', false], + ]; + } +} diff --git a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php index d1f8483abc..64ef65fee7 100644 --- a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php +++ b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php @@ -7,13 +7,13 @@ use DOMDocument; use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\Decision; +use SimpleSAML\SAML2\Type\{DecisionTypeValue, SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{ AbstractSamlElement, AbstractStatement, Action, AuthzDecisionStatement, + DecisionTypeEnum, Evidence, }; use SimpleSAML\XML\DOMDocumentFactory; @@ -63,7 +63,7 @@ public function testMarshalling(): void { $authzDecisionStatement = new AuthzDecisionStatement( SAMLAnyURIValue::fromString('urn:x-simplesamlphp:resource'), - Decision::PERMIT, + DecisionTypeValue::fromEnum(DecisionTypeEnum::Permit), [ new Action( SAMLAnyURIValue::fromString('urn:x-simplesamlphp:namespace'), From 388c2f943708b02f77abe625947b92aaa433ca02 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 17 Jun 2025 20:04:55 +0200 Subject: [PATCH 09/34] Add AnyURIList-type --- src/Type/AnyURIListValue.php | 71 +++++++++++++++++++ src/XML/md/AbstractRoleDescriptor.php | 13 ++-- src/XML/md/AbstractRoleDescriptorType.php | 37 +++++----- src/XML/md/AbstractSSODescriptor.php | 7 +- src/XML/md/AttributeAuthorityDescriptor.php | 12 ++-- src/XML/md/AuthnAuthorityDescriptor.php | 12 ++-- src/XML/md/IDPSSODescriptor.php | 11 ++- src/XML/md/PDPDescriptor.php | 12 ++-- src/XML/md/SPSSODescriptor.php | 11 ++- src/XML/md/UnknownRoleDescriptor.php | 7 +- tests/SAML2/CustomRoleDescriptor.php | 11 ++- tests/SAML2/Type/AnyURIListValueTest.php | 59 +++++++++++++++ tests/SAML2/Type/ListOfStringsValueTest.php | 4 +- .../md/AttributeAuthorityDescriptorTest.php | 29 ++------ .../XML/md/AuthnAuthorityDescriptorTest.php | 12 ++-- tests/SAML2/XML/md/EntityDescriptorTest.php | 13 ++-- tests/SAML2/XML/md/IDPSSODescriptorTest.php | 17 +++-- tests/SAML2/XML/md/PDPDescriptorTest.php | 10 +-- tests/SAML2/XML/md/RoleDescriptorTest.php | 11 +-- tests/SAML2/XML/md/SPSSODescriptorTest.php | 15 ++-- 20 files changed, 244 insertions(+), 130 deletions(-) create mode 100644 src/Type/AnyURIListValue.php create mode 100644 tests/SAML2/Type/AnyURIListValueTest.php diff --git a/src/Type/AnyURIListValue.php b/src/Type/AnyURIListValue.php new file mode 100644 index 0000000000..70d7a90c49 --- /dev/null +++ b/src/Type/AnyURIListValue.php @@ -0,0 +1,71 @@ +sanitizeValue($value), C::UNBOUNDED_LIMIT); + + Assert::allValidAnyURI($uris, SchemaViolationException::class); + } + + + /** + * Convert an array of xs:anyURI items into a saml:AnyURIList + * + * @param string[] $uris + * @return static + */ + public static function fromArray(array $uris): static + { + $str = ''; + foreach ($uris as $uri) { + $str .= str_replace(' ', '+', $uri) . ' '; + } + + return new static(trim($str)); + } + + + /** + * Convert this saml:AnyURIList to an array of xs:anyURI items + * + * @return array<\SimpleSAML\SAML2\Type\SAMLAnyURIValue> + */ + public function toArray(): array + { + $uris = preg_split('/[\s]+/', $this->getValue(), C::UNBOUNDED_LIMIT); + $uris = str_replace('+', ' ', $uris); + + return array_map([SAMLAnyURIValue::class, 'fromString'], $uris); + } +} diff --git a/src/XML/md/AbstractRoleDescriptor.php b/src/XML/md/AbstractRoleDescriptor.php index 59c9b0f1c1..9f4b870a4d 100644 --- a/src/XML/md/AbstractRoleDescriptor.php +++ b/src/XML/md/AbstractRoleDescriptor.php @@ -7,13 +7,13 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue, StringValue}; +use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue}; use function array_pop; @@ -38,7 +38,8 @@ abstract class AbstractRoleDescriptor extends AbstractRoleDescriptorType impleme * Initialize a md:RoleDescriptor from scratch. * * @param \SimpleSAML\XML\Type\QNameValue $type - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. @@ -57,7 +58,7 @@ abstract class AbstractRoleDescriptor extends AbstractRoleDescriptorType impleme */ public function __construct( protected QNameValue $type, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, ?IDValue $ID = null, ?SAMLDateTimeValue $validUntil = null, ?DurationValue $cacheDuration = null, @@ -118,8 +119,6 @@ public static function fromXML(DOMElement $xml): static $handler = Utils::getContainer()->getExtensionHandler($type); if ($handler === null) { // we don't have a handler, proceed with unknown RoleDescriptor - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -139,7 +138,7 @@ public static function fromXML(DOMElement $xml): static return new UnknownRoleDescriptor( new Chunk($xml), $type, - preg_split('/[\s]+/', trim($protocols->getValue())), + self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class), self::getOptionalAttribute($xml, 'ID', IDValue::class, null), self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index 2dea9113fb..02a01db4a7 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -6,15 +6,14 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XML\XsNamespace as NS; -use function implode; +use function strval; /** * Class representing SAML2 RoleDescriptorType. @@ -33,7 +32,8 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument /** * Initialize a RoleDescriptor. * - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. @@ -51,7 +51,7 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( - protected array $protocolSupportEnumeration, + protected AnyURIListValue $protocolSupportEnumeration, ?IDValue $ID = null, ?SAMLDateTimeValue $validUntil = null, ?DurationValue $cacheDuration = null, @@ -62,13 +62,18 @@ public function __construct( protected array $contact = [], array $namespacedAttributes = [], ) { - Assert::maxCount($protocolSupportEnumeration, C::UNBOUNDED_LIMIT); - Assert::minCount( - $protocolSupportEnumeration, - 1, - 'At least one protocol must be supported by this ' . static::NS_PREFIX . ':' . static::getLocalName() . '.', + /** + * A whitespace-delimited set of URIs that identify the set of protocol specifications supported by the + * role element. For SAML V2.0 entities, this set MUST include the SAML protocol namespace URI, + * urn:oasis:names:tc:SAML:2.0:protocol. + */ + Assert::contains( + strval($protocolSupportEnumeration), + C::NS_SAMLP, + 'SAML v2.0 entities MUST include the SAML protocol namespace URI in their' + . ' protocolSupportEnumeration attribute', + ProtocolViolationException::class, ); - SAMLAssert::allValidURI($protocolSupportEnumeration, SchemaViolationException::class); Assert::maxCount($contact, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf( $contact, @@ -102,9 +107,9 @@ public function getErrorURL(): ?SAMLAnyURIValue /** * Collect the value of the protocolSupportEnumeration property. * - * @return string[] + * @return \SimpleSAML\SAML2\Type\AnyURIListValue */ - public function getProtocolSupportEnumeration(): array + public function getProtocolSupportEnumeration(): AnyURIListValue { return $this->protocolSupportEnumeration; } @@ -152,10 +157,10 @@ public function getKeyDescriptor(): array public function toUnsignedXML(?DOMElement $parent = null): DOMElement { $e = parent::toUnsignedXML($parent); - $e->setAttribute('protocolSupportEnumeration', implode(' ', $this->getProtocolSupportEnumeration())); + $e->setAttribute('protocolSupportEnumeration', strval($this->getProtocolSupportEnumeration())); if ($this->getErrorURL() !== null) { - $e->setAttribute('errorURL', $this->getErrorURL()->getValue()); + $e->setAttribute('errorURL', strval($this->getErrorURL())); } foreach ($this->getKeyDescriptor() as $kd) { diff --git a/src/XML/md/AbstractSSODescriptor.php b/src/XML/md/AbstractSSODescriptor.php index 44fe7ca6bd..6cad0eec0b 100644 --- a/src/XML/md/AbstractSSODescriptor.php +++ b/src/XML/md/AbstractSSODescriptor.php @@ -7,7 +7,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Type\{IDValue, DurationValue}; @@ -21,7 +21,8 @@ abstract class AbstractSSODescriptor extends AbstractRoleDescriptorType /** * Initialize a RoleDescriptor. * - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. @@ -46,7 +47,7 @@ abstract class AbstractSSODescriptor extends AbstractRoleDescriptorType * Defaults to an empty array. */ public function __construct( - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, ?IDValue $ID = null, ?SAMLDateTimeValue $validUntil = null, ?DurationValue $cacheDuration = null, diff --git a/src/XML/md/AttributeAuthorityDescriptor.php b/src/XML/md/AttributeAuthorityDescriptor.php index 3bca4ee036..e4d5f53bf7 100644 --- a/src/XML/md/AttributeAuthorityDescriptor.php +++ b/src/XML/md/AttributeAuthorityDescriptor.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; @@ -14,8 +14,6 @@ use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; -use function preg_split; - /** * Class representing SAML 2 metadata AttributeAuthorityDescriptor. * @@ -31,7 +29,7 @@ final class AttributeAuthorityDescriptor extends AbstractRoleDescriptorType impl * AttributeAuthorityDescriptor constructor. * * @param \SimpleSAML\SAML2\XML\md\AttributeService[] $attributeService - * @param string[] $protocolSupportEnumeration + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * @param \SimpleSAML\SAML2\XML\md\AssertionIDRequestService[] $assertionIDRequestService * @param \SimpleSAML\SAML2\XML\md\NameIDFormat[] $nameIDFormat * @param \SimpleSAML\SAML2\XML\md\AttributeProfile[] $attributeProfile @@ -48,7 +46,7 @@ final class AttributeAuthorityDescriptor extends AbstractRoleDescriptorType impl */ public function __construct( protected array $attributeService, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, protected array $assertionIDRequestService = [], protected array $nameIDFormat = [], protected array $attributeProfile = [], @@ -175,8 +173,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AttributeAuthorityDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AttributeAuthorityDescriptor::NS, InvalidDOMElementException::class); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); - $attrServices = AttributeService::getChildrenOfClass($xml); Assert::notEmpty( $attrServices, @@ -215,7 +211,7 @@ public static function fromXML(DOMElement $xml): static $authority = new static( $attrServices, - preg_split('/[\s]+/', $protocols->getValue()), + self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class), $assertIDReqServices, $nameIDFormats, $attrProfiles, diff --git a/src/XML/md/AuthnAuthorityDescriptor.php b/src/XML/md/AuthnAuthorityDescriptor.php index 5951a19c46..e7662a2656 100644 --- a/src/XML/md/AuthnAuthorityDescriptor.php +++ b/src/XML/md/AuthnAuthorityDescriptor.php @@ -6,15 +6,13 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; -use function preg_split; - /** * Class representing SAML 2 metadata AuthnAuthorityDescriptor. * @@ -29,7 +27,7 @@ final class AuthnAuthorityDescriptor extends AbstractRoleDescriptorType implemen * AuthnAuthorityDescriptor constructor. * * @param array $authnQueryService - * @param array $protocolSupportEnumeration + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * @param array $assertionIDRequestService * @param array $nameIDFormat * @param \SimpleSAML\XML\Type\IDValue|null $ID @@ -44,7 +42,7 @@ final class AuthnAuthorityDescriptor extends AbstractRoleDescriptorType implemen */ public function __construct( protected array $authnQueryService, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, protected array $assertionIDRequestService = [], protected array $nameIDFormat = [], ?IDValue $ID = null, @@ -139,8 +137,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'AuthnAuthorityDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AuthnAuthorityDescriptor::NS, InvalidDOMElementException::class); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $authnQueryServices = AuthnQueryService::getChildrenOfClass($xml); $assertionIDRequestServices = AssertionIDRequestService::getChildrenOfClass($xml); $nameIDFormats = NameIDFormat::getChildrenOfClass($xml); @@ -171,7 +167,7 @@ public static function fromXML(DOMElement $xml): static $authority = new static( $authnQueryServices, - preg_split('/[\s]+/', trim($protocols->getValue())), + self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class), $assertionIDRequestServices, $nameIDFormats, self::getOptionalAttribute($xml, 'ID', IDValue::class, null), diff --git a/src/XML/md/IDPSSODescriptor.php b/src/XML/md/IDPSSODescriptor.php index bb94364b87..3f17a7a622 100644 --- a/src/XML/md/IDPSSODescriptor.php +++ b/src/XML/md/IDPSSODescriptor.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; @@ -14,7 +14,6 @@ use SimpleSAML\XML\Type\{BooleanValue, DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; -use function preg_split; use function var_export; /** @@ -31,7 +30,7 @@ final class IDPSSODescriptor extends AbstractSSODescriptor implements SchemaVali * IDPSSODescriptor constructor. * * @param \SimpleSAML\SAML2\XML\md\SingleSignOnService[] $singleSignOnService - * @param string[] $protocolSupportEnumeration + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * @param \SimpleSAML\XML\Type\BooleanValue|null $wantAuthnRequestsSigned * @param \SimpleSAML\SAML2\XML\md\NameIDMappingService[] $nameIDMappingService * @param \SimpleSAML\SAML2\XML\md\AssertionIDRequestService[] $assertionIDRequestService @@ -52,7 +51,7 @@ final class IDPSSODescriptor extends AbstractSSODescriptor implements SchemaVali */ public function __construct( protected array $singleSignOnService, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, protected ?BooleanValue $wantAuthnRequestsSigned = null, protected array $nameIDMappingService = [], protected array $assertionIDRequestService = [], @@ -201,8 +200,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'IDPSSODescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, IDPSSODescriptor::NS, InvalidDOMElementException::class); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -229,7 +226,7 @@ public static function fromXML(DOMElement $xml): static $idpssod = new static( SingleSignOnService::getChildrenOfClass($xml), - preg_split('/[\s]+/', trim($protocols->getValue())), + self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class), self::getOptionalAttribute($xml, 'WantAuthnRequestsSigned', BooleanValue::class, null), NameIDMappingService::getChildrenOfClass($xml), AssertionIDRequestService::getChildrenOfClass($xml), diff --git a/src/XML/md/PDPDescriptor.php b/src/XML/md/PDPDescriptor.php index 80278d21a2..0698a95bee 100644 --- a/src/XML/md/PDPDescriptor.php +++ b/src/XML/md/PDPDescriptor.php @@ -6,15 +6,13 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; -use function preg_split; - /** * Class representing SAML 2 metadata PDPDescriptor. * @@ -29,7 +27,7 @@ final class PDPDescriptor extends AbstractRoleDescriptorType implements SchemaVa * PDPDescriptor constructor. * * @param \SimpleSAML\SAML2\XML\md\AuthzService[] $authzService - * @param string[] $protocolSupportEnumeration + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * @param \SimpleSAML\SAML2\XML\md\AssertionIDRequestService[] $assertionIDRequestService * @param \SimpleSAML\SAML2\XML\md\NameIDFormat[] $nameIDFormat * @param \SimpleSAML\XML\Type\IDValue|null $ID @@ -44,7 +42,7 @@ final class PDPDescriptor extends AbstractRoleDescriptorType implements SchemaVa */ public function __construct( protected array $authzService, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, protected array $assertionIDRequestService = [], protected array $nameIDFormat = [], ?IDValue $ID = null, @@ -139,8 +137,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'PDPDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, PDPDescriptor::NS, InvalidDOMElementException::class); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration'); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -162,7 +158,7 @@ public static function fromXML(DOMElement $xml): static $pdp = new static( AuthzService::getChildrenOfClass($xml), - preg_split('/[\s]+/', trim($protocols->getValue())), + self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class), AssertionIDRequestService::getChildrenOfClass($xml), NameIDFormat::getChildrenOfClass($xml), self::getOptionalAttribute($xml, 'ID', IDValue::class, null), diff --git a/src/XML/md/SPSSODescriptor.php b/src/XML/md/SPSSODescriptor.php index a494e1df44..5ac6e605f6 100644 --- a/src/XML/md/SPSSODescriptor.php +++ b/src/XML/md/SPSSODescriptor.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; @@ -14,7 +14,6 @@ use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_filter; -use function preg_split; use function var_export; /** @@ -31,7 +30,7 @@ final class SPSSODescriptor extends AbstractSSODescriptor implements SchemaValid * SPSSODescriptor constructor. * * @param array<\SimpleSAML\SAML2\XML\md\AssertionConsumerService> $assertionConsumerService - * @param string[] $protocolSupportEnumeration + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * @param \SimpleSAML\XML\Type\BooleanValue|null $authnRequestsSigned * @param \SimpleSAML\XML\Type\BooleanValue|null $wantAssertionsSigned * @param array<\SimpleSAML\SAML2\XML\md\AttributeConsumingService> $attributeConsumingService @@ -50,7 +49,7 @@ final class SPSSODescriptor extends AbstractSSODescriptor implements SchemaValid */ public function __construct( protected array $assertionConsumerService, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, protected ?BooleanValue $authnRequestsSigned = null, protected ?BooleanValue $wantAssertionsSigned = null, protected array $attributeConsumingService = [], @@ -175,8 +174,6 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'SPSSODescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, SPSSODescriptor::NS, InvalidDOMElementException::class); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -203,7 +200,7 @@ public static function fromXML(DOMElement $xml): static $spssod = new static( AssertionConsumerService::getChildrenOfClass($xml), - preg_split('/[\s]+/', trim($protocols->getValue())), + self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class), self::getOptionalAttribute($xml, 'AuthnRequestsSigned', BooleanValue::class, null), self::getOptionalAttribute($xml, 'WantAssertionsSigned', BooleanValue::class, null), AttributeConsumingService::getChildrenOfClass($xml), diff --git a/src/XML/md/UnknownRoleDescriptor.php b/src/XML/md/UnknownRoleDescriptor.php index 47518534da..4f6f8b6823 100644 --- a/src/XML/md/UnknownRoleDescriptor.php +++ b/src/XML/md/UnknownRoleDescriptor.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue}; @@ -21,7 +21,8 @@ final class UnknownRoleDescriptor extends AbstractRoleDescriptor * * @param \SimpleSAML\XML\Chunk $chunk The whole RoleDescriptor element as a chunk object. * @param \SimpleSAML\XML\Type\QNameValue $type - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. @@ -41,7 +42,7 @@ final class UnknownRoleDescriptor extends AbstractRoleDescriptor protected function __construct( protected Chunk $chunk, QNameValue $type, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, ?IDValue $ID = null, ?SAMLDateTimeValue $validUntil = null, ?DurationValue $cacheDuration = null, diff --git a/tests/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index 42028f19a0..63b779d8bb 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\md\{ AbstractRoleDescriptor, ContactPerson, @@ -47,7 +47,8 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor * CustomRoleDescriptor constructor. * * @param \SimpleSAML\XML\SerializableElementInterface[] $chunk - * @param string[] $protocolSupportEnumeration A set of URI specifying the protocols supported. + * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration + * A set of URI specifying the protocols supported. * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. @@ -66,7 +67,7 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor */ public function __construct( protected array $chunk, - array $protocolSupportEnumeration, + AnyURIListValue $protocolSupportEnumeration, ?IDValue $ID = null, ?SAMLDateTimeValue $validUntil = null, ?DurationValue $cacheDuration = null, @@ -132,8 +133,6 @@ public static function fromXML(DOMElement $xml): static $type = $xml->getAttributeNS(C::NS_XSI, 'type'); Assert::same($type, self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); - $protocols = self::getAttribute($xml, 'protocolSupportEnumeration', SAMLStringValue::class); - $orgs = Organization::getChildrenOfClass($xml); Assert::maxCount( $orgs, @@ -152,7 +151,7 @@ public static function fromXML(DOMElement $xml): static return new static( self::getChildElementsFromXML($xml), - preg_split('/[\s]+/', trim($protocols->getValue())), + self::getAttribute($xml, 'protocolSupportEnumeration', AnyURIListValue::class), self::getOptionalAttribute($xml, 'ID', IDValue::class, null), self::getOptionalAttribute($xml, 'validUntil', SAMLDateTimeValue::class, null), self::getOptionalAttribute($xml, 'cacheDuration', DurationValue::class, null), diff --git a/tests/SAML2/Type/AnyURIListValueTest.php b/tests/SAML2/Type/AnyURIListValueTest.php new file mode 100644 index 0000000000..d8ca6dbe09 --- /dev/null +++ b/tests/SAML2/Type/AnyURIListValueTest.php @@ -0,0 +1,59 @@ +assertTrue($shouldPass); + } catch (SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * Test the toArray function + */ + public function testToArray(): void + { + $anyURIList = AnyURIListValue::fromString("urn:x-simplesamlphp:namespace urn:x-ssp:ns"); + $this->assertEquals(['urn:x-simplesamlphp:namespace', 'urn:x-ssp:ns'], $anyURIList->toArray()); + } + + + /** + * @return array + */ + public static function provideAnyURIList(): array + { + return [ + 'single' => [true, "urn:x-simplesamlphp:namespace"], + 'multiple' => [true, 'urn:x-simplesamlphp:namespace urn:x-ssp:ns'], + 'normalization' => [true, "urn:x-simplesamlphp:namespace \n urn:x-ssp:ns"], + 'empty' => [true, ''], + ]; + } +} diff --git a/tests/SAML2/Type/ListOfStringsValueTest.php b/tests/SAML2/Type/ListOfStringsValueTest.php index 41122e8c6a..e4439bc4ae 100644 --- a/tests/SAML2/Type/ListOfStringsValueTest.php +++ b/tests/SAML2/Type/ListOfStringsValueTest.php @@ -12,7 +12,7 @@ /** * Class \SimpleSAML\Test\SAML2\Type\ListOfStringsTest * - * @package simplesamlphp/xml-common + * @package simplesamlphp/saml2 */ #[Group('type')] #[CoversClass(ListOfStringsValue::class)] @@ -23,7 +23,7 @@ final class ListOfStringsValueTest extends TestCase * @param string $listOfStrings */ #[DataProvider('provideListOfStrings')] - public function testNMtokens(bool $shouldPass, string $listOfStrings): void + public function testListOfStrings(bool $shouldPass, string $listOfStrings): void { try { ListOfStringsValue::fromString($listOfStrings); diff --git a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php index 9e54cc8241..55d20e9975 100644 --- a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php @@ -4,12 +4,10 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use Exception; use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\md\{ AbstractMdElement, AbstractMetadataDocument, @@ -109,7 +107,7 @@ public function testMarshalling(): void ); $aad = new AttributeAuthorityDescriptor( [self::$as], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), [self::$aidrs], [ new NameIDFormat( @@ -141,26 +139,13 @@ public function testMarshalling(): void } - /** - * Test that creating an AttributeAuthorityDescriptor with no supported protocols fails. - */ - public function testMarshallingWithoutSupportedProtocols(): void - { - $this->expectException(Exception::class); - $this->expectExceptionMessage( - 'At least one protocol must be supported by this md:AttributeAuthorityDescriptor.', - ); - new AttributeAuthorityDescriptor([self::$as], []); - } - - /** * Test that creating an AttributeAuthorityDescriptor with an empty supported protocol fails. */ public function testMarshallingWithEmptySupportedProtocols(): void { - $this->expectException(AssertionFailedException::class); - new AttributeAuthorityDescriptor([self::$as], []); + $this->expectException(ProtocolViolationException::class); + new AttributeAuthorityDescriptor([self::$as], AnyURIListValue::fromString('')); } @@ -171,7 +156,7 @@ public function testMarshallingWithoutAttributeServices(): void { $this->expectException(MissingElementException::class); $this->expectExceptionMessage('AttributeAuthorityDescriptor must contain at least one AttributeService.'); - new AttributeAuthorityDescriptor([], [C::NS_SAMLP]); + new AttributeAuthorityDescriptor([], AnyURIListValue::fromString(C::NS_SAMLP)); } @@ -180,7 +165,7 @@ public function testMarshallingWithoutAttributeServices(): void */ public function testMarshallingWithoutOptionalParameters(): void { - $aad = new AttributeAuthorityDescriptor([self::$as], [C::NS_SAMLP]); + $aad = new AttributeAuthorityDescriptor([self::$as], AnyURIListValue::fromString(C::NS_SAMLP)); $this->assertEmpty($aad->getAssertionIDRequestService()); $this->assertEmpty($aad->getNameIDFormat()); $this->assertEmpty($aad->getID()); @@ -199,7 +184,7 @@ public function testMarshallingWithoutOptionalParameters(): void */ public function testMarshallingWithEmptyAssertionIDRequestService(): void { - $aad = new AttributeAuthorityDescriptor([self::$as], [C::NS_SAMLP], []); + $aad = new AttributeAuthorityDescriptor([self::$as], AnyURIListValue::fromString(C::NS_SAMLP), []); $this->assertEmpty($aad->getAssertionIDRequestService()); $this->assertEmpty($aad->getNameIDFormat()); $this->assertEmpty($aad->getID()); diff --git a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php index 738a4e5226..ee4bc329d0 100644 --- a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php @@ -10,7 +10,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue}; use SimpleSAML\SAML2\XML\md\{ AbstractMdElement, AbstractMetadataDocument, @@ -87,7 +87,7 @@ public function testMarshalling(): void { $aad = new AuthnAuthorityDescriptor( [self::$aqs], - [C::NS_SAMLP, C::PROTOCOL], + AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), [self::$aidrs], [ new NameIDFormat( @@ -116,7 +116,7 @@ public function testMarshallingWithoutAuthnQueryServices(): void $this->expectExceptionMessage('Missing at least one AuthnQueryService in AuthnAuthorityDescriptor.'); new AuthnAuthorityDescriptor( [], - [C::NS_SAMLP, C::PROTOCOL], + AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), [self::$aidrs], [ new NameIDFormat( @@ -138,7 +138,7 @@ public function testMarshallingWithoutOptionalElements(): void { new AuthnAuthorityDescriptor( [self::$aqs], - [C::NS_SAMLP, C::PROTOCOL], + AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), ); } @@ -152,7 +152,7 @@ public function testMarshallingWithWrongAuthnQueryService(): void $this->expectExceptionMessage('AuthnQueryService must be an instance of EndpointType'); new AuthnAuthorityDescriptor( [self::$aqs, ''], - [C::NS_SAMLP, C::PROTOCOL], + AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), [self::$aidrs], [ new NameIDFormat( @@ -175,7 +175,7 @@ public function testMarshallingWithWrongAssertionIDRequestService(): void $this->expectExceptionMessage('AssertionIDRequestServices must be an instance of EndpointType'); new AuthnAuthorityDescriptor( [self::$aqs], - [C::NS_SAMLP, C::PROTOCOL], + AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), [self::$aidrs, ''], [ new NameIDFormat( diff --git a/tests/SAML2/XML/md/EntityDescriptorTest.php b/tests/SAML2/XML/md/EntityDescriptorTest.php index 43e05b8493..4f688306dd 100644 --- a/tests/SAML2/XML/md/EntityDescriptorTest.php +++ b/tests/SAML2/XML/md/EntityDescriptorTest.php @@ -9,10 +9,11 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\{ - SAMLAnyURIValue, - SAMLDateTimeValue, + AnyURIListValue, EmailAddressValue, EntityIDValue, + SAMLAnyURIValue, + SAMLDateTimeValue, SAMLStringValue, }; use SimpleSAML\SAML2\XML\md\{ @@ -101,7 +102,7 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('https://engine.test.example.edu/authentication/idp/single-sign-on'), ), ], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), ); $attrad = new AttributeAuthorityDescriptor( [ @@ -110,7 +111,7 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('https://idp.example.org/AttributeService'), ), ], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), ); $authnad = new AuthnAuthorityDescriptor( [ @@ -119,7 +120,7 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('http://www.example.com/aqs'), ), ], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), ); $pdpd = new PDPDescriptor( [ @@ -128,7 +129,7 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/AA/SOAP'), ), ], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), ); $org = new Organization( [ diff --git a/tests/SAML2/XML/md/IDPSSODescriptorTest.php b/tests/SAML2/XML/md/IDPSSODescriptorTest.php index e5d7a6ee05..690667ad94 100644 --- a/tests/SAML2/XML/md/IDPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/IDPSSODescriptorTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, KeyTypesValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, KeyTypesValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\md\{ AbstractMdElement, AbstractMetadataDocument, @@ -89,7 +89,7 @@ public function testMarshalling(): void SAMLAnyURIValue::fromString('https://IdentityProvider.com/SAML/SSO/Browser'), ), ], - protocolSupportEnumeration: [C::NS_SAMLP], + protocolSupportEnumeration: AnyURIListValue::fromString(C::NS_SAMLP), wantAuthnRequestsSigned: BooleanValue::fromBoolean(true), nameIDMappingService: [ new NameIDMappingService( @@ -200,7 +200,7 @@ public function testMarshallingWithEmptySingleSignOnService(): void { $this->expectException(AssertionFailedException::class); $this->expectExceptionMessage('At least one SingleSignOnService must be specified.'); - new IDPSSODescriptor([], [C::NS_SAMLP]); + new IDPSSODescriptor([], AnyURIListValue::fromString(C::NS_SAMLP)); } @@ -209,8 +209,11 @@ public function testMarshallingWithEmptySingleSignOnService(): void */ public function testMarshallingWithoutProtocolSupportThrowsException(): void { - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('At least one protocol must be supported by this md:IDPSSODescriptor.'); + $this->expectException(ProtocolViolationException::class); + $this->expectExceptionMessage( + 'SAML v2.0 entities MUST include the SAML protocol namespace URI ' + . 'in their protocolSupportEnumeration attribute', + ); new IDPSSODescriptor( [ @@ -219,7 +222,7 @@ public function testMarshallingWithoutProtocolSupportThrowsException(): void SAMLAnyURIValue::fromString(C::LOCATION_A), ), ], - [], + AnyURIListValue::fromString(''), ); } @@ -240,7 +243,7 @@ public function testMarshallingWithoutOptionalArguments(): void SAMLAnyURIValue::fromString(C::LOCATION_B), ), ], - [C::NS_SAMLP, C::PROTOCOL], + AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), ); $this->assertNull($idpssod->wantAuthnRequestsSigned()); $this->assertEquals([], $idpssod->getNameIDMappingService()); diff --git a/tests/SAML2/XML/md/PDPDescriptorTest.php b/tests/SAML2/XML/md/PDPDescriptorTest.php index 6dad7ae230..a1459eee81 100644 --- a/tests/SAML2/XML/md/PDPDescriptorTest.php +++ b/tests/SAML2/XML/md/PDPDescriptorTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue}; use SimpleSAML\SAML2\XML\md\{ AbstractMdElement, AbstractMetadataDocument, @@ -86,7 +86,7 @@ public function testMarshalling(): void { $pdpd = new PDPDescriptor( [self::$authzService], - ["urn:oasis:names:tc:SAML:2.0:protocol"], + AnyURIListValue::fromString(C::NS_SAMLP), [self::$assertionIDRequestService], [ new NameIDFormat( @@ -120,7 +120,7 @@ public function testMarshallingWithWrongAuthzService(): void new PDPDescriptor( /** @phpstan-ignore argument.type */ [self::$authzService, self::$assertionIDRequestService], - ["urn:oasis:names:tc:SAML:2.0:protocol"], + AnyURIListValue::fromString(C::NS_SAMLP), ); } @@ -137,7 +137,7 @@ public function testMarshallingWithWrongAssertionIDRequestService(): void new PDPDescriptor( [self::$authzService], - ["urn:oasis:names:tc:SAML:2.0:protocol"], + AnyURIListValue::fromString(C::NS_SAMLP), /** @phpstan-ignore argument.type */ [self::$assertionIDRequestService, self::$authzService], ); @@ -151,7 +151,7 @@ public function testMarshallingWithoutOptionalArguments(): void { $pdpd = new PDPDescriptor( [self::$authzService], - ["urn:oasis:names:tc:SAML:2.0:protocol"], + AnyURIListValue::fromString(C::NS_SAMLP), ); $this->assertEmpty($pdpd->getAssertionIDRequestService()); $this->assertEmpty($pdpd->getNameIDFormat()); diff --git a/tests/SAML2/XML/md/RoleDescriptorTest.php b/tests/SAML2/XML/md/RoleDescriptorTest.php index fede4323a9..bcd62f62c0 100644 --- a/tests/SAML2/XML/md/RoleDescriptorTest.php +++ b/tests/SAML2/XML/md/RoleDescriptorTest.php @@ -9,10 +9,11 @@ use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\{ - SAMLAnyURIValue, - SAMLDateTimeValue, + AnyURIListValue, EmailAddressValue, KeyTypesValue, + SAMLAnyURIValue, + SAMLDateTimeValue, SAMLStringValue, }; use SimpleSAML\SAML2\XML\md\{ @@ -116,7 +117,7 @@ public function testMarshalling(): void 'Some', )->documentElement), ], - [C::NS_SAMLP, C::PROTOCOL], + AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), IDValue::fromString('TheID'), SAMLDateTimeValue::fromString('2009-02-13T23:31:30Z'), DurationValue::fromString('PT5000S'), @@ -233,7 +234,7 @@ public function testUnmarshalling(): void $this->assertInstanceOf(KeyDescriptor::class, $descriptor->getKeyDescriptor()[1]); $this->assertEquals( [C::NS_SAMLP, C::PROTOCOL], - $descriptor->getProtocolSupportEnumeration(), + $descriptor->getProtocolSupportEnumeration()->toArray(), ); $this->assertInstanceOf(Organization::class, $descriptor->getOrganization()); $this->assertCount(2, $descriptor->getContactPerson()); @@ -278,7 +279,7 @@ public function testUnmarshallingUnregistered(): void $this->assertInstanceOf(KeyDescriptor::class, $descriptor->getKeyDescriptor()[1]); $this->assertEquals( [C::NS_SAMLP, C::PROTOCOL], - $descriptor->getProtocolSupportEnumeration(), + $descriptor->getProtocolSupportEnumeration()->toArray(), ); $this->assertInstanceOf(Organization::class, $descriptor->getOrganization()); $this->assertCount(2, $descriptor->getContactPerson()); diff --git a/tests/SAML2/XML/md/SPSSODescriptorTest.php b/tests/SAML2/XML/md/SPSSODescriptorTest.php index 2531eb9cf5..4bdf064474 100644 --- a/tests/SAML2/XML/md/SPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/SPSSODescriptorTest.php @@ -7,7 +7,14 @@ use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EmailAddressValue, KeyTypesValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{ + AnyURIListValue, + SAMLAnyURIValue, + SAMLDateTimeValue, + EmailAddressValue, + KeyTypesValue, + SAMLStringValue, +}; use SimpleSAML\SAML2\XML\md\{ AbstractMdElement, AbstractMetadataDocument, @@ -196,7 +203,7 @@ public function testMarshalling(): void $spssod = new SPSSODescriptor( [$acs1, $acs2], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), BooleanValue::fromBoolean(true), BooleanValue::fromBoolean(false), [$attrcs1, $attrcs2], @@ -235,7 +242,7 @@ public function testMarshallingWithoutAssertionConsumerService(): void new SPSSODescriptor( [], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), ); } @@ -253,7 +260,7 @@ public function testMarshallingWithoutOptionalArguments(): void SAMLAnyURIValue::fromString(C::LOCATION_A), ), ], - [C::NS_SAMLP], + AnyURIListValue::fromString(C::NS_SAMLP), ); $this->assertNull($spssod->getAuthnRequestsSigned()); From 852d825b7a36a7d65ae934c07a3689a41eb16ca0 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 17 Jun 2025 20:46:30 +0200 Subject: [PATCH 10/34] Add AuthnContextDecision-type --- src/Type/AuthnContextComparisonTypeValue.php | 57 +++++++++++++++++ .../AuthnContextComparisonTypeEnum.php} | 12 ++-- src/XML/samlp/RequestedAuthnContext.php | 23 +++---- .../AuthnContextComparisonTypeValueTest.php | 64 +++++++++++++++++++ tests/SAML2/XML/samlp/AuthnQueryTest.php | 9 ++- tests/SAML2/XML/samlp/AuthnRequestTest.php | 12 +++- .../XML/samlp/RequestedAuthnContextTest.php | 11 ++-- 7 files changed, 155 insertions(+), 33 deletions(-) create mode 100644 src/Type/AuthnContextComparisonTypeValue.php rename src/XML/{Comparison.php => samlp/AuthnContextComparisonTypeEnum.php} (85%) create mode 100644 tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php diff --git a/src/Type/AuthnContextComparisonTypeValue.php b/src/Type/AuthnContextComparisonTypeValue.php new file mode 100644 index 0000000000..55bc91df50 --- /dev/null +++ b/src/Type/AuthnContextComparisonTypeValue.php @@ -0,0 +1,57 @@ +sanitizeValue($value), + array_column(AuthnContextComparisonTypeEnum::cases(), 'value'), + SchemaViolationException::class, + ); + } + + + /** + * @param \SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum $value + * @return static + */ + public static function fromEnum(AuthnContextComparisonTypeEnum $value): static + { + return new static($value->value); + } + + + /** + * @return \SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum $value + */ + public function toEnum(): AuthnContextComparisonTypeEnum + { + return AuthnContextComparisonTypeEnum::from($this->getValue()); + } +} diff --git a/src/XML/Comparison.php b/src/XML/samlp/AuthnContextComparisonTypeEnum.php similarity index 85% rename from src/XML/Comparison.php rename to src/XML/samlp/AuthnContextComparisonTypeEnum.php index d27176ad18..f44b9eaeba 100644 --- a/src/XML/Comparison.php +++ b/src/XML/samlp/AuthnContextComparisonTypeEnum.php @@ -2,34 +2,34 @@ declare(strict_types=1); -namespace SimpleSAML\SAML2\XML; +namespace SimpleSAML\SAML2\XML\samlp; -enum Comparison: string +enum AuthnContextComparisonTypeEnum: string { /** * Request Authentication Context Comparison indicating that the resulting authentication context in the * authentication statement MUST be stronger (as deemed by the responder) than any one of the authentication * contexts specified */ - case BETTER = 'better'; + case Better = 'better'; /** * Request Authentication Context Comparison indicating that the resulting authentication context in the * authentication statement MUST be the exact match of at least one of the authentication contexts specified */ - case EXACT = 'exact'; + case Exact = 'exact'; /** * Request Authentication Context Comparison indicating that the resulting authentication context in the * authentication statement MUST be as strong as possible (as deemed by the responder) without exceeding the * strength of at least one of the authentication contexts specified. */ - case MAXIMUM = 'maximum'; + case Maxmimum = 'maximum'; /** * Request Authentication Context Comparison indicating that he resulting authentication context in the * authentication statement MUST be at least as strong (as deemed by the responder) as one of the authentication * contexts specified. */ - case MINIMUM = 'minimum'; + case Minimum = 'minimum'; } diff --git a/src/XML/samlp/RequestedAuthnContext.php b/src/XML/samlp/RequestedAuthnContext.php index 576e490cc9..25b842b0d3 100644 --- a/src/XML/samlp/RequestedAuthnContext.php +++ b/src/XML/samlp/RequestedAuthnContext.php @@ -7,14 +7,14 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\Comparison; +use SimpleSAML\SAML2\Type\{AuthnContextComparisonTypeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_merge; +use function strval; /** * Class representing SAML2 RequestedAuthnContext @@ -33,11 +33,11 @@ final class RequestedAuthnContext extends AbstractSamlpElement implements Schema * \SimpleSAML\SAML2\XML\saml\AuthnContextClassRef| * \SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef * )[] $requestedAuthnContexts - * @param \SimpleSAML\SAML2\XML\Comparison $Comparison + * @param \SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue $Comparison */ public function __construct( protected array $requestedAuthnContexts = [], - protected ?Comparison $Comparison = null, + protected ?AuthnContextComparisonTypeValue $Comparison = null, ) { Assert::maxCount($requestedAuthnContexts, C::UNBOUNDED_LIMIT); Assert::minCount($requestedAuthnContexts, 1, SchemaViolationException::class); @@ -79,9 +79,9 @@ public function getRequestedAuthnContexts(): array /** * Collect the value of the Comparison-property * - * @return \SimpleSAML\SAML2\XML\Comparison|null + * @return \SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue|null */ - public function getComparison(): ?Comparison + public function getComparison(): ?AuthnContextComparisonTypeValue { return $this->Comparison; } @@ -101,19 +101,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'RequestedAuthnContext', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, RequestedAuthnContext::NS, InvalidDOMElementException::class); - $Comparison = self::getOptionalAttribute( - $xml, - 'Comparison', - SAMLStringValue::class, - SAMLStringValue::fromString('unknown'), - ); - return new static( array_merge( AuthnContextClassRef::getChildrenOfClass($xml), AuthnContextDeclRef::getChildrenOfClass($xml), ), - Comparison::tryFrom($Comparison->getValue()), + self::getOptionalAttribute($xml, 'Comparison', AuthnContextComparisonTypeValue::class, null), ); } @@ -133,7 +126,7 @@ public function toXML(?DOMElement $parent = null): DOMElement } if ($this->getComparison() !== null) { - $e->setAttribute('Comparison', $this->getComparison()->value); + $e->setAttribute('Comparison', strval($this->getComparison())); } return $e; diff --git a/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php b/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php new file mode 100644 index 0000000000..2c09ab076e --- /dev/null +++ b/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php @@ -0,0 +1,64 @@ +assertTrue($shouldPass); + } catch (SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * Test helpers + */ + public function testHelpers(): void + { + $x = AuthnContextComparisonValue::fromEnum(AuthnContextComparisonEnum::Exact); + $this->assertEquals(AuthnContextComparisonEnum::Exact, $x->toEnum()); + + $y = AuthnContextComparisonValue::fromString('exact'); + $this->assertEquals(AuthnContextComparisonEnum::Exact, $y->toEnum()); + } + + + /** + * @return array + */ + public static function provideAuthnContextComparison(): array + { + return [ + 'better' => ['better', true], + 'exact' => ['exact', true], + 'maximum' => ['maximum', true], + 'minimum' => ['minimum', true], + 'undefined' => ['undefined', false], + 'empty' => ['', false], + ]; + } +} diff --git a/tests/SAML2/XML/samlp/AuthnQueryTest.php b/tests/SAML2/XML/samlp/AuthnQueryTest.php index 9ec7e10f4a..5d8c19d0af 100644 --- a/tests/SAML2/XML/samlp/AuthnQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthnQueryTest.php @@ -7,14 +7,14 @@ use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\Comparison; +use SimpleSAML\SAML2\Type\{AuthnContextComparisonTypeValue, SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{AuthnContextDeclRef, Issuer, NameID, Subject}; use SimpleSAML\SAML2\XML\samlp\{ AbstractMessage, AbstractRequest, AbstractSamlpElement, AbstractSubjectQuery, + AuthnContextComparisonTypeEnum, AuthnQuery, RequestedAuthnContext, }; @@ -67,7 +67,10 @@ public function testMarshalling(): void $authnContextDeclRef = new AuthnContextDeclRef( SAMLAnyURIValue::fromString('https://example.org/relative/path/to/document.xml'), ); - $requestedAuthnContext = new RequestedAuthnContext([$authnContextDeclRef], Comparison::EXACT); + $requestedAuthnContext = new RequestedAuthnContext( + [$authnContextDeclRef], + AuthnContextComparisonTypeValue::fromEnum(AuthnContextComparisonTypeEnum::Exact), + ); $authnQuery = new AuthnQuery( id: IDValue::fromString('aaf23196-1773-2113-474a-fe114412ab72'), diff --git a/tests/SAML2/XML/samlp/AuthnRequestTest.php b/tests/SAML2/XML/samlp/AuthnRequestTest.php index e96477b514..1a644941d8 100644 --- a/tests/SAML2/XML/samlp/AuthnRequestTest.php +++ b/tests/SAML2/XML/samlp/AuthnRequestTest.php @@ -9,10 +9,15 @@ use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\{ + AuthnContextComparisonTypeValue, + SAMLAnyURIValue, + SAMLDateTimeValue, + EntityIDValue, + SAMLStringValue, +}; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\Comparison; use SimpleSAML\SAML2\XML\saml\{ Audience, AudienceRestriction, @@ -28,6 +33,7 @@ use SimpleSAML\SAML2\XML\samlp\{ AbstractMessage, AbstractSamlpElement, + AuthnContextComparisonTypeEnum, AuthnRequest, GetComplete, IDPEntry, @@ -123,7 +129,7 @@ public function testMarshallingElementOrdering(): void SAMLAnyURIValue::fromString('urn:test:accr2'), ), ], - Comparison::BETTER, + AuthnContextComparisonTypeValue::fromEnum(AuthnContextComparisonTypeEnum::Better), ); // Create Subject diff --git a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php index caeb0e61b2..6e00b04012 100644 --- a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php +++ b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php @@ -8,10 +8,9 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\Comparison; +use SimpleSAML\SAML2\Type\{AuthnContextComparisonTypeValue, SAMLAnyURIValue}; use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, RequestedAuthnContext}; +use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, AuthnContextComparisonTypeEnum, RequestedAuthnContext}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; @@ -55,7 +54,7 @@ public function testMarshalling(): void $requestedAuthnContext = new RequestedAuthnContext( [$authnContextDeclRef], - Comparison::EXACT, + AuthnContextComparisonTypeValue::fromEnum(AuthnContextComparisonTypeEnum::Exact), ); $this->assertEquals( @@ -81,7 +80,7 @@ public function testMarshallingWithMixedContextsFails(): void new RequestedAuthnContext( [$authnContextClassRef, $authnContextDeclRef], - Comparison::EXACT, + AuthnContextComparisonTypeValue::fromEnum(AuthnContextComparisonTypeEnum::Exact), ); } @@ -105,7 +104,7 @@ public function testMarshallingWithInvalidContentFails(): void DOMDocumentFactory::fromString(''), $authnContextDeclRef, ], - Comparison::EXACT, + AuthnContextComparisonTypeValue::fromEnum(AuthnContextComparisonTypeEnum::Exact), ); } From c2cecefca6dc0bd3538e05f0ef271c0431246c66 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 27 Aug 2025 23:05:12 +0200 Subject: [PATCH 11/34] WIP: Migrate to xsd-types --- phpstan-baseline.neon | 7 +--- src/Assert/SAMLStringTrait.php | 2 +- src/Binding/SOAP.php | 8 ++--- src/Compat/AbstractContainer.php | 6 ++-- src/SOAPClient.php | 8 ++--- src/Type/AnyURIListValue.php | 6 ++-- src/Type/AuthnContextComparisonTypeValue.php | 4 +-- src/Type/DecisionTypeValue.php | 4 +-- src/Type/KeyTypesValue.php | 2 +- src/Type/ListOfStringsValue.php | 6 ++-- src/Type/SAMLAnyURIValue.php | 2 +- src/Type/SAMLDateTimeValue.php | 2 +- src/Type/SAMLStringValue.php | 2 +- src/XML/EncryptedElementTrait.php | 7 ++-- src/XML/ExtensionPointInterface.php | 10 +++--- src/XML/ExtensionPointTrait.php | 8 ++--- src/XML/IdentifierTrait.php | 4 +-- src/XML/SignableElementTrait.php | 2 +- src/XML/alg/DigestMethod.php | 10 +++--- src/XML/alg/SigningMethod.php | 20 +++++------ src/XML/ecp/RelayState.php | 26 ++++++-------- src/XML/ecp/Request.php | 32 ++++++++--------- src/XML/ecp/RequestAuthenticated.php | 34 ++++++++---------- src/XML/ecp/Response.php | 26 ++++++-------- src/XML/ecp/SubjectConfirmation.php | 25 ++++++------- src/XML/emd/RepublishRequest.php | 6 ++-- src/XML/idpdisc/DiscoveryResponse.php | 6 ++-- src/XML/init/RequestInitiator.php | 4 +-- src/XML/md/AbstractEndpointType.php | 12 +++---- src/XML/md/AbstractIndexedEndpointType.php | 12 +++---- src/XML/md/AbstractLocalizedName.php | 10 +++--- src/XML/md/AbstractLocalizedURI.php | 8 ++--- src/XML/md/AbstractMetadataDocument.php | 10 +++--- src/XML/md/AbstractRoleDescriptor.php | 19 +++++----- src/XML/md/AbstractRoleDescriptorType.php | 10 +++--- src/XML/md/AbstractSSODescriptor.php | 6 ++-- src/XML/md/AdditionalMetadataLocation.php | 6 ++-- src/XML/md/AffiliationDescriptor.php | 18 +++++----- src/XML/md/ArtifactResolutionService.php | 6 ++-- src/XML/md/AttributeAuthorityDescriptor.php | 16 ++++----- src/XML/md/AttributeConsumingService.php | 12 +++---- src/XML/md/AuthnAuthorityDescriptor.php | 14 ++++---- src/XML/md/ContactPerson.php | 12 +++---- src/XML/md/EntitiesDescriptor.php | 12 +++---- src/XML/md/EntityDescriptor.php | 18 +++++----- src/XML/md/Extensions.php | 4 +-- src/XML/md/IDPSSODescriptor.php | 18 +++++----- src/XML/md/IndexedElementTrait.php | 14 ++++---- src/XML/md/KeyDescriptor.php | 8 ++--- src/XML/md/Organization.php | 10 +++--- src/XML/md/PDPDescriptor.php | 14 ++++---- src/XML/md/RequestedAttribute.php | 12 +++---- src/XML/md/SPSSODescriptor.php | 22 ++++++------ src/XML/md/UnknownRoleDescriptor.php | 8 ++--- src/XML/mdattr/EntityAttributes.php | 4 +-- src/XML/mdrpi/Publication.php | 6 ++-- src/XML/mdrpi/PublicationInfo.php | 6 ++-- src/XML/mdrpi/PublicationPath.php | 6 ++-- src/XML/mdrpi/RegistrationInfo.php | 6 ++-- src/XML/mdui/DiscoHints.php | 8 ++--- src/XML/mdui/Keywords.php | 12 +++---- src/XML/mdui/Logo.php | 20 +++++------ src/XML/mdui/UIInfo.php | 8 ++--- src/XML/saml/AbstractBaseID.php | 17 ++++----- src/XML/saml/AbstractCondition.php | 17 ++++----- src/XML/saml/AbstractStatement.php | 17 ++++----- src/XML/saml/Action.php | 6 ++-- src/XML/saml/Advice.php | 8 ++--- src/XML/saml/Assertion.php | 18 +++++----- src/XML/saml/AssertionIDRef.php | 2 +- src/XML/saml/Attribute.php | 10 +++--- src/XML/saml/AttributeStatement.php | 4 +-- src/XML/saml/AttributeValue.php | 35 ++++++++++--------- src/XML/saml/AudienceRestriction.php | 4 +-- src/XML/saml/AuthnContext.php | 4 +-- src/XML/saml/AuthnContextDecl.php | 10 +++--- src/XML/saml/AuthnStatement.php | 6 ++-- src/XML/saml/AuthzDecisionStatement.php | 16 ++++----- src/XML/saml/Conditions.php | 4 +-- src/XML/saml/Evidence.php | 4 +-- src/XML/saml/NameIDType.php | 4 +-- src/XML/saml/OneTimeUse.php | 4 +-- src/XML/saml/ProxyRestriction.php | 10 +++--- src/XML/saml/Subject.php | 4 +-- src/XML/saml/SubjectConfirmation.php | 8 ++--- src/XML/saml/SubjectConfirmationData.php | 18 +++++----- src/XML/saml/SubjectLocality.php | 4 +-- src/XML/saml/UnknownCondition.php | 4 +-- src/XML/saml/UnknownID.php | 4 +-- src/XML/saml/UnknownStatement.php | 4 +-- src/XML/samlp/AbstractMessage.php | 6 ++-- src/XML/samlp/AbstractStatusResponse.php | 8 ++--- src/XML/samlp/AbstractSubjectQuery.php | 4 +-- src/XML/samlp/Artifact.php | 2 +- src/XML/samlp/ArtifactResolve.php | 12 +++---- src/XML/samlp/ArtifactResponse.php | 12 +++---- src/XML/samlp/AssertionIDRequest.php | 10 +++--- src/XML/samlp/AttributeQuery.php | 14 ++++---- src/XML/samlp/AuthnQuery.php | 14 ++++---- src/XML/samlp/AuthnRequest.php | 29 ++++++++------- src/XML/samlp/AuthzDecisionQuery.php | 12 +++---- src/XML/samlp/Extensions.php | 4 +-- src/XML/samlp/IDPEntry.php | 6 ++-- src/XML/samlp/IDPList.php | 8 ++--- src/XML/samlp/LogoutRequest.php | 14 ++++---- src/XML/samlp/LogoutResponse.php | 12 +++---- src/XML/samlp/MessageFactory.php | 4 +-- src/XML/samlp/NameIDPolicy.php | 10 +++--- src/XML/samlp/RequestedAuthnContext.php | 4 +-- src/XML/samlp/Response.php | 14 ++++---- src/XML/samlp/Scoping.php | 10 +++--- src/XML/samlp/Status.php | 8 ++--- src/XML/samlp/StatusCode.php | 6 ++-- src/XML/samlp/StatusDetail.php | 8 ++--- src/XML/shibmd/KeyAuthority.php | 14 ++++---- src/XML/shibmd/Scope.php | 10 +++--- tests/SAML2/Assert/EntityIDTest.php | 2 +- tests/SAML2/Assert/SAMLAnyURITest.php | 2 +- tests/SAML2/Assert/SAMLDateTimeTest.php | 2 +- tests/SAML2/Assert/SAMLStringTest.php | 2 +- ...bjectConfirmationResponseToMatchesTest.php | 2 +- .../SubjectConfirmationValidatorTest.php | 7 ++-- tests/SAML2/Binding/SOAPTest.php | 12 +++---- tests/SAML2/CustomBaseID.php | 9 ++--- tests/SAML2/CustomCondition.php | 11 +++--- tests/SAML2/CustomRoleDescriptor.php | 21 +++++------ tests/SAML2/CustomStatement.php | 11 +++--- tests/SAML2/Type/AnyURIListValueTest.php | 2 +- .../AuthnContextComparisonTypeValueTest.php | 24 ++++++------- tests/SAML2/Type/DecisionTypeValueTest.php | 2 +- tests/SAML2/Type/EntityIDValueTest.php | 2 +- tests/SAML2/Type/ListOfStringsValueTest.php | 2 +- tests/SAML2/Type/SAMLAnyURIValueTest.php | 2 +- tests/SAML2/Type/SAMLDateTimeValueTest.php | 2 +- tests/SAML2/Type/SAMLStringValueTest.php | 2 +- tests/SAML2/XML/alg/DigestMethodTest.php | 2 +- tests/SAML2/XML/alg/SigningMethodTest.php | 4 +-- tests/SAML2/XML/ecp/RelayStateTest.php | 8 ++--- .../XML/ecp/RequestAuthenticatedTest.php | 10 +++--- tests/SAML2/XML/ecp/RequestTest.php | 10 +++--- tests/SAML2/XML/ecp/ResponseTest.php | 8 ++--- .../SAML2/XML/ecp/SubjectConfirmationTest.php | 10 +++--- .../XML/idpdisc/DiscoveryResponseTest.php | 2 +- .../XML/md/AbstractLocalizedNameTest.php | 2 +- .../XML/md/AdditionalMetadataLocationTest.php | 2 +- .../XML/md/AffiliationDescriptorTest.php | 4 +-- .../XML/md/ArtifactResolutionServiceTest.php | 2 +- .../XML/md/AssertionConsumerServiceTest.php | 2 +- .../md/AttributeAuthorityDescriptorTest.php | 4 +-- .../XML/md/AttributeConsumingServiceTest.php | 4 +-- .../XML/md/AuthnAuthorityDescriptorTest.php | 2 +- tests/SAML2/XML/md/ContactPersonTest.php | 4 +-- tests/SAML2/XML/md/EncryptionMethodTest.php | 4 +-- tests/SAML2/XML/md/EndpointTypeTest.php | 4 +-- tests/SAML2/XML/md/EntitiesDescriptorTest.php | 2 +- tests/SAML2/XML/md/EntityDescriptorTest.php | 7 ++-- tests/SAML2/XML/md/ExtensionsTest.php | 2 +- tests/SAML2/XML/md/IDPSSODescriptorTest.php | 2 +- .../SAML2/XML/md/IndexedEndpointTypeTest.php | 4 +-- tests/SAML2/XML/md/KeyDescriptorTest.php | 4 +-- .../XML/md/OrganizationDisplayNameTest.php | 2 +- tests/SAML2/XML/md/OrganizationNameTest.php | 2 +- tests/SAML2/XML/md/OrganizationTest.php | 2 +- tests/SAML2/XML/md/OrganizationURLTest.php | 2 +- tests/SAML2/XML/md/PDPDescriptorTest.php | 2 +- tests/SAML2/XML/md/RequestedAttributeTest.php | 2 +- tests/SAML2/XML/md/RoleDescriptorTest.php | 9 ++--- tests/SAML2/XML/md/SPSSODescriptorTest.php | 4 +-- tests/SAML2/XML/md/ServiceDescriptionTest.php | 2 +- tests/SAML2/XML/md/ServiceNameTest.php | 4 +-- tests/SAML2/XML/mdrpi/PublicationInfoTest.php | 4 +-- tests/SAML2/XML/mdrpi/PublicationTest.php | 2 +- .../SAML2/XML/mdrpi/RegistrationInfoTest.php | 4 +-- .../XML/mdrpi/RegistrationPolicyTest.php | 2 +- tests/SAML2/XML/mdrpi/UsagePolicyTest.php | 2 +- tests/SAML2/XML/mdui/DescriptionTest.php | 2 +- tests/SAML2/XML/mdui/DiscoHintsTest.php | 2 +- tests/SAML2/XML/mdui/DisplayNameTest.php | 2 +- tests/SAML2/XML/mdui/InformationURLTest.php | 2 +- tests/SAML2/XML/mdui/KeywordsTest.php | 2 +- tests/SAML2/XML/mdui/LogoTest.php | 4 +-- .../XML/mdui/PrivacyStatementURLTest.php | 2 +- tests/SAML2/XML/mdui/UIInfoTest.php | 2 +- tests/SAML2/XML/saml/AssertionIDRefTest.php | 2 +- tests/SAML2/XML/saml/AssertionTest.php | 8 ++--- tests/SAML2/XML/saml/AttributeTest.php | 6 ++-- tests/SAML2/XML/saml/AttributeValueTest.php | 11 +++--- tests/SAML2/XML/saml/AuthnContextDeclTest.php | 2 +- tests/SAML2/XML/saml/AuthnContextTest.php | 2 +- .../AuthnContextWithClassRefAndDeclTest.php | 2 +- .../XML/saml/AuthnContextWithDeclRefTest.php | 3 +- .../XML/saml/AuthnContextWithDeclTest.php | 2 +- tests/SAML2/XML/saml/AuthnStatementTest.php | 2 +- tests/SAML2/XML/saml/BaseIDTest.php | 3 +- tests/SAML2/XML/saml/ConditionTest.php | 3 +- tests/SAML2/XML/saml/ConditionsTest.php | 2 +- .../SAML2/XML/saml/EncryptedAssertionTest.php | 7 ++-- .../SAML2/XML/saml/EncryptedAttributeTest.php | 2 +- tests/SAML2/XML/saml/EncryptedIDTest.php | 8 ++--- tests/SAML2/XML/saml/ProxyRestrictionTest.php | 2 +- tests/SAML2/XML/saml/StatementTest.php | 3 +- .../XML/saml/SubjectConfirmationDataTest.php | 2 +- .../XML/saml/SubjectConfirmationTest.php | 4 +-- tests/SAML2/XML/saml/SubjectTest.php | 7 ++-- tests/SAML2/XML/samlp/AbstractMessageTest.php | 4 +-- .../XML/samlp/AbstractStatusResponseTest.php | 4 +-- tests/SAML2/XML/samlp/ArtifactResolveTest.php | 2 +- .../SAML2/XML/samlp/ArtifactResponseTest.php | 2 +- tests/SAML2/XML/samlp/ArtifactTest.php | 2 +- .../XML/samlp/AssertionIDRequestTest.php | 2 +- tests/SAML2/XML/samlp/AttributeQueryTest.php | 4 +-- tests/SAML2/XML/samlp/AuthnQueryTest.php | 2 +- tests/SAML2/XML/samlp/AuthnRequestTest.php | 6 ++-- .../XML/samlp/AuthzDecisionQueryTest.php | 2 +- tests/SAML2/XML/samlp/IDPListTest.php | 2 +- tests/SAML2/XML/samlp/LogoutRequestTest.php | 6 ++-- tests/SAML2/XML/samlp/LogoutResponseTest.php | 2 +- tests/SAML2/XML/samlp/MessageFactoryTest.php | 2 +- tests/SAML2/XML/samlp/NameIDPolicyTest.php | 2 +- .../XML/samlp/RequestedAuthnContextTest.php | 2 +- tests/SAML2/XML/samlp/ResponseTest.php | 2 +- tests/SAML2/XML/samlp/ScopingTest.php | 2 +- tests/SAML2/XML/shibmd/KeyAuthorityTest.php | 2 +- tests/SAML2/XML/shibmd/ScopeTest.php | 2 +- .../signedresponse_with_signedassertion.php | 2 +- .../signedresponse_with_unsignedassertion.php | 2 +- .../unsignedresponse_with_signedassertion.php | 2 +- tests/resources/xml/ecp_RelayState.xml | 2 +- tests/resources/xml/ecp_Request.xml | 2 +- .../xml/ecp_RequestAuthenticated.xml | 2 +- tests/resources/xml/ecp_Response.xml | 2 +- .../resources/xml/ecp_SubjectConfirmation.xml | 2 +- 232 files changed, 803 insertions(+), 808 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 8b17eb89cd..954f8e8207 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -90,11 +90,6 @@ parameters: count: 2 path: src/Certificate/PrivateKeyLoader.php - - - message: "#^PHPDoc tag @param for parameter \\$qName with type SimpleSAML\\\\XML\\\\Type\\\\QNameValue\\|null is not subtype of native type SimpleSAML\\\\XML\\\\Type\\\\QNameValue\\.$#" - count: 1 - path: src/Compat/AbstractContainer.php - - message: "#^Call to method getArray\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" count: 1 @@ -261,7 +256,7 @@ parameters: path: src/XML/mdui/Keywords.php - - message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\Type\\\\ValueTypeInterface\\:\\:toArray\\(\\)\\.$#" + message: "#^Call to an undefined method SimpleSAML\\\\XMLSchema\\\\Type\\\\Interface\\\\ValueTypeInterface\\:\\:toArray\\(\\)\\.$#" count: 1 path: src/XML/mdui/Keywords.php diff --git a/src/Assert/SAMLStringTrait.php b/src/Assert/SAMLStringTrait.php index 7c68e1b11a..00386a89fb 100644 --- a/src/Assert/SAMLStringTrait.php +++ b/src/Assert/SAMLStringTrait.php @@ -6,7 +6,7 @@ use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * @package simplesamlphp/saml2 diff --git a/src/Binding/SOAP.php b/src/Binding/SOAP.php index dc9bfa4882..a87cdc3030 100644 --- a/src/Binding/SOAP.php +++ b/src/Binding/SOAP.php @@ -15,10 +15,10 @@ use SimpleSAML\SAML2\XML\samlp\AbstractMessage; use SimpleSAML\SAML2\XML\samlp\MessageFactory; use SimpleSAML\SAML2\XML\samlp\Response as SAML2_Response; -use SimpleSAML\SOAP\Utils\XPath; -use SimpleSAML\SOAP\XML\env_200106\{Body, Envelope, Header}; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; +use SimpleSAML\SOAP11\Utils\XPath; +use SimpleSAML\SOAP11\XML\{Body, Envelope, Header}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Type\BooleanValue; use function file_get_contents; @@ -43,7 +43,7 @@ public function getOutputToSend(AbstractMessage $message) // profile, this is the Response itself. if ($message instanceof SAML2_Response) { $requestAuthenticated = new RequestAuthenticated( - BooleanValue::fromBoolean(true), + MustUnderstandValue::fromBoolean(true), ); $destination = $this->destination ?: $message->getDestination()?->getValue(); diff --git a/src/Compat/AbstractContainer.php b/src/Compat/AbstractContainer.php index ef939af55d..ca4baed805 100644 --- a/src/Compat/AbstractContainer.php +++ b/src/Compat/AbstractContainer.php @@ -9,7 +9,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\ExtensionPointInterface; use SimpleSAML\XML\{AbstractElement, ElementInterface}; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; @@ -79,7 +79,7 @@ public function registerExtensionHandler(string $class): void * Such classes must have been registered previously by calling registerExtensionHandler(), and they must * extend \SimpleSAML\XML\AbstractElement. * - * @param \SimpleSAML\XML\Type\QNameValue|null $qName The qualified name of the element. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $qName The qualified name of the element. * * @return string|null The fully-qualified name of a class extending \SimpleSAML\XML\AbstractElement and * implementing support for the given element, or null if no such class has been registered before. @@ -103,7 +103,7 @@ public function getElementHandler(QNameValue $qName): ?string * Such classes must have been registered previously by calling registerExtensionHandler(), and they must * implement \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface. * - * @param \SimpleSAML\XML\Type\QNameValue $qName The qualified name of the extension. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $qName The qualified name of the extension. * @return string|null The fully-qualified name of a class implementing * \SimpleSAML\SAML11\XML\saml\ExtensionPointInterface or null if no such class has been registered before. * @psalm-return class-string|null diff --git a/src/SOAPClient.php b/src/SOAPClient.php index 96fc762c8e..d8aebb927a 100644 --- a/src/SOAPClient.php +++ b/src/SOAPClient.php @@ -10,10 +10,8 @@ use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\XML\samlp\AbstractMessage; use SimpleSAML\SAML2\XML\samlp\MessageFactory; -use SimpleSAML\SOAP\Utils\XPath; -use SimpleSAML\SOAP\XML\env_200106\Body; -use SimpleSAML\SOAP\XML\env_200106\Envelope; -use SimpleSAML\SOAP\XML\env_200106\Fault; +use SimpleSAML\SOAP11\Utils\XPath; +use SimpleSAML\SOAP11\XML\{Body, Envelope, Fault}; use SimpleSAML\Utils\Config; use SimpleSAML\Utils\Crypto; use SimpleSAML\XML\Chunk; @@ -255,7 +253,7 @@ public static function validateSSL(string $data, XMLSecurityKey $key): void * Extracts the SOAP Fault from SOAP message * * @param \DOMDocument $soapMessage Soap response needs to be type DOMDocument - * @return \SimpleSAML\SOAP\XML\env_200106\Fault|null + * @return \SimpleSAML\SOAP11\XML\Fault|null */ private function getSOAPFault(DOMDocument $soapMessage): ?Fault { diff --git a/src/Type/AnyURIListValue.php b/src/Type/AnyURIListValue.php index 70d7a90c49..8b624d4156 100644 --- a/src/Type/AnyURIListValue.php +++ b/src/Type/AnyURIListValue.php @@ -7,8 +7,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Type\ListTypeInterface; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\Interface\ListTypeInterface; use function array_map; use function preg_split; @@ -28,7 +28,7 @@ class AnyURIListValue extends SAMLAnyURIValue implements ListTypeInterface * Validate the value. * * @param string $value - * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure + * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure * @return void */ protected function validateValue(string $value): void diff --git a/src/Type/AuthnContextComparisonTypeValue.php b/src/Type/AuthnContextComparisonTypeValue.php index 55bc91df50..9b450d8ef4 100644 --- a/src/Type/AuthnContextComparisonTypeValue.php +++ b/src/Type/AuthnContextComparisonTypeValue.php @@ -6,8 +6,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\StringValue; use function array_column; diff --git a/src/Type/DecisionTypeValue.php b/src/Type/DecisionTypeValue.php index 2b96db5b6b..3ec6a03763 100644 --- a/src/Type/DecisionTypeValue.php +++ b/src/Type/DecisionTypeValue.php @@ -6,8 +6,8 @@ use SimpleSAML\Assert\Assert; use SimpleSAML\SAML2\XML\saml\DecisionTypeEnum; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\StringValue; use function array_column; diff --git a/src/Type/KeyTypesValue.php b/src/Type/KeyTypesValue.php index 85f346043a..e800e4be81 100644 --- a/src/Type/KeyTypesValue.php +++ b/src/Type/KeyTypesValue.php @@ -6,7 +6,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\md\KeyTypesEnum; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use function array_column; diff --git a/src/Type/ListOfStringsValue.php b/src/Type/ListOfStringsValue.php index 47dfe9e6e1..40d90c3018 100644 --- a/src/Type/ListOfStringsValue.php +++ b/src/Type/ListOfStringsValue.php @@ -7,8 +7,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\SchemaViolationException; -use SimpleSAML\XML\Type\ListTypeInterface; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\Interface\ListTypeInterface; use function array_map; use function preg_split; @@ -34,7 +34,7 @@ class ListOfStringsValue extends SAMLStringValue implements ListTypeInterface * Validate the value. * * @param string $value - * @throws \SimpleSAML\XML\Exception\SchemaViolationException on failure + * @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure * @return void */ protected function validateValue(string $value): void diff --git a/src/Type/SAMLAnyURIValue.php b/src/Type/SAMLAnyURIValue.php index 0c41e987e3..a43e425001 100644 --- a/src/Type/SAMLAnyURIValue.php +++ b/src/Type/SAMLAnyURIValue.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\Type; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\AnyURIValue; /** * @package simplesaml/saml2 diff --git a/src/Type/SAMLDateTimeValue.php b/src/Type/SAMLDateTimeValue.php index b4aea4405a..3c01cf70b4 100644 --- a/src/Type/SAMLDateTimeValue.php +++ b/src/Type/SAMLDateTimeValue.php @@ -6,7 +6,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Type\DateTimeValue; +use SimpleSAML\XMLSchema\Type\DateTimeValue; /** * @package simplesaml/saml2 diff --git a/src/Type/SAMLStringValue.php b/src/Type/SAMLStringValue.php index 26e83d84d9..8754257e81 100644 --- a/src/Type/SAMLStringValue.php +++ b/src/Type/SAMLStringValue.php @@ -5,7 +5,7 @@ namespace SimpleSAML\SAML2\Type; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Type\StringValue; /** * @package simplesaml/saml2 diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index 46ef7798b3..8c1ad3da48 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -9,8 +9,7 @@ use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\AbstractElement; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\XML\EncryptedElementTrait as ParentEncryptedElementTrait; @@ -52,7 +51,7 @@ public function __construct( foreach ($keyInfo->getInfo() as $info) { if ($info instanceof EncryptedKey) { - $this->encryptedKey = $info; + $this->encryptedKey = [$info]; break; } } @@ -83,7 +82,7 @@ public function getDecryptionKeys(): array /** * @inheritDoc * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/ExtensionPointInterface.php b/src/XML/ExtensionPointInterface.php index 01a6299b73..420c4ce76f 100644 --- a/src/XML/ExtensionPointInterface.php +++ b/src/XML/ExtensionPointInterface.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML; -use SimpleSAML\XML\Type\{AnyURIValue, NCNameValue, QNameValue}; +use SimpleSAML\XMLSchema\Type\{AnyURIValue, NCNameValue, QNameValue}; /** * Interface for several extension points objects. @@ -16,7 +16,7 @@ interface ExtensionPointInterface /** * Get the local name for the element's xsi:type. * - * @return \SimpleSAML\XML\Type\NCNameValue + * @return \SimpleSAML\XMLSchema\Type\NCNameValue */ public static function getXsiTypeName(): NCNameValue; @@ -24,7 +24,7 @@ public static function getXsiTypeName(): NCNameValue; /** * Get the namespace for the element's xsi:type. * - * @return \SimpleSAML\XML\Type\AnyURIValue + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ public static function getXsiTypeNamespaceURI(): AnyURIValue; @@ -32,7 +32,7 @@ public static function getXsiTypeNamespaceURI(): AnyURIValue; /** * Get the namespace-prefix for the element's xsi:type. * - * @return \SimpleSAML\XML\Type\NCNameValue + * @return \SimpleSAML\XMLSchema\Type\NCNameValue */ public static function getXsiTypePrefix(): NCNameValue; @@ -40,7 +40,7 @@ public static function getXsiTypePrefix(): NCNameValue; /** * Return the xsi:type value corresponding this element. * - * @return \SimpleSAML\XML\Type\QNameValue + * @return \SimpleSAML\XMLSchema\Type\QNameValue */ public function getXsiType(): QNameValue; } diff --git a/src/XML/ExtensionPointTrait.php b/src/XML/ExtensionPointTrait.php index edd2bdca1c..34b754c659 100644 --- a/src/XML/ExtensionPointTrait.php +++ b/src/XML/ExtensionPointTrait.php @@ -6,7 +6,7 @@ use RuntimeException; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Type\{AnyURIValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\{AnyURIValue, NCNameValue}; use function constant; use function defined; @@ -22,7 +22,7 @@ trait ExtensionPointTrait /** * Get the local name for the element's xsi:type. * - * @return \SimpleSAML\XML\Type\NCNameValue + * @return \SimpleSAML\XMLSchema\Type\NCNameValue */ public static function getXsiTypeName(): NCNameValue { @@ -40,7 +40,7 @@ public static function getXsiTypeName(): NCNameValue /** * Get the namespace for the element's xsi:type. * - * @return \SimpleSAML\XML\Type\AnyURIValue + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ public static function getXsiTypeNamespaceURI(): AnyURIValue { @@ -58,7 +58,7 @@ public static function getXsiTypeNamespaceURI(): AnyURIValue /** * Get the namespace-prefix for the element's xsi:type. * - * @return \SimpleSAML\XML\Type\NCNameValue + * @return \SimpleSAML\XMLSchema\Type\NCNameValue */ public static function getXsiTypePrefix(): NCNameValue { diff --git a/src/XML/IdentifierTrait.php b/src/XML/IdentifierTrait.php index 26d60eadf8..3c5392f3ff 100644 --- a/src/XML/IdentifierTrait.php +++ b/src/XML/IdentifierTrait.php @@ -7,7 +7,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, EncryptedID, IdentifierInterface, NameID}; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; @@ -53,7 +53,7 @@ protected function setIdentifier(?IdentifierInterface $identifier): void * * @param \DOMElement $xml * @return \SimpleSAML\SAML2\XML\saml\IdentifierInterface|null - * @throws \SimpleSAML\XML\Exception\TooManyElementsException if too many child-elements of a type are specified + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException if too many child-elements of a type are specified */ protected static function getIdentifierFromXML(DOMElement $xml): ?IdentifierInterface { diff --git a/src/XML/SignableElementTrait.php b/src/XML/SignableElementTrait.php index 98ea8b87d3..c4b284f56f 100644 --- a/src/XML/SignableElementTrait.php +++ b/src/XML/SignableElementTrait.php @@ -8,7 +8,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Type\{AnyURIValue, Base64BinaryValue}; +use SimpleSAML\XMLSchema\Type\{AnyURIValue, Base64BinaryValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmInterface; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\Exception\{RuntimeException, UnsupportedAlgorithmException}; diff --git a/src/XML/alg/DigestMethod.php b/src/XML/alg/DigestMethod.php index dd739c09ed..59427766df 100644 --- a/src/XML/alg/DigestMethod.php +++ b/src/XML/alg/DigestMethod.php @@ -7,10 +7,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** * Class for handling the alg:DigestMethod element. @@ -25,7 +25,7 @@ final class DigestMethod extends AbstractAlgElement implements SchemaValidatable /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; /** @@ -59,9 +59,9 @@ public function getAlgorithm(): SAMLAnyURIValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the mandatory Algorithm-attribute is missing */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/alg/SigningMethod.php b/src/XML/alg/SigningMethod.php index 38768f7cc6..1c110b1d63 100644 --- a/src/XML/alg/SigningMethod.php +++ b/src/XML/alg/SigningMethod.php @@ -7,11 +7,11 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\PositiveIntegerValue; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** * Class for handling the alg:SigningMethod element. @@ -26,15 +26,15 @@ final class SigningMethod extends AbstractAlgElement implements SchemaValidatabl /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; /** * Create/parse an alg:SigningMethod element. * * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $algorithm - * @param \SimpleSAML\XML\Type\PositiveIntegerValue|null $minKeySize - * @param \SimpleSAML\XML\Type\PositiveIntegerValue|null $maxKeySize + * @param \SimpleSAML\XMLSchema\Type\PositiveIntegerValue|null $minKeySize + * @param \SimpleSAML\XMLSchema\Type\PositiveIntegerValue|null $maxKeySize * @param \SimpleSAML\XML\Chunk[] $elements */ public function __construct( @@ -61,7 +61,7 @@ public function getAlgorithm(): SAMLAnyURIValue /** * Collect the value of the MinKeySize-property * - * @return \SimpleSAML\XML\Type\PositiveIntegerValue|null + * @return \SimpleSAML\XMLSchema\Type\PositiveIntegerValue|null */ public function getMinKeySize(): ?PositiveIntegerValue { @@ -72,7 +72,7 @@ public function getMinKeySize(): ?PositiveIntegerValue /** * Collect the value of the MaxKeySize-property * - * @return \SimpleSAML\XML\Type\PositiveIntegerValue|null + * @return \SimpleSAML\XMLSchema\Type\PositiveIntegerValue|null */ public function getMaxKeySize(): ?PositiveIntegerValue { @@ -86,9 +86,9 @@ public function getMaxKeySize(): ?PositiveIntegerValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied argument is missing the Algorithm attribute */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/ecp/RelayState.php b/src/XML/ecp/RelayState.php index daae01402a..27f6af6a0d 100644 --- a/src/XML/ecp/RelayState.php +++ b/src/XML/ecp/RelayState.php @@ -8,10 +8,11 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\SOAP11\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; /** * Class representing the ECP RelayState element. @@ -33,9 +34,9 @@ final class RelayState extends AbstractEcpElement implements SchemaValidatableEl * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static @@ -45,25 +46,20 @@ public static function fromXML(DOMElement $xml): static // Assert required attributes Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'actor'), 'Missing env:actor attribute in .', MissingAttributeException::class, ); Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand'), 'Missing env:mustUnderstand attribute in .', MissingAttributeException::class, ); - Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), - '1', - 'Invalid value of env:mustUnderstand attribute in .', - ProtocolViolationException::class, - ); + MustUnderstandValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand')); Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->getAttributeNS(C::NS_SOAP_ENV, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, @@ -85,8 +81,8 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', '1'); - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); + $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:mustUnderstand', '1'); + $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:actor', C::SOAP_ACTOR_NEXT); $e->textContent = $this->getContent()->getValue(); return $e; diff --git a/src/XML/ecp/Request.php b/src/XML/ecp/Request.php index b822c05b3e..160e53c2d0 100644 --- a/src/XML/ecp/Request.php +++ b/src/XML/ecp/Request.php @@ -10,10 +10,11 @@ use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\IDPList; -use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; +use SimpleSAML\SOAP11\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function intval; use function strval; @@ -34,7 +35,7 @@ final class Request extends AbstractEcpElement implements SchemaValidatableEleme * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer * @param \SimpleSAML\SAML2\XML\samlp\IDPList|null $idpList * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $providerName - * @param \SimpleSAML\XML\Type\BooleanValue|null $isPassive + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isPassive */ public function __construct( protected Issuer $issuer, @@ -48,7 +49,7 @@ public function __construct( /** * Collect the value of the isPassive-property * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function getIsPassive(): ?BooleanValue { @@ -95,9 +96,9 @@ public function getIDPList(): ?IDPList * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static @@ -107,25 +108,20 @@ public static function fromXML(DOMElement $xml): static // Assert required attributes Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'actor'), 'Missing env:actor attribute in .', MissingAttributeException::class, ); Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand'), 'Missing env:mustUnderstand attribute in .', MissingAttributeException::class, ); - Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), - '1', - 'Invalid value of env:mustUnderstand attribute in .', - ProtocolViolationException::class, - ); + MustUnderstandValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand')); Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->getAttributeNS(C::NS_SOAP_ENV, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, @@ -159,8 +155,8 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', '1'); - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); + $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:mustUnderstand', '1'); + $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:actor', C::SOAP_ACTOR_NEXT); if ($this->getProviderName() !== null) { $e->setAttribute('ProviderName', $this->getProviderName()->getValue()); diff --git a/src/XML/ecp/RequestAuthenticated.php b/src/XML/ecp/RequestAuthenticated.php index b1874de67f..2141ae96e8 100644 --- a/src/XML/ecp/RequestAuthenticated.php +++ b/src/XML/ecp/RequestAuthenticated.php @@ -7,10 +7,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\SOAP11\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; use function intval; use function strval; @@ -28,10 +28,10 @@ final class RequestAuthenticated extends AbstractEcpElement implements SchemaVal /** * Create a ECP RequestAuthenticated element. * - * @param \SimpleSAML\XML\Type\BooleanValue|null $mustUnderstand + * @param \SimpleSAML\SOAP11\Type\MustUnderstandValue|null $mustUnderstand */ public function __construct( - protected ?BooleanValue $mustUnderstand, + protected ?MustUnderstandValue $mustUnderstand, ) { } @@ -39,9 +39,9 @@ public function __construct( /** * Collect the value of the mustUnderstand-property * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\SOAP11\Type\MustUnderstandValue|null */ - public function getMustUnderstand(): ?BooleanValue + public function getMustUnderstand(): ?MustUnderstandValue { return $this->mustUnderstand; } @@ -53,9 +53,9 @@ public function getMustUnderstand(): ?BooleanValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static @@ -65,18 +65,18 @@ public static function fromXML(DOMElement $xml): static // Assert required attributes Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'actor'), 'Missing env:actor attribute in .', MissingAttributeException::class, ); $mustUnderstand = null; - if ($xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand')) { - $mustUnderstand = BooleanValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand')); + if ($xml->hasAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand')) { + $mustUnderstand = MustUnderstandValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand')); } Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->getAttributeNS(C::NS_SOAP_ENV, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, @@ -97,14 +97,10 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); if ($this->getMustUnderstand() !== null) { - $e->setAttributeNS( - C::NS_SOAP_ENV_11, - 'env:mustUnderstand', - strval(intval($this->getMustUnderstand()->getValue())), - ); + $this->getMustUnderstand()->toAttribute()->toXML($e); } - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); + $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:actor', C::SOAP_ACTOR_NEXT); return $e; } diff --git a/src/XML/ecp/Response.php b/src/XML/ecp/Response.php index 2ed7dc57ed..f801778282 100644 --- a/src/XML/ecp/Response.php +++ b/src/XML/ecp/Response.php @@ -8,9 +8,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\SOAP11\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; /** * Class representing the ECP Response element. @@ -50,9 +51,9 @@ public function getAssertionConsumerServiceURL(): SAMLAnyURIValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static @@ -62,12 +63,12 @@ public static function fromXML(DOMElement $xml): static // Assert required attributes Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand'), 'Missing env:mustUnderstand attribute in .', MissingAttributeException::class, ); Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'actor'), 'Missing env:actor attribute in .', MissingAttributeException::class, ); @@ -77,15 +78,10 @@ public static function fromXML(DOMElement $xml): static MissingAttributeException::class, ); - Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), - '1', - 'Invalid value of env:mustUnderstand attribute in .', - ProtocolViolationException::class, - ); + MustUnderstandValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand')); Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->getAttributeNS(C::NS_SOAP_ENV, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, @@ -105,8 +101,8 @@ public function toXML(?DOMElement $parent = null): DOMElement { $response = $this->instantiateParentElement($parent); - $response->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', '1'); - $response->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); + $response->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:mustUnderstand', '1'); + $response->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:actor', C::SOAP_ACTOR_NEXT); $response->setAttribute('AssertionConsumerServiceURL', $this->getAssertionConsumerServiceURL()->getValue()); return $response; diff --git a/src/XML/ecp/SubjectConfirmation.php b/src/XML/ecp/SubjectConfirmation.php index 537eb78421..2ee38a7281 100644 --- a/src/XML/ecp/SubjectConfirmation.php +++ b/src/XML/ecp/SubjectConfirmation.php @@ -9,9 +9,10 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; -use SimpleSAML\SOAP\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; +use SimpleSAML\SOAP11\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; /** * Class representing the ECP SubjectConfirmation element. @@ -64,9 +65,9 @@ public function getSubjectConfirmationData(): ?SubjectConfirmationData * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static @@ -76,25 +77,25 @@ public static function fromXML(DOMElement $xml): static // Assert required attributes Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'actor'), 'Missing env:actor attribute in .', MissingAttributeException::class, ); Assert::true( - $xml->hasAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), + $xml->hasAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand'), 'Missing env:mustUnderstand attribute in .', MissingAttributeException::class, ); - Assert::oneOf( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'mustUnderstand'), - ['1', 'true'], + $mustUnderstand = MustUnderstandValue::fromString($xml->getAttributeNS(C::NS_SOAP_ENV, 'mustUnderstand')); + Assert::true( + $mustUnderstand->toBoolean(), 'Invalid value of env:mustUnderstand attribute in .', ProtocolViolationException::class, ); Assert::same( - $xml->getAttributeNS(C::NS_SOAP_ENV_11, 'actor'), + $xml->getAttributeNS(C::NS_SOAP_ENV, 'actor'), C::SOAP_ACTOR_NEXT, 'Invalid value of env:actor attribute in .', ProtocolViolationException::class, @@ -124,8 +125,8 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:mustUnderstand', '1'); - $e->setAttributeNS(C::NS_SOAP_ENV_11, 'env:actor', C::SOAP_ACTOR_NEXT); + $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:mustUnderstand', '1'); + $e->setAttributeNS(C::NS_SOAP_ENV, 'SOAP-ENV:actor', C::SOAP_ACTOR_NEXT); $e->setAttribute('Method', $this->getMethod()->getValue()); $this->getSubjectConfirmationData()?->toXML($e); diff --git a/src/XML/emd/RepublishRequest.php b/src/XML/emd/RepublishRequest.php index 2796f6409b..a5fafff191 100644 --- a/src/XML/emd/RepublishRequest.php +++ b/src/XML/emd/RepublishRequest.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; use function array_pop; @@ -52,9 +52,9 @@ public function getRepublishTarget(): RepublishTarget * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/idpdisc/DiscoveryResponse.php b/src/XML/idpdisc/DiscoveryResponse.php index f0ec80892c..f319c511ff 100644 --- a/src/XML/idpdisc/DiscoveryResponse.php +++ b/src/XML/idpdisc/DiscoveryResponse.php @@ -10,7 +10,7 @@ use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; /** * Abstract class to be implemented by all the classes in this namespace @@ -39,10 +39,10 @@ final class DiscoveryResponse extends AbstractIndexedEndpointType implements Sch * * This is an endpoint with one restriction: it cannot contain a ResponseLocation. * - * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location - * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isDefault * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $attributes diff --git a/src/XML/init/RequestInitiator.php b/src/XML/init/RequestInitiator.php index b675d47297..aff1551dcd 100644 --- a/src/XML/init/RequestInitiator.php +++ b/src/XML/init/RequestInitiator.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\md\AbstractEndpointType; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class for handling the init:RequestInitiator element. @@ -39,7 +39,7 @@ final class RequestInitiator extends AbstractEndpointType implements SchemaValid * * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation - * @param array $children + * @param array<\SimpleSAML\XML\SerializableElementInterface> $children * @param array<\SimpleSAML\XML\Attribute> $attributes * * @throws \InvalidArgumentException diff --git a/src/XML/md/AbstractEndpointType.php b/src/XML/md/AbstractEndpointType.php index f664816ba6..458e47e6e2 100644 --- a/src/XML/md/AbstractEndpointType.php +++ b/src/XML/md/AbstractEndpointType.php @@ -10,10 +10,10 @@ use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait}; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function array_change_key_case; use function array_key_exists; @@ -42,10 +42,10 @@ abstract class AbstractEndpointType extends AbstractMdElement implements Arrayiz /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** @@ -112,9 +112,9 @@ public function getResponseLocation(): ?SAMLAnyURIValue * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AbstractIndexedEndpointType.php b/src/XML/md/AbstractIndexedEndpointType.php index c520f85a8d..94ee488db8 100644 --- a/src/XML/md/AbstractIndexedEndpointType.php +++ b/src/XML/md/AbstractIndexedEndpointType.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\SerializableElementInterface; -use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; use function array_filter; use function array_key_exists; @@ -36,10 +36,10 @@ abstract class AbstractIndexedEndpointType extends AbstractEndpointType implemen * static methods to get its properties from a given \DOMElement for your convenience. Look at the implementation * of fromXML() to know how to use them. * - * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location - * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isDefault * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $responseLocation * @param array $children * @param list<\SimpleSAML\XML\Attribute> $attributes @@ -66,9 +66,9 @@ public function __construct( * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AbstractLocalizedName.php b/src/XML/md/AbstractLocalizedName.php index 820d71c325..1de1eea368 100644 --- a/src/XML/md/AbstractLocalizedName.php +++ b/src/XML/md/AbstractLocalizedName.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; -use SimpleSAML\XML\Type\LanguageValue; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function array_key_first; @@ -32,7 +32,7 @@ abstract class AbstractLocalizedName extends AbstractMdElement implements Arrayi /** * LocalizedNameType constructor. * - * @param \SimpleSAML\XML\Type\LanguageValue $language The language this string is localized in. + * @param \SimpleSAML\XMLSchema\Type\LanguageValue $language The language this string is localized in. * @param \SimpleSAML\SAML2\Type\SAMLStringValue $content The localized string. */ public function __construct( @@ -46,7 +46,7 @@ public function __construct( /** * Get the language this string is localized in. * - * @return \SimpleSAML\XML\Type\LanguageValue + * @return \SimpleSAML\XMLSchema\Type\LanguageValue */ public function getLanguage(): LanguageValue { @@ -60,7 +60,7 @@ public function getLanguage(): LanguageValue * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AbstractLocalizedURI.php b/src/XML/md/AbstractLocalizedURI.php index ab2170c85a..15d253912e 100644 --- a/src/XML/md/AbstractLocalizedURI.php +++ b/src/XML/md/AbstractLocalizedURI.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function array_key_first; @@ -27,7 +27,7 @@ abstract class AbstractLocalizedURI extends AbstractLocalizedName /** * LocalizedNameType constructor. * - * @param \SimpleSAML\XML\Type\LanguageValue $language The language this string is localized in. + * @param \SimpleSAML\XMLSchema\Type\LanguageValue $language The language this string is localized in. * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $content The localized string. */ final public function __construct( @@ -46,7 +46,7 @@ final public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AbstractMetadataDocument.php b/src/XML/md/AbstractMetadataDocument.php index 98ded978ec..d42da13463 100644 --- a/src/XML/md/AbstractMetadataDocument.php +++ b/src/XML/md/AbstractMetadataDocument.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, PublicationPath, RegistrationInfo}; use SimpleSAML\SAML2\XML\mdui\{DiscoHints, UIInfo}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; /** * Class to represent a metadata document @@ -26,10 +26,10 @@ abstract class AbstractMetadataDocument extends AbstractSignedMdElement /** * Generic constructor for SAML metadata documents. * - * @param \SimpleSAML\XML\Type\IDValue|null $id The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to null. */ @@ -91,7 +91,7 @@ public function __construct( /** * Collect the value of the id property. * - * @return \SimpleSAML\XML\Type\IDValue|null + * @return \SimpleSAML\XMLSchema\Type\IDValue|null */ public function getId(): ?IDValue { @@ -113,7 +113,7 @@ public function getValidUntil(): ?SAMLDateTimeValue /** * Collect the value of the cacheDuration property. * - * @return \SimpleSAML\XML\Type\DurationValue|null + * @return \SimpleSAML\XMLSchema\Type\DurationValue|null */ public function getCacheDuration(): ?DurationValue { diff --git a/src/XML/md/AbstractRoleDescriptor.php b/src/XML/md/AbstractRoleDescriptor.php index 9f4b870a4d..457dde0b2e 100644 --- a/src/XML/md/AbstractRoleDescriptor.php +++ b/src/XML/md/AbstractRoleDescriptor.php @@ -11,9 +11,10 @@ use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue}; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, QNameValue}; use function array_pop; @@ -37,13 +38,13 @@ abstract class AbstractRoleDescriptor extends AbstractRoleDescriptorType impleme /** * Initialize a md:RoleDescriptor from scratch. * - * @param \SimpleSAML\XML\Type\QNameValue $type + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * A set of URI specifying the protocols supported. - * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. @@ -87,7 +88,7 @@ public function __construct( /** * Return the xsi:type value corresponding this element. * - * @return \SimpleSAML\XML\Type\QNameValue + * @return \SimpleSAML\XMLSchema\Type\QNameValue */ public function getXsiType(): QNameValue { @@ -100,7 +101,7 @@ public function getXsiType(): QNameValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -108,12 +109,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'RoleDescriptor', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_MD, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', SchemaViolationException::class, ); - $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); + $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index 02a01db4a7..1bb3271a85 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -10,8 +10,8 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function strval; @@ -26,7 +26,7 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** @@ -34,10 +34,10 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument * * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * A set of URI specifying the protocols supported. - * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. diff --git a/src/XML/md/AbstractSSODescriptor.php b/src/XML/md/AbstractSSODescriptor.php index 6cad0eec0b..ddb5051f33 100644 --- a/src/XML/md/AbstractSSODescriptor.php +++ b/src/XML/md/AbstractSSODescriptor.php @@ -9,7 +9,7 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Type\{IDValue, DurationValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, DurationValue}; /** * Class representing SAML 2 SSODescriptorType. @@ -23,10 +23,10 @@ abstract class AbstractSSODescriptor extends AbstractRoleDescriptorType * * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * A set of URI specifying the protocols supported. - * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. diff --git a/src/XML/md/AdditionalMetadataLocation.php b/src/XML/md/AdditionalMetadataLocation.php index 0db99da22a..08838ca9d6 100644 --- a/src/XML/md/AdditionalMetadataLocation.php +++ b/src/XML/md/AdditionalMetadataLocation.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class representing SAML 2 metadata AdditionalMetadataLocation element. @@ -61,9 +61,9 @@ public function getLocation(): SAMLAnyURIValue * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AffiliationDescriptor.php b/src/XML/md/AffiliationDescriptor.php index ee9399775a..2fb445093f 100644 --- a/src/XML/md/AffiliationDescriptor.php +++ b/src/XML/md/AffiliationDescriptor.php @@ -8,10 +8,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** @@ -26,7 +26,7 @@ final class AffiliationDescriptor extends AbstractMetadataDocument implements Sc /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** @@ -35,10 +35,10 @@ final class AffiliationDescriptor extends AbstractMetadataDocument implements Sc * @param \SimpleSAML\SAML2\Type\EntityIDValue $affiliationOwnerId The ID of the owner of this affiliation. * @param \SimpleSAML\SAML2\XML\md\AffiliateMember[] $affiliateMember * A non-empty array of members of this affiliation. - * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. Defaults to an empty array. * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor @@ -106,11 +106,11 @@ public function getKeyDescriptor(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/ArtifactResolutionService.php b/src/XML/md/ArtifactResolutionService.php index be74851d67..1df85fe268 100644 --- a/src/XML/md/ArtifactResolutionService.php +++ b/src/XML/md/ArtifactResolutionService.php @@ -7,7 +7,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; /** * A class implementing the md:ArtifactResolutionService element. @@ -24,10 +24,10 @@ final class ArtifactResolutionService extends AbstractIndexedEndpointType implem * * This is an endpoint with one restriction: it cannot contain a ResponseLocation. * - * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $binding * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $location - * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isDefault * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $unused * @param list<\SimpleSAML\XML\Attribute> $attributes * @param array $children diff --git a/src/XML/md/AttributeAuthorityDescriptor.php b/src/XML/md/AttributeAuthorityDescriptor.php index e4d5f53bf7..b337d434c0 100644 --- a/src/XML/md/AttributeAuthorityDescriptor.php +++ b/src/XML/md/AttributeAuthorityDescriptor.php @@ -9,9 +9,9 @@ use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** @@ -34,9 +34,9 @@ final class AttributeAuthorityDescriptor extends AbstractRoleDescriptorType impl * @param \SimpleSAML\SAML2\XML\md\NameIDFormat[] $nameIDFormat * @param \SimpleSAML\SAML2\XML\md\AttributeProfile[] $attributeProfile * @param \SimpleSAML\SAML2\XML\saml\Attribute[] $attribute - * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -159,13 +159,13 @@ public function getAttributes(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AttributeConsumingService.php b/src/XML/md/AttributeConsumingService.php index ad34c0eaac..da522c545a 100644 --- a/src/XML/md/AttributeConsumingService.php +++ b/src/XML/md/AttributeConsumingService.php @@ -7,9 +7,9 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; use function var_export; @@ -27,10 +27,10 @@ final class AttributeConsumingService extends AbstractMdElement implements Schem /** * AttributeConsumingService constructor. * - * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index * @param \SimpleSAML\SAML2\XML\md\ServiceName[] $serviceName * @param \SimpleSAML\SAML2\XML\md\RequestedAttribute[] $requestedAttribute - * @param \SimpleSAML\XML\Type\BooleanValue|null $isDefault + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isDefault * @param \SimpleSAML\SAML2\XML\md\ServiceDescription[] $serviceDescription */ public function __construct( @@ -82,9 +82,9 @@ public function __construct( * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/AuthnAuthorityDescriptor.php b/src/XML/md/AuthnAuthorityDescriptor.php index e7662a2656..c1ce775fe9 100644 --- a/src/XML/md/AuthnAuthorityDescriptor.php +++ b/src/XML/md/AuthnAuthorityDescriptor.php @@ -8,9 +8,9 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** @@ -30,9 +30,9 @@ final class AuthnAuthorityDescriptor extends AbstractRoleDescriptorType implemen * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * @param array $assertionIDRequestService * @param array $nameIDFormat - * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -125,11 +125,11 @@ public function getNameIDFormat(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/ContactPerson.php b/src/XML/md/ContactPerson.php index 2431931bcf..71c417f533 100644 --- a/src/XML/md/ContactPerson.php +++ b/src/XML/md/ContactPerson.php @@ -12,9 +12,9 @@ use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function array_change_key_case; use function array_filter; @@ -39,7 +39,7 @@ final class ContactPerson extends AbstractMdElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** * The several different contact types as defined per specification @@ -158,11 +158,11 @@ public function getTelephoneNumber(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/EntitiesDescriptor.php b/src/XML/md/EntitiesDescriptor.php index f6e42f18bb..cab1e0914c 100644 --- a/src/XML/md/EntitiesDescriptor.php +++ b/src/XML/md/EntitiesDescriptor.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, PublicationPath, RegistrationInfo}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function count; @@ -36,9 +36,9 @@ final class EntitiesDescriptor extends AbstractMetadataDocument implements Schem * @param \SimpleSAML\SAML2\XML\md\EntityDescriptor[] $entityDescriptors * @param \SimpleSAML\SAML2\XML\md\EntitiesDescriptor[] $entitiesDescriptors * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $Name - * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions */ public function __construct( @@ -203,9 +203,9 @@ public function getName(): ?SAMLStringValue * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/EntityDescriptor.php b/src/XML/md/EntityDescriptor.php index edfd328d70..c232ff7303 100644 --- a/src/XML/md/EntityDescriptor.php +++ b/src/XML/md/EntityDescriptor.php @@ -9,10 +9,10 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function is_null; @@ -29,17 +29,17 @@ final class EntityDescriptor extends AbstractMetadataDocument implements SchemaV /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** * Initialize an EntitiyDescriptor. * * @param \SimpleSAML\SAML2\Type\EntityIDValue $entityId The entityID of the entity described by this descriptor. - * @param \SimpleSAML\XML\Type\IDValue|null $id The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $id The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validify for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An array of extensions. * @param \SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType[] $roleDescriptor An array of role descriptors. @@ -102,11 +102,11 @@ public function __construct( * @param \DOMElement $xml An existing EntityDescriptor XML document. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/Extensions.php b/src/XML/md/Extensions.php index 9f79ad38c0..aa308e87fe 100644 --- a/src/XML/md/Extensions.php +++ b/src/XML/md/Extensions.php @@ -30,8 +30,8 @@ }; use SimpleSAML\SAML2\XML\shibmd\Scope; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_key_exists; @@ -55,7 +55,7 @@ final class Extensions extends AbstractMdElement implements SchemaValidatableEle * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/IDPSSODescriptor.php b/src/XML/md/IDPSSODescriptor.php index 3f17a7a622..c7e667f1f1 100644 --- a/src/XML/md/IDPSSODescriptor.php +++ b/src/XML/md/IDPSSODescriptor.php @@ -9,9 +9,9 @@ use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{BooleanValue, DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function var_export; @@ -31,14 +31,14 @@ final class IDPSSODescriptor extends AbstractSSODescriptor implements SchemaVali * * @param \SimpleSAML\SAML2\XML\md\SingleSignOnService[] $singleSignOnService * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration - * @param \SimpleSAML\XML\Type\BooleanValue|null $wantAuthnRequestsSigned + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $wantAuthnRequestsSigned * @param \SimpleSAML\SAML2\XML\md\NameIDMappingService[] $nameIDMappingService * @param \SimpleSAML\SAML2\XML\md\AssertionIDRequestService[] $assertionIDRequestService * @param \SimpleSAML\SAML2\XML\md\AttributeProfile[] $attributeProfile * @param \SimpleSAML\SAML2\XML\saml\Attribute[] $attribute - * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\KeyDescriptor[] $keyDescriptor @@ -119,7 +119,7 @@ public function __construct( /** * Collect the value of the WantAuthnRequestsSigned-property * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function wantAuthnRequestsSigned(): ?BooleanValue { @@ -188,11 +188,11 @@ public function getSupportedAttribute(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/IndexedElementTrait.php b/src/XML/md/IndexedElementTrait.php index ba2d8c6a48..1d02b5909e 100644 --- a/src/XML/md/IndexedElementTrait.php +++ b/src/XML/md/IndexedElementTrait.php @@ -4,7 +4,7 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; /** * Trait adding methods to handle elements that can be indexed. @@ -16,14 +16,14 @@ trait IndexedElementTrait /** * The index for this endpoint. * - * @var \SimpleSAML\XML\Type\UnsignedShortValue + * @var \SimpleSAML\XMLSchema\Type\UnsignedShortValue */ protected UnsignedShortValue $index; /** * Whether this endpoint is the default. * - * @var \SimpleSAML\XML\Type\BooleanValue|null + * @var \SimpleSAML\XMLSchema\Type\BooleanValue|null */ protected ?BooleanValue $isDefault = null; @@ -31,7 +31,7 @@ trait IndexedElementTrait /** * Collect the value of the index property. * - * @return \SimpleSAML\XML\Type\UnsignedShortValue + * @return \SimpleSAML\XMLSchema\Type\UnsignedShortValue */ public function getIndex(): UnsignedShortValue { @@ -42,7 +42,7 @@ public function getIndex(): UnsignedShortValue /** * Set the value of the index property. * - * @param \SimpleSAML\XML\Type\UnsignedShortValue $index + * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue $index */ protected function setIndex(UnsignedShortValue $index): void { @@ -53,7 +53,7 @@ protected function setIndex(UnsignedShortValue $index): void /** * Collect the value of the isDefault property. * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function getIsDefault(): ?BooleanValue { @@ -64,7 +64,7 @@ public function getIsDefault(): ?BooleanValue /** * Set the value of the isDefault property. * - * @param \SimpleSAML\XML\Type\BooleanValue|null $flag + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $flag */ protected function setIsDefault(?BooleanValue $flag): void { diff --git a/src/XML/md/KeyDescriptor.php b/src/XML/md/KeyDescriptor.php index 6b64712e2b..bc31d48ff4 100644 --- a/src/XML/md/KeyDescriptor.php +++ b/src/XML/md/KeyDescriptor.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\KeyTypesValue; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; use function array_pop; @@ -80,11 +80,11 @@ public function getEncryptionMethod(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/Organization.php b/src/XML/md/Organization.php index b40a25529a..5fde7896c3 100644 --- a/src/XML/md/Organization.php +++ b/src/XML/md/Organization.php @@ -11,9 +11,9 @@ use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function array_change_key_case; use function array_filter; @@ -36,7 +36,7 @@ final class Organization extends AbstractMdElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** @@ -112,9 +112,9 @@ public function getOrganizationURL(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/PDPDescriptor.php b/src/XML/md/PDPDescriptor.php index 0698a95bee..709684000a 100644 --- a/src/XML/md/PDPDescriptor.php +++ b/src/XML/md/PDPDescriptor.php @@ -8,9 +8,9 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** @@ -30,9 +30,9 @@ final class PDPDescriptor extends AbstractRoleDescriptorType implements SchemaVa * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * @param \SimpleSAML\SAML2\XML\md\AssertionIDRequestService[] $assertionIDRequestService * @param \SimpleSAML\SAML2\XML\md\NameIDFormat[] $nameIDFormat - * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param \SimpleSAML\SAML2\XML\md\Organization|null $organization @@ -125,11 +125,11 @@ public function getNameIDFormat(): array * @param \DOMElement $xml The XML element we should load. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/RequestedAttribute.php b/src/XML/md/RequestedAttribute.php index 40df3d6857..e80493959f 100644 --- a/src/XML/md/RequestedAttribute.php +++ b/src/XML/md/RequestedAttribute.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * Class representing SAML 2 metadata RequestedAttribute. @@ -33,7 +33,7 @@ final class RequestedAttribute extends Attribute * RequestedAttribute constructor. * * @param \SimpleSAML\SAML2\Type\SAMLStringValue $Name - * @param \SimpleSAML\XML\Type\BooleanValue|null $isRequired + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isRequired * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $NameFormat * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $FriendlyName * @param \SimpleSAML\SAML2\XML\saml\AttributeValue[] $AttributeValues @@ -52,7 +52,7 @@ public function __construct( /** * Collect the value of the isRequired-property * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function getIsRequired(): ?BooleanValue { @@ -66,9 +66,9 @@ public function getIsRequired(): ?BooleanValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/SPSSODescriptor.php b/src/XML/md/SPSSODescriptor.php index 5ac6e605f6..1772e97e66 100644 --- a/src/XML/md/SPSSODescriptor.php +++ b/src/XML/md/SPSSODescriptor.php @@ -8,9 +8,9 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{BooleanValue, DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, DurationValue, IDValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_filter; @@ -31,12 +31,12 @@ final class SPSSODescriptor extends AbstractSSODescriptor implements SchemaValid * * @param array<\SimpleSAML\SAML2\XML\md\AssertionConsumerService> $assertionConsumerService * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration - * @param \SimpleSAML\XML\Type\BooleanValue|null $authnRequestsSigned - * @param \SimpleSAML\XML\Type\BooleanValue|null $wantAssertionsSigned + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $authnRequestsSigned + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $wantAssertionsSigned * @param array<\SimpleSAML\SAML2\XML\md\AttributeConsumingService> $attributeConsumingService - * @param \SimpleSAML\XML\Type\IDValue|null $ID + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL * @param array<\SimpleSAML\SAML2\XML\md\KeyDescriptor> $keyDescriptors @@ -115,7 +115,7 @@ function (AttributeConsumingService $acs) { /** * Collect the value of the AuthnRequestsSigned-property * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function getAuthnRequestsSigned(): ?BooleanValue { @@ -126,7 +126,7 @@ public function getAuthnRequestsSigned(): ?BooleanValue /** * Collect the value of the WantAssertionsSigned-property * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function getWantAssertionsSigned(): ?BooleanValue { @@ -162,11 +162,11 @@ public function getAttributeConsumingService(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/md/UnknownRoleDescriptor.php b/src/XML/md/UnknownRoleDescriptor.php index 4f6f8b6823..b74d88b3b3 100644 --- a/src/XML/md/UnknownRoleDescriptor.php +++ b/src/XML/md/UnknownRoleDescriptor.php @@ -7,7 +7,7 @@ use DOMElement; use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, QNameValue}; /** * Class representing unknown RoleDescriptors. @@ -20,13 +20,13 @@ final class UnknownRoleDescriptor extends AbstractRoleDescriptor * Initialize an unknown RoleDescriptor. * * @param \SimpleSAML\XML\Chunk $chunk The whole RoleDescriptor element as a chunk object. - * @param \SimpleSAML\XML\Type\QNameValue $type + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * A set of URI specifying the protocols supported. - * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. diff --git a/src/XML/mdattr/EntityAttributes.php b/src/XML/mdattr/EntityAttributes.php index 01d979d454..46b1173386 100644 --- a/src/XML/mdattr/EntityAttributes.php +++ b/src/XML/mdattr/EntityAttributes.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\XML\saml\{Assertion, Attribute, AttributeStatement, NameID}; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_filter; use function array_merge; @@ -129,7 +129,7 @@ public function addChild($child): void * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdrpi/Publication.php b/src/XML/mdrpi/Publication.php index 985a86bd64..12935030b8 100644 --- a/src/XML/mdrpi/Publication.php +++ b/src/XML/mdrpi/Publication.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class for handling the mdrpi:Publication element. @@ -79,9 +79,9 @@ public function getPublicationId(): ?SAMLStringValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdrpi/PublicationInfo.php b/src/XML/mdrpi/PublicationInfo.php index d5b929acdb..ed9d15183d 100644 --- a/src/XML/mdrpi/PublicationInfo.php +++ b/src/XML/mdrpi/PublicationInfo.php @@ -10,8 +10,8 @@ use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_change_key_case; use function array_keys; @@ -115,9 +115,9 @@ public function getUsagePolicy(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdrpi/PublicationPath.php b/src/XML/mdrpi/PublicationPath.php index f71336fa4f..d716ecb71a 100644 --- a/src/XML/mdrpi/PublicationPath.php +++ b/src/XML/mdrpi/PublicationPath.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class for handling the mdrpi:PublicationPath element. @@ -66,9 +66,9 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdrpi/RegistrationInfo.php b/src/XML/mdrpi/RegistrationInfo.php index 976203157d..cc40c4755b 100644 --- a/src/XML/mdrpi/RegistrationInfo.php +++ b/src/XML/mdrpi/RegistrationInfo.php @@ -10,8 +10,8 @@ use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class for handling the mdrpi:RegistrationInfo element. @@ -99,9 +99,9 @@ public function getRegistrationPolicy(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdui/DiscoHints.php b/src/XML/mdui/DiscoHints.php index 83f71ef9f6..7ca70b489e 100644 --- a/src/XML/mdui/DiscoHints.php +++ b/src/XML/mdui/DiscoHints.php @@ -11,10 +11,10 @@ use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, SerializableElementInterface}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function array_filter; use function array_key_exists; @@ -35,7 +35,7 @@ final class DiscoHints extends AbstractMduiElement implements /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; /** @@ -127,7 +127,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdui/Keywords.php b/src/XML/mdui/Keywords.php index 38ce3d7f05..bcd3dc2bb9 100644 --- a/src/XML/mdui/Keywords.php +++ b/src/XML/mdui/Keywords.php @@ -9,10 +9,10 @@ use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; use SimpleSAML\SAML2\Type\ListOfStringsValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\LanguageValue; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function array_key_first; @@ -37,7 +37,7 @@ final class Keywords extends AbstractMduiElement implements /** * Initialize a Keywords. * - * @param \SimpleSAML\XML\Type\LanguageValue $lang + * @param \SimpleSAML\XMLSchema\Type\LanguageValue $lang * @param \SimpleSAML\SAML2\Type\ListOfStringsValue $keywords */ public function __construct( @@ -51,7 +51,7 @@ public function __construct( /** * Collect the value of the lang-property * - * @return \SimpleSAML\XML\Type\LanguageValue + * @return \SimpleSAML\XMLSchema\Type\LanguageValue */ public function getLanguage(): LanguageValue { @@ -65,9 +65,9 @@ public function getLanguage(): LanguageValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdui/Logo.php b/src/XML/mdui/Logo.php index c73129a418..8a1f41f362 100644 --- a/src/XML/mdui/Logo.php +++ b/src/XML/mdui/Logo.php @@ -9,10 +9,10 @@ use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue}; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue}; /** * Class for handling the Logo metadata extensions for login and discovery user interface @@ -38,9 +38,9 @@ final class Logo extends AbstractMduiElement implements * Initialize a Logo. * * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $url - * @param \SimpleSAML\XML\Type\PositiveIntegerValue $height - * @param \SimpleSAML\XML\Type\PositiveIntegerValue $width - * @param \SimpleSAML\XML\Type\LanguageValue|null $lang + * @param \SimpleSAML\XMLSchema\Type\PositiveIntegerValue $height + * @param \SimpleSAML\XMLSchema\Type\PositiveIntegerValue $width + * @param \SimpleSAML\XMLSchema\Type\LanguageValue|null $lang */ public function __construct( SAMLAnyURIValue $url, @@ -69,7 +69,7 @@ protected function validateContent(string $content): void /** * Collect the value of the lang-property * - * @return \SimpleSAML\XML\Type\LanguageValue|null + * @return \SimpleSAML\XMLSchema\Type\LanguageValue|null */ public function getLanguage(): ?LanguageValue { @@ -80,7 +80,7 @@ public function getLanguage(): ?LanguageValue /** * Collect the value of the height-property * - * @return \SimpleSAML\XML\Type\PositiveIntegerValue + * @return \SimpleSAML\XMLSchema\Type\PositiveIntegerValue */ public function getHeight(): PositiveIntegerValue { @@ -91,7 +91,7 @@ public function getHeight(): PositiveIntegerValue /** * Collect the value of the width-property * - * @return \SimpleSAML\XML\Type\PositiveIntegerValue + * @return \SimpleSAML\XMLSchema\Type\PositiveIntegerValue */ public function getWidth(): PositiveIntegerValue { @@ -105,9 +105,9 @@ public function getWidth(): PositiveIntegerValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/mdui/UIInfo.php b/src/XML/mdui/UIInfo.php index 137fbcbb95..b861964cd4 100644 --- a/src/XML/mdui/UIInfo.php +++ b/src/XML/mdui/UIInfo.php @@ -10,10 +10,10 @@ use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, SerializableElementInterface}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function array_filter; use function array_key_exists; @@ -37,7 +37,7 @@ final class UIInfo extends AbstractMduiElement implements /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; /** @@ -264,7 +264,7 @@ function ($elt) { * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/AbstractBaseID.php b/src/XML/saml/AbstractBaseID.php index b086abf777..e7afb64944 100644 --- a/src/XML/saml/AbstractBaseID.php +++ b/src/XML/saml/AbstractBaseID.php @@ -12,9 +12,10 @@ use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Type\QNameValue; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; @@ -40,7 +41,7 @@ abstract class AbstractBaseID extends AbstractBaseIDType implements /** * Initialize a saml:BaseID from scratch * - * @param \SimpleSAML\XML\Type\QNameValue $type + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier */ @@ -54,7 +55,7 @@ protected function __construct( /** - * @return \SimpleSAML\XML\Type\QNameValue + * @return \SimpleSAML\XMLSchema\Type\QNameValue */ public function getXsiType(): QNameValue { @@ -68,7 +69,7 @@ public function getXsiType(): QNameValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -76,12 +77,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'BaseID', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', SchemaViolationException::class, ); - $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); + $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); @@ -119,7 +120,7 @@ public function toXML(?DOMElement $parent = null): DOMElement static::getXsiTypeNamespaceURI()->getValue(), ); - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); + $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', $this->getXsiType()); $type->toXML($e); if ($this->getNameQualifier() !== null) { diff --git a/src/XML/saml/AbstractCondition.php b/src/XML/saml/AbstractCondition.php index 750f718aa7..9a0c2baba4 100644 --- a/src/XML/saml/AbstractCondition.php +++ b/src/XML/saml/AbstractCondition.php @@ -11,9 +11,10 @@ use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * SAML Condition data type. @@ -35,7 +36,7 @@ abstract class AbstractCondition extends AbstractConditionType implements /** * Initialize a custom saml:Condition element. * - * @param \SimpleSAML\XML\Type\QNameValue $type + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type */ protected function __construct( protected QNameValue $type, @@ -44,7 +45,7 @@ protected function __construct( /** - * @return \SimpleSAML\XML\Type\QNameValue + * @return \SimpleSAML\XMLSchema\Type\QNameValue */ public function getXsiType(): QNameValue { @@ -58,7 +59,7 @@ public function getXsiType(): QNameValue * @param \DOMElement $xml The root XML element * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -66,12 +67,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'Condition', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', SchemaViolationException::class, ); - $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); + $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); @@ -104,7 +105,7 @@ public function toXML(?DOMElement $parent = null): DOMElement static::getXsiTypeNamespaceURI()->getValue(), ); - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); + $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', $this->getXsiType()); $type->toXML($e); return $e; diff --git a/src/XML/saml/AbstractStatement.php b/src/XML/saml/AbstractStatement.php index 9db76f9731..1b165a55c0 100644 --- a/src/XML/saml/AbstractStatement.php +++ b/src/XML/saml/AbstractStatement.php @@ -11,9 +11,10 @@ use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Class implementing the extension point. @@ -35,7 +36,7 @@ abstract class AbstractStatement extends AbstractStatementType implements /** * Initialize a custom saml:Statement element. * - * @param \SimpleSAML\XML\Type\QNameValue $type + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type */ protected function __construct( protected QNameValue $type, @@ -44,7 +45,7 @@ protected function __construct( /** - * @return \SimpleSAML\XML\Type\QNameValue + * @return \SimpleSAML\XMLSchema\Type\QNameValue */ public function getXsiType(): QNameValue { @@ -58,7 +59,7 @@ public function getXsiType(): QNameValue * @param \DOMElement $xml The root XML element * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -66,12 +67,12 @@ public static function fromXML(DOMElement $xml): static Assert::same($xml->localName, 'Statement', InvalidDOMElementException::class); Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', SchemaViolationException::class, ); - $type = QNameValue::fromDocument($xml->getAttributeNS(C::NS_XSI, 'type'), $xml); + $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml); // now check if we have a handler registered for it $handler = Utils::getContainer()->getExtensionHandler($type); @@ -104,7 +105,7 @@ public function toXML(?DOMElement $parent = null): DOMElement static::getXsiTypeNamespaceURI()->getValue(), ); - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); + $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', $this->getXsiType()); $type->toXML($e); return $e; diff --git a/src/XML/saml/Action.php b/src/XML/saml/Action.php index 69cae0aae1..a17c222bfa 100644 --- a/src/XML/saml/Action.php +++ b/src/XML/saml/Action.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function strval; @@ -29,7 +29,7 @@ final class Action extends AbstractSamlElement * Initialize an Action. * * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $namespace - * NOTE: This attribute was marked REQUIRED in the 2012 SAML errata (E36) + * NOTE: The namespace-attribute was marked REQUIRED in the 2012 SAML errata (E36) * @param \SimpleSAML\SAML2\Type\SAMLStringValue $content */ public function __construct( @@ -57,7 +57,7 @@ public function getNamespace(): SAMLAnyURIValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/Advice.php b/src/XML/saml/Advice.php index 6a8a7cced0..7c824421ce 100644 --- a/src/XML/saml/Advice.php +++ b/src/XML/saml/Advice.php @@ -7,9 +7,9 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{ExtendableElementTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** * Class representing a saml:Advice element. @@ -23,7 +23,7 @@ final class Advice extends AbstractSamlElement implements SchemaValidatableEleme /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; /** @@ -110,7 +110,7 @@ public function getEncryptedAssertion(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/Assertion.php b/src/XML/saml/Assertion.php index a3f320ba86..4e49f560c0 100644 --- a/src/XML/saml/Assertion.php +++ b/src/XML/saml/Assertion.php @@ -11,9 +11,9 @@ use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\{EncryptableElementTrait, SignableElementTrait, SignedElementTrait}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\ds\Signature; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; @@ -62,7 +62,7 @@ final class Assertion extends AbstractSamlElement implements * Assertion constructor. * * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Subject|null $subject * @param \SimpleSAML\SAML2\XML\saml\Conditions|null $conditions @@ -143,7 +143,7 @@ public function getStatements(): array /** * Retrieve the identifier of this assertion. * - * @return \SimpleSAML\XML\Type\IDValue The identifier of this assertion. + * @return \SimpleSAML\XMLSchema\Type\IDValue The identifier of this assertion. */ public function getId(): IDValue { @@ -228,12 +228,14 @@ public function getEncryptionBackend(): ?EncryptionBackend * @return static * * @throws \SimpleSAML\Assert\AssertionFailedException if assertions are false - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\MissingElementException if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException if too many child-elements of a type are specified + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException + * if one of the mandatory child-elements is missing + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException + * if too many child-elements of a type are specified * @throws \Exception */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/AssertionIDRef.php b/src/XML/saml/AssertionIDRef.php index 77d1fbd735..8800df4f67 100644 --- a/src/XML/saml/AssertionIDRef.php +++ b/src/XML/saml/AssertionIDRef.php @@ -5,8 +5,8 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\NCNameValue; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\NCNameValue; /** * Class representing a saml:AssertionIDRef element. diff --git a/src/XML/saml/Attribute.php b/src/XML/saml/Attribute.php index a5018ae33d..e137f33444 100644 --- a/src/XML/saml/Attribute.php +++ b/src/XML/saml/Attribute.php @@ -9,10 +9,10 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\EncryptableElementTrait; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; @@ -33,7 +33,7 @@ class Attribute extends AbstractSamlElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** @@ -132,9 +132,9 @@ public function getEncryptionBackend(): ?EncryptionBackend * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/AttributeStatement.php b/src/XML/saml/AttributeStatement.php index d1becb4632..6f0e46b719 100644 --- a/src/XML/saml/AttributeStatement.php +++ b/src/XML/saml/AttributeStatement.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class representing a SAML2 AttributeStatement @@ -69,7 +69,7 @@ public function hasEncryptedAttributes(): bool * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/AttributeValue.php b/src/XML/saml/AttributeValue.php index abf1ea0918..35a2be4820 100644 --- a/src/XML/saml/AttributeValue.php +++ b/src/XML/saml/AttributeValue.php @@ -11,8 +11,9 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function class_exists; use function explode; @@ -97,7 +98,7 @@ public function getValue() * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -121,16 +122,16 @@ public static function fromXML(DOMElement $xml): static $value = Chunk::fromXML($node); } } elseif ( - $xml->hasAttributeNS(C::NS_XSI, "type") && - $xml->getAttributeNS(C::NS_XSI, "type") === "xs:integer" + $xml->hasAttributeNS(C_XSI::NS_XSI, "type") && + $xml->getAttributeNS(C_XSI::NS_XSI, "type") === "xs:integer" ) { Assert::numeric($xml->textContent); // we have an integer as value $value = intval($xml->textContent); } elseif ( - $xml->hasAttributeNS(C::NS_XSI, "type") && - $xml->getAttributeNS(C::NS_XSI, "type") === "xs:dateTime" + $xml->hasAttributeNS(C_XSI::NS_XSI, "type") && + $xml->getAttributeNS(C_XSI::NS_XSI, "type") === "xs:dateTime" ) { Assert::validDateTime($xml->textContent); @@ -138,9 +139,9 @@ public static function fromXML(DOMElement $xml): static $value = new DateTimeImmutable($xml->textContent); } elseif ( // null value - $xml->hasAttributeNS(C::NS_XSI, "nil") && - ($xml->getAttributeNS(C::NS_XSI, "nil") === "1" || - $xml->getAttributeNS(C::NS_XSI, "nil") === "true") + $xml->hasAttributeNS(C_XSI::NS_XSI, "nil") && + ($xml->getAttributeNS(C_XSI::NS_XSI, "nil") === "1" || + $xml->getAttributeNS(C_XSI::NS_XSI, "nil") === "true") ) { Assert::isEmpty($xml->nodeValue); Assert::isEmpty($xml->textContent); @@ -171,20 +172,20 @@ public function toXML(?DOMElement $parent = null): DOMElement switch ($type) { case "integer": // make sure that the xs namespace is available in the AttributeValue - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C::NS_XSI); - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xs', C::NS_XS); - $e->setAttributeNS(C::NS_XSI, 'xsi:type', 'xs:integer'); + $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C_XSI::NS_XSI); + $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xs', C_XSI::NS_XS); + $e->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'xs:integer'); $e->textContent = strval($value); break; case "NULL": - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C::NS_XSI); - $e->setAttributeNS(C::NS_XSI, 'xsi:nil', '1'); + $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C_XSI::NS_XSI); + $e->setAttributeNS(C_XSI::NS_XSI, 'xsi:nil', '1'); break; case "object": if ($value instanceof DateTimeInterface) { - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C::NS_XSI); - $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xs', C::NS_XS); - $e->setAttributeNS(C::NS_XSI, 'xsi:type', 'xs:dateTime'); + $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xsi', C_XSI::NS_XSI); + $e->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xs', C_XSI::NS_XS); + $e->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'xs:dateTime'); $e->textContent = $value->format(C::DATETIME_FORMAT); } else { $value->toXML($e); diff --git a/src/XML/saml/AudienceRestriction.php b/src/XML/saml/AudienceRestriction.php index 1a5a09efc4..b862d664db 100644 --- a/src/XML/saml/AudienceRestriction.php +++ b/src/XML/saml/AudienceRestriction.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; /** * SAML AudienceRestriction data type. @@ -51,7 +51,7 @@ public function getAudience(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/AuthnContext.php b/src/XML/saml/AuthnContext.php index 9b71c7549f..243b96684e 100644 --- a/src/XML/saml/AuthnContext.php +++ b/src/XML/saml/AuthnContext.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDecl, AuthnContextDeclRef}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; use function array_pop; use function is_null; @@ -106,7 +106,7 @@ public function getAuthenticatingAuthorities(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/AuthnContextDecl.php b/src/XML/saml/AuthnContextDecl.php index 3af15a86a1..2fe6e1bf89 100644 --- a/src/XML/saml/AuthnContextDecl.php +++ b/src/XML/saml/AuthnContextDecl.php @@ -6,14 +6,14 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{ ExtendableAttributesTrait, ExtendableElementTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait, - XsNamespace as NS, }; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** * Class representing SAML2 AuthnContextDecl @@ -28,10 +28,10 @@ final class AuthnContextDecl extends AbstractSamlElement implements SchemaValida /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::ANY; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Any; /** @@ -65,7 +65,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/AuthnStatement.php b/src/XML/saml/AuthnStatement.php index 4d31b39646..0ebf8d826f 100644 --- a/src/XML/saml/AuthnStatement.php +++ b/src/XML/saml/AuthnStatement.php @@ -7,7 +7,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use function array_pop; @@ -103,9 +103,9 @@ public function getSubjectLocality(): ?SubjectLocality * @param \DOMElement $xml The XML element we should load * * @return static - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing * @throws \Exception if the authentication instant is not a valid timestamp. */ diff --git a/src/XML/saml/AuthzDecisionStatement.php b/src/XML/saml/AuthzDecisionStatement.php index 63d433e749..20f2193594 100644 --- a/src/XML/saml/AuthzDecisionStatement.php +++ b/src/XML/saml/AuthzDecisionStatement.php @@ -8,14 +8,14 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\DecisionTypeValue; -use SimpleSAML\XML\Exception\{ +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{ InvalidDOMElementException, MissingElementException, SchemaViolationException, TooManyElementsException, }; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\AnyURIValue; use function array_pop; use function strval; @@ -33,7 +33,7 @@ final class AuthzDecisionStatement extends AbstractStatementType implements Sche /** * Initialize an AuthzDecisionStatement. * - * @param \SimpleSAML\XML\Type\AnyURIValue $resource + * @param \SimpleSAML\XMLSchema\Type\AnyURIValue $resource * @param \SimpleSAML\SAML2\Type\DecisionTypeValue $decision * @param \SimpleSAML\SAML2\XML\saml\Action[] $action * @param \SimpleSAML\SAML2\XML\saml\Evidence|null $evidence @@ -53,7 +53,7 @@ public function __construct( /** * Collect the value of the resource-property * - * @return \SimpleSAML\XML\Type\AnyURIValue + * @return \SimpleSAML\XMLSchema\Type\AnyURIValue */ public function getResource(): AnyURIValue { @@ -75,7 +75,7 @@ public function getDecision(): DecisionTypeValue /** * Collect the value of the action-property * - * @return array + * @return \SimpleSAML\SAML2\XML\saml\Action[] */ public function getAction(): array { @@ -100,9 +100,9 @@ public function getEvidence(): ?Evidence * @param \DOMElement $xml The XML element we should load * * @return static - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing * @throws \Exception if the authentication instant is not a valid timestamp. */ diff --git a/src/XML/saml/Conditions.php b/src/XML/saml/Conditions.php index fc6a372ab5..348c48cda2 100644 --- a/src/XML/saml/Conditions.php +++ b/src/XML/saml/Conditions.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_pop; @@ -137,7 +137,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/Evidence.php b/src/XML/saml/Evidence.php index a07e6beb90..fa4fdffca1 100644 --- a/src/XML/saml/Evidence.php +++ b/src/XML/saml/Evidence.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; /** * Class representing a saml:Evidence element. @@ -99,7 +99,7 @@ public function getEncryptedAssertion(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/NameIDType.php b/src/XML/saml/NameIDType.php index b108bd844a..4582034b68 100644 --- a/src/XML/saml/NameIDType.php +++ b/src/XML/saml/NameIDType.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function strval; @@ -75,7 +75,7 @@ public function getSPProvidedID(): ?SAMLStringValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/OneTimeUse.php b/src/XML/saml/OneTimeUse.php index 00998e986e..ba7839cf47 100644 --- a/src/XML/saml/OneTimeUse.php +++ b/src/XML/saml/OneTimeUse.php @@ -6,8 +6,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class representing a saml:OneTimeUse element. @@ -25,7 +25,7 @@ final class OneTimeUse extends AbstractConditionType implements SchemaValidatabl * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/ProxyRestriction.php b/src/XML/saml/ProxyRestriction.php index a83fdd7918..9ba95f18d5 100644 --- a/src/XML/saml/ProxyRestriction.php +++ b/src/XML/saml/ProxyRestriction.php @@ -7,9 +7,9 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\NonNegativeIntegerValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; /** * @package simplesamlphp/saml2 @@ -23,7 +23,7 @@ final class ProxyRestriction extends AbstractConditionType implements SchemaVali * ProxyRestriction constructor. * * @param \SimpleSAML\SAML2\XML\saml\Audience[] $audience - * @param \SimpleSAML\XML\Type\NonNegativeIntegerValue|null $count + * @param \SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue|null $count */ public function __construct( protected array $audience = [], @@ -37,7 +37,7 @@ public function __construct( /** * Get the value of the count-attribute. * - * @return \SimpleSAML\XML\Type\NonNegativeIntegerValue|null + * @return \SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue|null */ public function getCount(): ?NonNegativeIntegerValue { @@ -60,7 +60,7 @@ public function getAudience(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/Subject.php b/src/XML/saml/Subject.php index 03ab946ab8..06a636cadb 100644 --- a/src/XML/saml/Subject.php +++ b/src/XML/saml/Subject.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\IdentifierTrait; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; /** * Class representing SAML 2 Subject element. @@ -63,7 +63,7 @@ public function getSubjectConfirmation(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/SubjectConfirmation.php b/src/XML/saml/SubjectConfirmation.php index abcdf1bc4e..eb8989eb33 100644 --- a/src/XML/saml/SubjectConfirmation.php +++ b/src/XML/saml/SubjectConfirmation.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\IdentifierTrait; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; use function array_pop; @@ -68,11 +68,11 @@ public function getSubjectConfirmationData(): ?SubjectConfirmationData * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/SubjectConfirmationData.php b/src/XML/saml/SubjectConfirmationData.php index c122511769..da0fb8ebbd 100644 --- a/src/XML/saml/SubjectConfirmationData.php +++ b/src/XML/saml/SubjectConfirmationData.php @@ -9,11 +9,11 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\NCNameValue; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function strval; @@ -30,10 +30,10 @@ final class SubjectConfirmationData extends AbstractSamlElement implements Schem /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** @@ -42,7 +42,7 @@ final class SubjectConfirmationData extends AbstractSamlElement implements Schem * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notBefore * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notOnOrAfter * @param \SimpleSAML\SAML2\Type\EntityIDValue|null $recipient - * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $inResponseTo * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $address * @param \SimpleSAML\XML\SerializableElementInterface[] $children * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes @@ -112,7 +112,7 @@ public function getRecipient(): ?EntityIDValue /** * Collect the value of the InResponseTo-property * - * @return \SimpleSAML\XML\Type\NCNameValue|null + * @return \SimpleSAML\XMLSchema\Type\NCNameValue|null */ public function getInResponseTo(): ?NCNameValue { @@ -154,9 +154,9 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing any of the mandatory attributes * @throws \SimpleSAML\Assert\AssertionFailedException * if NotBefore or NotOnOrAfter contain an invalid date. diff --git a/src/XML/saml/SubjectLocality.php b/src/XML/saml/SubjectLocality.php index dfa91493bb..21c4b0f2d5 100644 --- a/src/XML/saml/SubjectLocality.php +++ b/src/XML/saml/SubjectLocality.php @@ -7,8 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{DomainValue, SAMLStringValue}; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class representing SAML2 SubjectLocality @@ -74,7 +74,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/saml/UnknownCondition.php b/src/XML/saml/UnknownCondition.php index a06b737f3f..cfa38df61e 100644 --- a/src/XML/saml/UnknownCondition.php +++ b/src/XML/saml/UnknownCondition.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Class for unknown conditions. @@ -17,7 +17,7 @@ final class UnknownCondition extends AbstractCondition { /** * @param \SimpleSAML\XML\Chunk $chunk The whole Condition element as a chunk object. - * @param \SimpleSAML\XML\Type\QNameValue $type The xsi:type of this condition. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi:type of this condition. */ public function __construct( protected Chunk $chunk, diff --git a/src/XML/saml/UnknownID.php b/src/XML/saml/UnknownID.php index 6678897046..9b44146615 100644 --- a/src/XML/saml/UnknownID.php +++ b/src/XML/saml/UnknownID.php @@ -7,7 +7,7 @@ use DOMElement; use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Class for unknown identifiers. @@ -18,7 +18,7 @@ final class UnknownID extends AbstractBaseID { /** * @param \SimpleSAML\XML\Chunk $chunk The whole BaseID element as a chunk object. - * @param \SimpleSAML\XML\Type\QNameValue $type The xsi:type of this identifier. + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi:type of this identifier. * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier */ diff --git a/src/XML/saml/UnknownStatement.php b/src/XML/saml/UnknownStatement.php index b7bf5913f8..1cd4ccd180 100644 --- a/src/XML/saml/UnknownStatement.php +++ b/src/XML/saml/UnknownStatement.php @@ -6,7 +6,7 @@ use DOMElement; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Class for unknown statements. @@ -17,7 +17,7 @@ final class UnknownStatement extends AbstractStatement { /** * @param \SimpleSAML\XML\Chunk $chunk The whole Statement element as a chunk object. - * @param \SimpleSAML\XML\Type\QNameValue $type The xsi:type of this statement + * @param \SimpleSAML\XMLSchema\Type\QNameValue $type The xsi:type of this statement */ public function __construct( protected Chunk $chunk, diff --git a/src/XML/samlp/AbstractMessage.php b/src/XML/samlp/AbstractMessage.php index fd5c883548..1f635dcf15 100644 --- a/src/XML/samlp/AbstractMessage.php +++ b/src/XML/samlp/AbstractMessage.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\{SignableElementTrait, SignedElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\{SignableElementInterface, SignedElementInterface}; use function array_pop; @@ -49,7 +49,7 @@ abstract class AbstractMessage extends AbstractSamlpElement implements SignableE * Initialize a message. * * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $issueInstant * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent @@ -72,7 +72,7 @@ protected function __construct( /** * Retrieve the identifier of this message. * - * @return \SimpleSAML\XML\Type\IDValue The identifier of this message + * @return \SimpleSAML\XMLSchema\Type\IDValue The identifier of this message */ public function getId(): IDValue { diff --git a/src/XML/samlp/AbstractStatusResponse.php b/src/XML/samlp/AbstractStatusResponse.php index 52b17c5cbc..d23a2157ba 100644 --- a/src/XML/samlp/AbstractStatusResponse.php +++ b/src/XML/samlp/AbstractStatusResponse.php @@ -8,7 +8,7 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; /** * Base class for all SAML 2 response messages. @@ -25,11 +25,11 @@ abstract class AbstractStatusResponse extends AbstractMessage /** * Constructor for SAML 2 response messages. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $inResponseTo * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions @@ -64,7 +64,7 @@ public function isSuccess(): bool /** * Retrieve the ID of the request this is a response to. * - * @return \SimpleSAML\XML\Type\NCNameValue|null The ID of the request. + * @return \SimpleSAML\XMLSchema\Type\NCNameValue|null The ID of the request. */ public function getInResponseTo(): ?NCNameValue { diff --git a/src/XML/samlp/AbstractSubjectQuery.php b/src/XML/samlp/AbstractSubjectQuery.php index 689f0b5367..18a0554089 100644 --- a/src/XML/samlp/AbstractSubjectQuery.php +++ b/src/XML/samlp/AbstractSubjectQuery.php @@ -8,7 +8,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; use SimpleSAML\SAML2\XML\saml\{Issuer, Subject}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Type\IDValue; /** * Base class for SAML 2 subject query messages. @@ -26,7 +26,7 @@ abstract class AbstractSubjectQuery extends AbstractRequest /** * Constructor for SAML 2 response messages. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject * @param \SimpleSAML\SAML2\XML\saml\Issuer $issuer * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant diff --git a/src/XML/samlp/Artifact.php b/src/XML/samlp/Artifact.php index 309ab54aff..a63fe21672 100644 --- a/src/XML/samlp/Artifact.php +++ b/src/XML/samlp/Artifact.php @@ -4,9 +4,9 @@ namespace SimpleSAML\SAML2\XML\samlp; -use SimpleSAML\XML\Type\Base64BinaryValue; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; /** * Class for SAML artifacts. diff --git a/src/XML/samlp/ArtifactResolve.php b/src/XML/samlp/ArtifactResolve.php index 1d933f99da..d3e022f945 100644 --- a/src/XML/samlp/ArtifactResolve.php +++ b/src/XML/samlp/ArtifactResolve.php @@ -9,9 +9,9 @@ use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -31,7 +31,7 @@ class ArtifactResolve extends AbstractRequest implements SchemaValidatableElemen /** * Initialize an ArtifactResolve. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Artifact $artifact * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer @@ -69,11 +69,11 @@ public function getArtifact(): Artifact * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/ArtifactResponse.php b/src/XML/samlp/ArtifactResponse.php index 616186e95b..ca720c3f65 100644 --- a/src/XML/samlp/ArtifactResponse.php +++ b/src/XML/samlp/ArtifactResponse.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -32,11 +32,11 @@ class ArtifactResponse extends AbstractStatusResponse implements SchemaValidatab /** * Constructor for SAML 2 ArtifactResponse. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $inResponseTo * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions @@ -83,9 +83,9 @@ public function getMessage(): ?AbstractMessage * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/AssertionIDRequest.php b/src/XML/samlp/AssertionIDRequest.php index f02dc293d4..69aaee5923 100644 --- a/src/XML/samlp/AssertionIDRequest.php +++ b/src/XML/samlp/AssertionIDRequest.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\XML\saml\{AssertionIDRef, Issuer}; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -29,7 +29,7 @@ final class AssertionIDRequest extends AbstractRequest implements SchemaValidata /** * Initialize an AssertionIDRequest. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\AssertionIDRef[] $assertionIDRef * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $issueInstant @@ -37,7 +37,7 @@ final class AssertionIDRequest extends AbstractRequest implements SchemaValidata * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException */ public function __construct( IDValue $id, @@ -77,7 +77,7 @@ public function getAssertionIDRef(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * If the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/AttributeQuery.php b/src/XML/samlp/AttributeQuery.php index 2d8d94489d..20276d9127 100644 --- a/src/XML/samlp/AttributeQuery.php +++ b/src/XML/samlp/AttributeQuery.php @@ -11,9 +11,9 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{Attribute, Issuer, Subject}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -42,7 +42,7 @@ class AttributeQuery extends AbstractSubjectQuery implements SchemaValidatableEl /** * Constructor for SAML 2 AttributeQuery. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Attribute[] $attributes @@ -101,13 +101,13 @@ public function getAttributes(): array * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/AuthnQuery.php b/src/XML/samlp/AuthnQuery.php index d01649c19d..860cc4a80a 100644 --- a/src/XML/samlp/AuthnQuery.php +++ b/src/XML/samlp/AuthnQuery.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{Issuer, Subject}; use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -31,7 +31,7 @@ final class AuthnQuery extends AbstractSubjectQuery implements SchemaValidatable /** * Constructor for SAML 2 AuthnQuery. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject * @param \SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext|null $requestedAuthnContext * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $sessionIndex @@ -84,13 +84,13 @@ public function getSessionIndex(): ?SAMLStringValue * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/AuthnRequest.php b/src/XML/samlp/AuthnRequest.php index 78905951a4..beac989bd5 100644 --- a/src/XML/samlp/AuthnRequest.php +++ b/src/XML/samlp/AuthnRequest.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{Conditions, Issuer, Subject}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{BooleanValue, IDValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, IDValue, UnsignedShortValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -31,18 +31,18 @@ class AuthnRequest extends AbstractRequest implements SchemaValidatableElementIn /** * Constructor for SAML 2 AuthnRequest * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext|null $requestedAuthnContext * @param \SimpleSAML\SAML2\XML\saml\Subject|null $subject * @param \SimpleSAML\SAML2\XML\samlp\NameIDPolicy|null $nameIdPolicy * @param \SimpleSAML\SAML2\XML\saml\Conditions|null $conditions - * @param \SimpleSAML\XML\Type\BooleanValue|null $forceAuthn - * @param \SimpleSAML\XML\Type\BooleanValue|null $isPassive + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $forceAuthn + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $isPassive * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $assertionConsumerServiceURL - * @param \SimpleSAML\XML\Type\UnsignedShortValue|null $assertionConsumerServiceIndex + * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue|null $assertionConsumerServiceIndex * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $protocolBinding - * @param \SimpleSAML\XML\Type\UnsignedShortValue|null $attributeConsumingServiceIndex + * @param \SimpleSAML\XMLSchema\Type\UnsignedShortValue|null $attributeConsumingServiceIndex * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $providerName * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination @@ -120,7 +120,6 @@ public function getConditions(): ?Conditions /** * Retrieve the NameIdPolicy. * - * @see \SimpleSAML\SAML2\AuthnRequest::setNameIdPolicy() * @return \SimpleSAML\SAML2\XML\samlp\NameIDPolicy|null The NameIdPolicy. */ public function getNameIdPolicy(): ?NameIDPolicy @@ -132,7 +131,7 @@ public function getNameIdPolicy(): ?NameIDPolicy /** * Retrieve the value of the ForceAuthn attribute. * - * @return \SimpleSAML\XML\Type\BooleanValue|null The ForceAuthn attribute. + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null The ForceAuthn attribute. */ public function getForceAuthn(): ?BooleanValue { @@ -154,7 +153,7 @@ public function getProviderName(): ?SAMLStringValue /** * Retrieve the value of the IsPassive attribute. * - * @return \SimpleSAML\XML\Type\BooleanValue|null The IsPassive attribute. + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null The IsPassive attribute. */ public function getIsPassive(): ?BooleanValue { @@ -187,7 +186,7 @@ public function getProtocolBinding(): ?SAMLAnyURIValue /** * Retrieve the value of the AttributeConsumingServiceIndex attribute. * - * @return \SimpleSAML\XML\Type\UnsignedShortValue|null The AttributeConsumingServiceIndex attribute. + * @return \SimpleSAML\XMLSchema\Type\UnsignedShortValue|null The AttributeConsumingServiceIndex attribute. */ public function getAttributeConsumingServiceIndex(): ?UnsignedShortValue { @@ -198,7 +197,7 @@ public function getAttributeConsumingServiceIndex(): ?UnsignedShortValue /** * Retrieve the value of the AssertionConsumerServiceIndex attribute. * - * @return \SimpleSAML\XML\Type\UnsignedShortValue|null The AssertionConsumerServiceIndex attribute. + * @return \SimpleSAML\XMLSchema\Type\UnsignedShortValue|null The AssertionConsumerServiceIndex attribute. */ public function getAssertionConsumerServiceIndex(): ?UnsignedShortValue { @@ -223,11 +222,11 @@ public function getRequestedAuthnContext(): ?RequestedAuthnContext * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/AuthzDecisionQuery.php b/src/XML/samlp/AuthzDecisionQuery.php index 3c3e46566a..54eb282cf3 100644 --- a/src/XML/samlp/AuthzDecisionQuery.php +++ b/src/XML/samlp/AuthzDecisionQuery.php @@ -10,14 +10,14 @@ use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{Action, Evidence, Issuer, Subject}; -use SimpleSAML\XML\Exception\{ +use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{ InvalidDOMElementException, MissingElementException, SchemaViolationException, TooManyElementsException, }; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function version_compare; @@ -35,7 +35,7 @@ final class AuthzDecisionQuery extends AbstractSubjectQuery implements SchemaVal /** * Constructor for SAML 2 AuthzDecisionQuery. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\Subject $subject * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue $resource * @param \SimpleSAML\SAML2\XML\saml\Action[] $action @@ -104,9 +104,9 @@ public function getEvidence(): ?Evidence * @param \DOMElement $xml The XML element we should load * * @return static - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing * @throws \Exception if the authentication instant is not a valid timestamp. */ diff --git a/src/XML/samlp/Extensions.php b/src/XML/samlp/Extensions.php index 05230e1e61..4ad6481e03 100644 --- a/src/XML/samlp/Extensions.php +++ b/src/XML/samlp/Extensions.php @@ -9,8 +9,8 @@ use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\ExtensionsTrait; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** * Class for handling SAML2 extensions. @@ -32,7 +32,7 @@ final class Extensions extends AbstractSamlpElement implements SchemaValidatable * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/IDPEntry.php b/src/XML/samlp/IDPEntry.php index fbbed9000f..c0add5e7f8 100644 --- a/src/XML/samlp/IDPEntry.php +++ b/src/XML/samlp/IDPEntry.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_change_key_case; use function array_filter; @@ -74,9 +74,9 @@ public function getLoc(): ?SAMLAnyURIValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/IDPList.php b/src/XML/samlp/IDPList.php index ee2fa1b22a..18b9128e35 100644 --- a/src/XML/samlp/IDPList.php +++ b/src/XML/samlp/IDPList.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use function array_change_key_case; use function array_filter; @@ -67,11 +67,11 @@ public function getGetComplete(): ?GetComplete * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/LogoutRequest.php b/src/XML/samlp/LogoutRequest.php index 1626bd06e6..0edfb52453 100644 --- a/src/XML/samlp/LogoutRequest.php +++ b/src/XML/samlp/LogoutRequest.php @@ -11,9 +11,9 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\IdentifierTrait; use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, EncryptedID, IdentifierInterface, Issuer, NameID}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -32,7 +32,7 @@ final class LogoutRequest extends AbstractRequest implements SchemaValidatableEl /** * Constructor for SAML 2 AttributeQuery. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\saml\IdentifierInterface $identifier * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $notOnOrAfter @@ -105,13 +105,13 @@ public function getSessionIndexes(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/LogoutResponse.php b/src/XML/samlp/LogoutResponse.php index d6ffea9650..fe0ea8bb09 100644 --- a/src/XML/samlp/LogoutResponse.php +++ b/src/XML/samlp/LogoutResponse.php @@ -9,9 +9,9 @@ use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; @@ -30,11 +30,11 @@ final class LogoutResponse extends AbstractStatusResponse implements SchemaValid /** * Constructor for SAML 2 LogoutResponse. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $inResponseTo * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions|null $extensions @@ -70,9 +70,9 @@ public function __construct( * @param \DOMElement $xml * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/MessageFactory.php b/src/XML/samlp/MessageFactory.php index d173528a7d..01f0586b42 100644 --- a/src/XML/samlp/MessageFactory.php +++ b/src/XML/samlp/MessageFactory.php @@ -7,7 +7,7 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function var_export; @@ -24,7 +24,7 @@ abstract class MessageFactory * @param \DOMElement $xml The root XML element * @return \SimpleSAML\SAML2\XML\samlp\AbstractMessage The message * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): AbstractMessage diff --git a/src/XML/samlp/NameIDPolicy.php b/src/XML/samlp/NameIDPolicy.php index 6341078da2..565ec35cd9 100644 --- a/src/XML/samlp/NameIDPolicy.php +++ b/src/XML/samlp/NameIDPolicy.php @@ -9,9 +9,9 @@ use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function array_change_key_case; use function array_filter; @@ -36,7 +36,7 @@ final class NameIDPolicy extends AbstractSamlpElement implements * * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $Format * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier - * @param \SimpleSAML\XML\Type\BooleanValue|null $AllowCreate + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $AllowCreate */ public function __construct( protected ?SAMLAnyURIValue $Format = null, @@ -65,7 +65,7 @@ public function getSPNameQualifier(): ?SAMLStringValue /** - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function getAllowCreate(): ?BooleanValue { @@ -92,7 +92,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/RequestedAuthnContext.php b/src/XML/samlp/RequestedAuthnContext.php index 25b842b0d3..12f80b3e83 100644 --- a/src/XML/samlp/RequestedAuthnContext.php +++ b/src/XML/samlp/RequestedAuthnContext.php @@ -10,8 +10,8 @@ use SimpleSAML\SAML2\Type\{AuthnContextComparisonTypeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; use function array_merge; use function strval; @@ -93,7 +93,7 @@ public function getComparison(): ?AuthnContextComparisonTypeValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/Response.php b/src/XML/samlp/Response.php index e08c722ee7..54db4b1ced 100644 --- a/src/XML/samlp/Response.php +++ b/src/XML/samlp/Response.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\saml\{Assertion, EncryptedAssertion, Issuer}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_merge; @@ -32,11 +32,11 @@ class Response extends AbstractStatusResponse implements SchemaValidatableElemen /** * Constructor for SAML 2 response messages. * - * @param \SimpleSAML\XML\Type\IDValue $id + * @param \SimpleSAML\XMLSchema\Type\IDValue $id * @param \SimpleSAML\SAML2\XML\samlp\Status $status * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue $issueInstant * @param \SimpleSAML\SAML2\XML\saml\Issuer|null $issuer - * @param \SimpleSAML\XML\Type\NCNameValue|null $inResponseTo + * @param \SimpleSAML\XMLSchema\Type\NCNameValue|null $inResponseTo * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $destination * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $consent * @param \SimpleSAML\SAML2\XML\samlp\Extensions $extensions @@ -86,11 +86,11 @@ public function getAssertions(): array * @param \DOMElement $xml The input message. * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/Scoping.php b/src/XML/samlp/Scoping.php index 8af219da97..58b5ba9cc1 100644 --- a/src/XML/samlp/Scoping.php +++ b/src/XML/samlp/Scoping.php @@ -7,9 +7,9 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\NonNegativeIntegerValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function array_pop; use function strval; @@ -27,7 +27,7 @@ final class Scoping extends AbstractSamlpElement implements SchemaValidatableEle /** * Initialize a Scoping element. * - * @param \SimpleSAML\XML\Type\NonNegativeIntegerValue|null $proxyCount + * @param \SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue|null $proxyCount * @param \SimpleSAML\SAML2\XML\samlp\IDPList|null $IDPList * @param \SimpleSAML\SAML2\XML\samlp\RequesterID[] $requesterId */ @@ -60,7 +60,7 @@ public function getRequesterId(): array /** - * @return \SimpleSAML\XML\Type\NonNegativeIntegerValue|null + * @return \SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue|null */ public function getProxyCount(): ?NonNegativeIntegerValue { @@ -87,7 +87,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/Status.php b/src/XML/samlp/Status.php index 7027e5eac8..fc0c21a329 100644 --- a/src/XML/samlp/Status.php +++ b/src/XML/samlp/Status.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use function array_pop; use function strval; @@ -91,11 +91,11 @@ public function getStatusDetails(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\TooManyElementsException + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException * if too many child-elements of a type are specified - * @throws \SimpleSAML\XML\Exception\MissingElementException + * @throws \SimpleSAML\XMLSchema\Exception\MissingElementException * if one of the mandatory child-elements is missing */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/StatusCode.php b/src/XML/samlp/StatusCode.php index c8d1af69cd..d730c15faf 100644 --- a/src/XML/samlp/StatusCode.php +++ b/src/XML/samlp/StatusCode.php @@ -8,8 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function strval; @@ -66,9 +66,9 @@ public function getSubCodes(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong - * @throws \SimpleSAML\XML\Exception\MissingAttributeException + * @throws \SimpleSAML\XMLSchema\Exception\MissingAttributeException * if the supplied element is missing one of the mandatory attributes */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/samlp/StatusDetail.php b/src/XML/samlp/StatusDetail.php index 7f1d00f10b..d9d782c74f 100644 --- a/src/XML/samlp/StatusDetail.php +++ b/src/XML/samlp/StatusDetail.php @@ -6,9 +6,9 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{ExtendableElementTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** * SAML StatusDetail data type. @@ -22,7 +22,7 @@ final class StatusDetail extends AbstractSamlpElement implements SchemaValidatab /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::ANY; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; /** @@ -53,7 +53,7 @@ public function isEmptyElement(): bool * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/shibmd/KeyAuthority.php b/src/XML/shibmd/KeyAuthority.php index e812ed59f2..63a6a71901 100644 --- a/src/XML/shibmd/KeyAuthority.php +++ b/src/XML/shibmd/KeyAuthority.php @@ -7,10 +7,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\UnsignedByteValue; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\UnsignedByteValue; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; use function strval; @@ -28,14 +28,14 @@ final class KeyAuthority extends AbstractShibmdElement implements SchemaValidata /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; + public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; /** * Create a KeyAuthority. * * @param \SimpleSAML\XMLSecurity\XML\ds\KeyInfo[] $keys - * @param \SimpleSAML\XML\Type\UnsignedByteValue|null $VerifyDepth + * @param \SimpleSAML\XMLSchema\Type\UnsignedByteValue|null $VerifyDepth * @param list<\SimpleSAML\XML\Attribute> $namespacedAttributes */ public function __construct( @@ -52,7 +52,7 @@ public function __construct( /** * Collect the value of the VerifyDepth-property * - * @return \SimpleSAML\XML\Type\UnsignedByteValue|null + * @return \SimpleSAML\XMLSchema\Type\UnsignedByteValue|null */ public function getVerifyDepth(): UnsignedByteValue|null { @@ -77,7 +77,7 @@ public function getKeys(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/src/XML/shibmd/Scope.php b/src/XML/shibmd/Scope.php index 2d7a287308..0cc3ff1f83 100644 --- a/src/XML/shibmd/Scope.php +++ b/src/XML/shibmd/Scope.php @@ -7,10 +7,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\Exception\InvalidDOMElementException; use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XML\Type\BooleanValue; use SimpleSAML\XML\TypedTextContentTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; /** * Class which represents the Scope element found in Shibboleth metadata. @@ -31,7 +31,7 @@ final class Scope extends AbstractShibmdElement implements SchemaValidatableElem * Create a Scope. * * @param \SimpleSAML\SAML2\Type\SAMLStringValue $scope - * @param \SimpleSAML\XML\Type\BooleanValue|null $regexp + * @param \SimpleSAML\XMLSchema\Type\BooleanValue|null $regexp */ public function __construct( SAMLStringValue $scope, @@ -44,7 +44,7 @@ public function __construct( /** * Collect the value of the regexp-property * - * @return \SimpleSAML\XML\Type\BooleanValue|null + * @return \SimpleSAML\XMLSchema\Type\BooleanValue|null */ public function isRegexpScope(): ?BooleanValue { @@ -58,7 +58,7 @@ public function isRegexpScope(): ?BooleanValue * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static diff --git a/tests/SAML2/Assert/EntityIDTest.php b/tests/SAML2/Assert/EntityIDTest.php index 1ceb4c94cf..920dd22083 100644 --- a/tests/SAML2/Assert/EntityIDTest.php +++ b/tests/SAML2/Assert/EntityIDTest.php @@ -9,7 +9,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use function str_pad; diff --git a/tests/SAML2/Assert/SAMLAnyURITest.php b/tests/SAML2/Assert/SAMLAnyURITest.php index f544762af0..6694a0d5a9 100644 --- a/tests/SAML2/Assert/SAMLAnyURITest.php +++ b/tests/SAML2/Assert/SAMLAnyURITest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\SAML2\Assert\SAMLAnyURITest diff --git a/tests/SAML2/Assert/SAMLDateTimeTest.php b/tests/SAML2/Assert/SAMLDateTimeTest.php index 44b976830b..778a773c9f 100644 --- a/tests/SAML2/Assert/SAMLDateTimeTest.php +++ b/tests/SAML2/Assert/SAMLDateTimeTest.php @@ -9,7 +9,7 @@ use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\SAML2\Assert\SAMLDateTimeTest diff --git a/tests/SAML2/Assert/SAMLStringTest.php b/tests/SAML2/Assert/SAMLStringTest.php index 8e5af044c2..4db2d04cd2 100644 --- a/tests/SAML2/Assert/SAMLStringTest.php +++ b/tests/SAML2/Assert/SAMLStringTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\SAML2\Assert\SAMLStringTest diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php index 74227605b9..9f93a6ad58 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php @@ -14,7 +14,7 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; use SimpleSAML\SAML2\XML\samlp\Response; -use SimpleSAML\XML\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; /** * @package simplesamlphp/saml2 diff --git a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php index 46868fc154..1a82867a26 100644 --- a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php +++ b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php @@ -21,7 +21,8 @@ use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Type\IDValue; /** * Tests for the SubjectConfirmation validators @@ -89,8 +90,8 @@ public static function setUpBeforeClass(): void self::$response, ); - $ns_xsi = C::NS_XSI; - $ns_xs = C::NS_XS; + $ns_xsi = C_XSI::NS_XSI; + $ns_xs = C_XSI::NS_XS; $ns_saml = C::NS_SAML; $nameid_persistent = C::NAMEID_PERSISTENT; $entity_idp = C::ENTITY_IDP; diff --git a/tests/SAML2/Binding/SOAPTest.php b/tests/SAML2/Binding/SOAPTest.php index ba202d93f9..746eaa39a6 100644 --- a/tests/SAML2/Binding/SOAPTest.php +++ b/tests/SAML2/Binding/SOAPTest.php @@ -12,9 +12,9 @@ use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\ecp\{RequestAuthenticated, Response}; use SimpleSAML\SAML2\XML\samlp\{ArtifactResolve, MessageFactory}; -use SimpleSAML\SOAP\Constants as C; +use SimpleSAML\SOAP11\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Type\BooleanValue; use function dirname; @@ -87,7 +87,7 @@ public function testSendArtifactResponse(): void SOAP); /** @var \DOMElement $body */ - $body = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV_11, 'Body')->item(0); + $body = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV, 'Body')->item(0); $message->toXML($body); $soap = new SOAP(); @@ -111,7 +111,7 @@ public function testSendResponse(): void SOAP); $requestAuthenticated = new RequestAuthenticated( - BooleanValue::fromBoolean(true), + MustUnderstandValue::fromBoolean(true), ); $ecpResponse = new Response( SAMLAnyURIValue::fromString('https://example.org/metadata'), @@ -119,12 +119,12 @@ public function testSendResponse(): void /** @var \DOMElement $header */ - $header = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV_11, 'Header')->item(0); + $header = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV, 'Header')->item(0); $requestAuthenticated->toXML($header); $ecpResponse->toXML($header); /** @var \DOMElement $body */ - $body = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV_11, 'Body')->item(0); + $body = $doc->getElementsByTagNameNS(C::NS_SOAP_ENV, 'Body')->item(0); $message->toXML($body); $soap = new SOAP(); diff --git a/tests/SAML2/CustomBaseID.php b/tests/SAML2/CustomBaseID.php index 7ecd4937b7..db19defb9d 100644 --- a/tests/SAML2/CustomBaseID.php +++ b/tests/SAML2/CustomBaseID.php @@ -9,8 +9,9 @@ use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, Audience}; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, SchemaViolationException}; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Example class to demonstrate how BaseID can be extended. @@ -73,12 +74,12 @@ public static function fromXML(DOMElement $xml): static Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AbstractBaseID::NS, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', SchemaViolationException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); + $type = $xml->getAttributeNS(C_XSI::NS_XSI, 'type'); Assert::same($type, self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); return new static( diff --git a/tests/SAML2/CustomCondition.php b/tests/SAML2/CustomCondition.php index 1c4736b396..2059ab137a 100644 --- a/tests/SAML2/CustomCondition.php +++ b/tests/SAML2/CustomCondition.php @@ -8,8 +8,9 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\{AbstractCondition, Audience}; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Example class to demonstrate how Condition can be extended. @@ -63,7 +64,7 @@ public function getAudience(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -72,12 +73,12 @@ public static function fromXML(DOMElement $xml): static Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AbstractCondition::NS, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', InvalidDOMElementException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); + $type = $xml->getAttributeNS(C_XSI::NS_XSI, 'type'); Assert::same($type, self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); $audience = Audience::getChildrenOfClass($xml); diff --git a/tests/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index 63b779d8bb..66236fa9f1 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -18,9 +18,10 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; -use SimpleSAML\XML\Type\{DurationValue, IDValue, QNameValue}; -use SimpleSAML\XML\XsNamespace as NS; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, QNameValue}; +use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** * Example class to demonstrate how RoleDescriptor can be extended. @@ -41,7 +42,7 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor protected const XSI_TYPE_PREFIX = 'ssp'; /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NS::OTHER; + public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; /** * CustomRoleDescriptor constructor. @@ -49,10 +50,10 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor * @param \SimpleSAML\XML\SerializableElementInterface[] $chunk * @param \SimpleSAML\SAML2\Type\AnyURIListValue $protocolSupportEnumeration * A set of URI specifying the protocols supported. - * @param \SimpleSAML\XML\Type\IDValue|null $ID The ID for this document. Defaults to null. + * @param \SimpleSAML\XMLSchema\Type\IDValue|null $ID The ID for this document. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLDateTimeValue|null $validUntil Unix time of validity for this document. * Defaults to null. - * @param \SimpleSAML\XML\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. + * @param \SimpleSAML\XMLSchema\Type\DurationValue|null $cacheDuration Maximum time this document can be cached. * Defaults to null. * @param \SimpleSAML\SAML2\XML\md\Extensions|null $extensions An Extensions object. Defaults to null. * @param \SimpleSAML\SAML2\Type\SAMLAnyURIValue|null $errorURL An URI where to redirect users for support. @@ -116,7 +117,7 @@ public function getChunk(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -125,12 +126,12 @@ public static function fromXML(DOMElement $xml): static Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AbstractRoleDescriptor::NS, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', InvalidDOMElementException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); + $type = $xml->getAttributeNS(C_XSI::NS_XSI, 'type'); Assert::same($type, self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); $orgs = Organization::getChildrenOfClass($xml); @@ -186,7 +187,7 @@ public function toUnsignedXML(?DOMElement $parent = null): DOMElement } if (!$e->lookupPrefix('xsi')) { - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', $this->getXsiType()); + $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', $this->getXsiType()); $type->toXML($e); } diff --git a/tests/SAML2/CustomStatement.php b/tests/SAML2/CustomStatement.php index a60ba31ed2..e43f4bcc5d 100644 --- a/tests/SAML2/CustomStatement.php +++ b/tests/SAML2/CustomStatement.php @@ -8,8 +8,9 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\saml\{AbstractStatement, Audience}; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\Exception\InvalidDOMElementException; -use SimpleSAML\XML\Type\QNameValue; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Example class to demonstrate how Statement can be extended. @@ -63,7 +64,7 @@ public function getAudience(): array * @param \DOMElement $xml The XML element we should load * @return static * - * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException + * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException * if the qualified name of the supplied element is wrong */ public static function fromXML(DOMElement $xml): static @@ -72,12 +73,12 @@ public static function fromXML(DOMElement $xml): static Assert::notNull($xml->namespaceURI, InvalidDOMElementException::class); Assert::same($xml->namespaceURI, AbstractStatement::NS, InvalidDOMElementException::class); Assert::true( - $xml->hasAttributeNS(C::NS_XSI, 'type'), + $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'), 'Missing required xsi:type in element.', InvalidDOMElementException::class, ); - $type = $xml->getAttributeNS(C::NS_XSI, 'type'); + $type = $xml->getAttributeNS(C_XSI::NS_XSI, 'type'); Assert::same($type, self::XSI_TYPE_PREFIX . ':' . self::XSI_TYPE_NAME); $audience = Audience::getChildrenOfClass($xml); diff --git a/tests/SAML2/Type/AnyURIListValueTest.php b/tests/SAML2/Type/AnyURIListValueTest.php index d8ca6dbe09..64188943a0 100644 --- a/tests/SAML2/Type/AnyURIListValueTest.php +++ b/tests/SAML2/Type/AnyURIListValueTest.php @@ -7,7 +7,7 @@ use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\AnyURIListValue; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\AnyURIListTest diff --git a/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php b/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php index 2c09ab076e..a04c272dfa 100644 --- a/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php +++ b/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php @@ -6,27 +6,27 @@ use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DependsOnClass}; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\AuthnContextComparisonValue; -use SimpleSAML\SAML2\XML\saml\AuthnContextComparisonEnum; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; +use SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\AuthnContextComparisonValueTest * * @package simplesamlphp/saml2 */ -#[CoversClass(AuthnContextComparisonValue::class)] -final class AuthnContextComparisonValueTest extends TestCase +#[CoversClass(AuthnContextComparisonTypeValue::class)] +final class AuthnContextComparisonTypeValueTest extends TestCase { /** - * @param string $AuthnContextComparison + * @param string $authnContextComparison * @param bool $shouldPass */ #[DataProvider('provideAuthnContextComparison')] - public function testAuthnContextComparisonValue(string $authnContextComparison, bool $shouldPass): void + public function testAuthnContextComparisonTypeValue(string $authnContextComparison, bool $shouldPass): void { try { - AuthnContextComparisonValue::fromString($authnContextComparison); + AuthnContextComparisonTypeValue::fromString($authnContextComparison); $this->assertTrue($shouldPass); } catch (SchemaViolationException $e) { $this->assertFalse($shouldPass); @@ -39,11 +39,11 @@ public function testAuthnContextComparisonValue(string $authnContextComparison, */ public function testHelpers(): void { - $x = AuthnContextComparisonValue::fromEnum(AuthnContextComparisonEnum::Exact); - $this->assertEquals(AuthnContextComparisonEnum::Exact, $x->toEnum()); + $x = AuthnContextComparisonTypeValue::fromEnum(AuthnContextComparisonTypeEnum::Exact); + $this->assertEquals(AuthnContextComparisonTypeEnum::Exact, $x->toEnum()); - $y = AuthnContextComparisonValue::fromString('exact'); - $this->assertEquals(AuthnContextComparisonEnum::Exact, $y->toEnum()); + $y = AuthnContextComparisonTypeValue::fromString('exact'); + $this->assertEquals(AuthnContextComparisonTypeEnum::Exact, $y->toEnum()); } diff --git a/tests/SAML2/Type/DecisionTypeValueTest.php b/tests/SAML2/Type/DecisionTypeValueTest.php index f261610a4f..83ca14da84 100644 --- a/tests/SAML2/Type/DecisionTypeValueTest.php +++ b/tests/SAML2/Type/DecisionTypeValueTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\DecisionTypeValue; use SimpleSAML\SAML2\XML\saml\DecisionTypeEnum; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\DecisionTypeValueTest diff --git a/tests/SAML2/Type/EntityIDValueTest.php b/tests/SAML2/Type/EntityIDValueTest.php index 7a44cd38c7..324299496a 100644 --- a/tests/SAML2/Type/EntityIDValueTest.php +++ b/tests/SAML2/Type/EntityIDValueTest.php @@ -9,7 +9,7 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\EntityIDValueTest diff --git a/tests/SAML2/Type/ListOfStringsValueTest.php b/tests/SAML2/Type/ListOfStringsValueTest.php index e4439bc4ae..a6c4eab1f9 100644 --- a/tests/SAML2/Type/ListOfStringsValueTest.php +++ b/tests/SAML2/Type/ListOfStringsValueTest.php @@ -6,8 +6,8 @@ use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass, Group}; use PHPUnit\Framework\TestCase; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\SAML2\Type\ListOfStringsValue; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\ListOfStringsTest diff --git a/tests/SAML2/Type/SAMLAnyURIValueTest.php b/tests/SAML2/Type/SAMLAnyURIValueTest.php index 217d457df4..fd17e8a743 100644 --- a/tests/SAML2/Type/SAMLAnyURIValueTest.php +++ b/tests/SAML2/Type/SAMLAnyURIValueTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\AnyURIValueTest diff --git a/tests/SAML2/Type/SAMLDateTimeValueTest.php b/tests/SAML2/Type/SAMLDateTimeValueTest.php index 5bfb5ab1eb..d84ddcbf6b 100644 --- a/tests/SAML2/Type/SAMLDateTimeValueTest.php +++ b/tests/SAML2/Type/SAMLDateTimeValueTest.php @@ -9,7 +9,7 @@ use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\SAMLDateTimeValueTest diff --git a/tests/SAML2/Type/SAMLStringValueTest.php b/tests/SAML2/Type/SAMLStringValueTest.php index 90727d9890..826e226858 100644 --- a/tests/SAML2/Type/SAMLStringValueTest.php +++ b/tests/SAML2/Type/SAMLStringValueTest.php @@ -8,7 +8,7 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class \SimpleSAML\Test\SAML2\Type\SAMLStringValueValueTest diff --git a/tests/SAML2/XML/alg/DigestMethodTest.php b/tests/SAML2/XML/alg/DigestMethodTest.php index 962fbbb7b4..722b816484 100644 --- a/tests/SAML2/XML/alg/DigestMethodTest.php +++ b/tests/SAML2/XML/alg/DigestMethodTest.php @@ -10,7 +10,7 @@ use SimpleSAML\SAML2\XML\alg\{AbstractAlgElement, DigestMethod}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; diff --git a/tests/SAML2/XML/alg/SigningMethodTest.php b/tests/SAML2/XML/alg/SigningMethodTest.php index 813adc6997..8eaee24385 100644 --- a/tests/SAML2/XML/alg/SigningMethodTest.php +++ b/tests/SAML2/XML/alg/SigningMethodTest.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\XML\alg\{AbstractAlgElement, SigningMethod}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\PositiveIntegerValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/ecp/RelayStateTest.php b/tests/SAML2/XML/ecp/RelayStateTest.php index 2fc870bcd7..0c75be5eb8 100644 --- a/tests/SAML2/XML/ecp/RelayStateTest.php +++ b/tests/SAML2/XML/ecp/RelayStateTest.php @@ -8,10 +8,10 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, RelayState}; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; use function strval; @@ -60,7 +60,7 @@ public function testMarshalling(): void public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'mustUnderstand'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'mustUnderstand'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:mustUnderstand attribute in .'); @@ -74,7 +74,7 @@ public function testUnmarshallingWithMissingMustUnderstandThrowsException(): voi public function testUnmarshallingWithMissingActorThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'actor'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'actor'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:actor attribute in .'); diff --git a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php index 23718034c1..f0b09f80e3 100644 --- a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php +++ b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php @@ -7,11 +7,11 @@ use PHPUnit\Framework\Attributes\{CoversClass, Group}; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, RequestAuthenticated}; -use SimpleSAML\SOAP\Constants as C; +use SimpleSAML\SOAP11\Constants as C; +use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; use function strval; @@ -45,7 +45,7 @@ public static function setUpBeforeClass(): void public function testMarshalling(): void { $ra = new RequestAuthenticated( - BooleanValue::fromBoolean(false), + MustUnderstandValue::fromBoolean(false), ); $this->assertEquals( @@ -60,7 +60,7 @@ public function testMarshalling(): void public function testUnmarshallingWithMissingActorThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(C::NS_SOAP_ENV_11, 'actor'); + $document->removeAttributeNS(C::NS_SOAP_ENV, 'actor'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:actor attribute in .'); diff --git a/tests/SAML2/XML/ecp/RequestTest.php b/tests/SAML2/XML/ecp/RequestTest.php index a2e733d3d2..c360e07497 100644 --- a/tests/SAML2/XML/ecp/RequestTest.php +++ b/tests/SAML2/XML/ecp/RequestTest.php @@ -10,11 +10,11 @@ use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, Request}; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\{GetComplete, IDPEntry, IDPList}; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; use function strval; @@ -88,7 +88,7 @@ public function testMarshalling(): void public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'mustUnderstand'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'mustUnderstand'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:mustUnderstand attribute in .'); @@ -102,7 +102,7 @@ public function testUnmarshallingWithMissingMustUnderstandThrowsException(): voi public function testUnmarshallingWithMissingActorThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'actor'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'actor'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:actor attribute in .'); diff --git a/tests/SAML2/XML/ecp/ResponseTest.php b/tests/SAML2/XML/ecp/ResponseTest.php index 46595bf9fb..bf38531664 100644 --- a/tests/SAML2/XML/ecp/ResponseTest.php +++ b/tests/SAML2/XML/ecp/ResponseTest.php @@ -10,10 +10,10 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, Response}; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; use function strval; @@ -81,7 +81,7 @@ public function testToXMLResponseAppended(): void public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'mustUnderstand'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'mustUnderstand'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:mustUnderstand attribute in .'); @@ -95,7 +95,7 @@ public function testUnmarshallingWithMissingMustUnderstandThrowsException(): voi public function testUnmarshallingWithMissingActorThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'actor'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'actor'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:actor attribute in .'); diff --git a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php index bea6e7f778..ddd56ec3be 100644 --- a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php @@ -9,13 +9,13 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, SubjectConfirmation}; use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; -use SimpleSAML\SOAP\Constants as SOAP; +use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{IDValue, NCNameValue, StringValue}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue, StringValue}; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; @@ -96,7 +96,7 @@ public function testMarshalling(): void public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'mustUnderstand'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'mustUnderstand'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:mustUnderstand attribute in .'); @@ -110,7 +110,7 @@ public function testUnmarshallingWithMissingMustUnderstandThrowsException(): voi public function testUnmarshallingWithMissingActorThrowsException(): void { $document = clone self::$xmlRepresentation->documentElement; - $document->removeAttributeNS(SOAP::NS_SOAP_ENV_11, 'actor'); + $document->removeAttributeNS(SOAP::NS_SOAP_ENV, 'actor'); $this->expectException(MissingAttributeException::class); $this->expectExceptionMessage('Missing env:actor attribute in .'); diff --git a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php index c3ff8d8036..47f12eed7e 100644 --- a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php +++ b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php @@ -14,7 +14,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php index 97ca835d96..8c5a5104f0 100644 --- a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php +++ b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceDescription}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\{MissingAttributeException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, SchemaViolationException}; use function dirname; diff --git a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php index b0eff1b698..bc5d72c18b 100644 --- a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php +++ b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php @@ -10,8 +10,8 @@ use SimpleSAML\SAML2\XML\md\{AbstractMdElement, AdditionalMetadataLocation}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AffiliationDescriptorTest.php b/tests/SAML2/XML/md/AffiliationDescriptorTest.php index 62810bb0e8..ec7e87dfb8 100644 --- a/tests/SAML2/XML/md/AffiliationDescriptorTest.php +++ b/tests/SAML2/XML/md/AffiliationDescriptorTest.php @@ -20,9 +20,9 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; diff --git a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php index 1e7d7bb001..549c83324d 100644 --- a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php +++ b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php @@ -13,7 +13,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{BooleanValue, StringValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, StringValue, UnsignedShortValue}; use function array_merge; use function dirname; diff --git a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php index 230874ddb0..b35fcd7cd7 100644 --- a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php +++ b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php @@ -12,7 +12,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{BooleanValue, StringValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, StringValue, UnsignedShortValue}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php index 55d20e9975..7069598af3 100644 --- a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php @@ -23,9 +23,9 @@ use SimpleSAML\SAML2\XML\saml\{Attribute, AttributeValue}; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php index cd6bdc76c8..fbd7ce3199 100644 --- a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php +++ b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php @@ -17,9 +17,9 @@ }; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\{MissingAttributeException, MissingElementException}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{BooleanValue, LanguageValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, MissingElementException}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, LanguageValue, UnsignedShortValue}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php index ee4bc329d0..f298f70a93 100644 --- a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php @@ -25,7 +25,7 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/md/ContactPersonTest.php b/tests/SAML2/XML/md/ContactPersonTest.php index 227ca988fd..05e994c0a2 100644 --- a/tests/SAML2/XML/md/ContactPersonTest.php +++ b/tests/SAML2/XML/md/ContactPersonTest.php @@ -20,9 +20,9 @@ use SimpleSAML\SAML2\XML\md\TelephoneNumber; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/EncryptionMethodTest.php b/tests/SAML2/XML/md/EncryptionMethodTest.php index 99a5e9e7a0..2e803c7965 100644 --- a/tests/SAML2/XML/md/EncryptionMethodTest.php +++ b/tests/SAML2/XML/md/EncryptionMethodTest.php @@ -11,9 +11,9 @@ use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EncryptionMethod}; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use SimpleSAML\XMLSecurity\Type\KeySizeValue; use SimpleSAML\XMLSecurity\XML\xenc\{KeySize, OAEPparams}; diff --git a/tests/SAML2/XML/md/EndpointTypeTest.php b/tests/SAML2/XML/md/EndpointTypeTest.php index 5e4fb43d8c..ec70d8ad15 100644 --- a/tests/SAML2/XML/md/EndpointTypeTest.php +++ b/tests/SAML2/XML/md/EndpointTypeTest.php @@ -18,9 +18,9 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/EntitiesDescriptorTest.php b/tests/SAML2/XML/md/EntitiesDescriptorTest.php index 630aa542c2..22408db5ab 100644 --- a/tests/SAML2/XML/md/EntitiesDescriptorTest.php +++ b/tests/SAML2/XML/md/EntitiesDescriptorTest.php @@ -20,7 +20,7 @@ use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, UsagePolicy}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{IDValue, LanguageValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, LanguageValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/md/EntityDescriptorTest.php b/tests/SAML2/XML/md/EntityDescriptorTest.php index 4f688306dd..27529b0896 100644 --- a/tests/SAML2/XML/md/EntityDescriptorTest.php +++ b/tests/SAML2/XML/md/EntityDescriptorTest.php @@ -45,9 +45,10 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\{MissingAttributeException, TooManyElementsException}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{DurationValue, IDValue, LanguageValue, StringValue}; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, LanguageValue, StringValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; @@ -432,7 +433,7 @@ public function testUnmarshalling(): void 'urn:x-simplesamlphp:namespace', ); - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptor')); + $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptor')); $type->toXML($customd); $newline = new DOMText("\n "); diff --git a/tests/SAML2/XML/md/ExtensionsTest.php b/tests/SAML2/XML/md/ExtensionsTest.php index 205d0cfcf3..177ff1675f 100644 --- a/tests/SAML2/XML/md/ExtensionsTest.php +++ b/tests/SAML2/XML/md/ExtensionsTest.php @@ -20,7 +20,7 @@ use SimpleSAML\SAML2\XML\shibmd\Scope; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue, UnsignedShortValue}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/IDPSSODescriptorTest.php b/tests/SAML2/XML/md/IDPSSODescriptorTest.php index 690667ad94..229ff81e91 100644 --- a/tests/SAML2/XML/md/IDPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/IDPSSODescriptorTest.php @@ -31,7 +31,7 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{BooleanValue, IDValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\{BooleanValue, IDValue, UnsignedShortValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; diff --git a/tests/SAML2/XML/md/IndexedEndpointTypeTest.php b/tests/SAML2/XML/md/IndexedEndpointTypeTest.php index ab26025f35..939d38572b 100644 --- a/tests/SAML2/XML/md/IndexedEndpointTypeTest.php +++ b/tests/SAML2/XML/md/IndexedEndpointTypeTest.php @@ -16,8 +16,8 @@ }; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\{InvalidDOMElementException, MissingAttributeException}; -use SimpleSAML\XML\Type\UnsignedShortValue; +use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function dirname; use function sprintf; diff --git a/tests/SAML2/XML/md/KeyDescriptorTest.php b/tests/SAML2/XML/md/KeyDescriptorTest.php index 7e10f9edbb..2255abacc0 100644 --- a/tests/SAML2/XML/md/KeyDescriptorTest.php +++ b/tests/SAML2/XML/md/KeyDescriptorTest.php @@ -9,9 +9,9 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, KeyTypesValue}; use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EncryptionMethod, KeyDescriptor, KeyTypesEnum}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\StringValue; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; diff --git a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php index 3a389dd8e7..862a26042b 100644 --- a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php +++ b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php @@ -10,7 +10,7 @@ use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, OrganizationDisplayName}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/OrganizationNameTest.php b/tests/SAML2/XML/md/OrganizationNameTest.php index e45e54f7ba..e45c9cbb48 100644 --- a/tests/SAML2/XML/md/OrganizationNameTest.php +++ b/tests/SAML2/XML/md/OrganizationNameTest.php @@ -10,7 +10,7 @@ use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, OrganizationName}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/OrganizationTest.php b/tests/SAML2/XML/md/OrganizationTest.php index e15bd716bd..766c5611ee 100644 --- a/tests/SAML2/XML/md/OrganizationTest.php +++ b/tests/SAML2/XML/md/OrganizationTest.php @@ -20,7 +20,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{LanguageValue, StringValue}; +use SimpleSAML\XMLSchema\Type\{LanguageValue, StringValue}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/OrganizationURLTest.php b/tests/SAML2/XML/md/OrganizationURLTest.php index c2ad5ad02c..d7bded754e 100644 --- a/tests/SAML2/XML/md/OrganizationURLTest.php +++ b/tests/SAML2/XML/md/OrganizationURLTest.php @@ -10,7 +10,7 @@ use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI, AbstractMdElement, OrganizationURL}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/PDPDescriptorTest.php b/tests/SAML2/XML/md/PDPDescriptorTest.php index a1459eee81..aadd29a0f2 100644 --- a/tests/SAML2/XML/md/PDPDescriptorTest.php +++ b/tests/SAML2/XML/md/PDPDescriptorTest.php @@ -22,7 +22,7 @@ }; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/md/RequestedAttributeTest.php b/tests/SAML2/XML/md/RequestedAttributeTest.php index f86074b536..0f53562a97 100644 --- a/tests/SAML2/XML/md/RequestedAttributeTest.php +++ b/tests/SAML2/XML/md/RequestedAttributeTest.php @@ -12,7 +12,7 @@ use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/RoleDescriptorTest.php b/tests/SAML2/XML/md/RoleDescriptorTest.php index bcd62f62c0..a3e24a87a4 100644 --- a/tests/SAML2/XML/md/RoleDescriptorTest.php +++ b/tests/SAML2/XML/md/RoleDescriptorTest.php @@ -42,9 +42,10 @@ use SimpleSAML\Test\SAML2\CustomRoleDescriptor; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{AnyURIValue, DurationValue, IDValue, LanguageValue, StringValue}; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\{AnyURIValue, DurationValue, IDValue, LanguageValue, StringValue}; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; @@ -266,9 +267,9 @@ public function testUnmarshalling(): void public function testUnmarshallingUnregistered(): void { $element = clone self::$xmlRepresentation->documentElement; - $element->setAttributeNS(C::NS_XSI, 'xsi:type', 'ssp:UnknownRoleDescriptorType'); + $element->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'ssp:UnknownRoleDescriptorType'); - $type = new XMLAttribute(C::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptorType')); + $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptorType')); $type->toXML($element); $descriptor = AbstractRoleDescriptor::fromXML($element); diff --git a/tests/SAML2/XML/md/SPSSODescriptorTest.php b/tests/SAML2/XML/md/SPSSODescriptorTest.php index 4bdf064474..5d63698262 100644 --- a/tests/SAML2/XML/md/SPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/SPSSODescriptorTest.php @@ -44,9 +44,9 @@ use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{BooleanValue, DurationValue, IDValue, LanguageValue, StringValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\{BooleanValue, DurationValue, IDValue, LanguageValue, StringValue, UnsignedShortValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; diff --git a/tests/SAML2/XML/md/ServiceDescriptionTest.php b/tests/SAML2/XML/md/ServiceDescriptionTest.php index 84b660f23f..4ce83dfcb3 100644 --- a/tests/SAML2/XML/md/ServiceDescriptionTest.php +++ b/tests/SAML2/XML/md/ServiceDescriptionTest.php @@ -10,7 +10,7 @@ use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceDescription}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/ServiceNameTest.php b/tests/SAML2/XML/md/ServiceNameTest.php index f3172edca6..94067c1c49 100644 --- a/tests/SAML2/XML/md/ServiceNameTest.php +++ b/tests/SAML2/XML/md/ServiceNameTest.php @@ -10,9 +10,9 @@ use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceName}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php index 6daf0a6248..b4649d1496 100644 --- a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php @@ -12,9 +12,9 @@ use SimpleSAML\SAML2\XML\md\{AffiliationDescriptor, EntitiesDescriptor, EntityDescriptor, Extensions}; use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, PublicationInfo, UsagePolicy}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdrpi/PublicationTest.php b/tests/SAML2/XML/mdrpi/PublicationTest.php index 821219f42e..0ef06ce272 100644 --- a/tests/SAML2/XML/mdrpi/PublicationTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationTest.php @@ -10,8 +10,8 @@ use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, Publication}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php index d428770a4b..82e6c18cf9 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php @@ -12,9 +12,9 @@ use SimpleSAML\SAML2\XML\md\{AffiliationDescriptor, EntitiesDescriptor, EntityDescriptor, Extensions}; use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, RegistrationInfo, RegistrationPolicy}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php index b6d5c8b541..0a2bac6101 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, RegistrationPolicy}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php index 25167177e3..6b3656cdc9 100644 --- a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php +++ b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, UsagePolicy}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/DescriptionTest.php b/tests/SAML2/XML/mdui/DescriptionTest.php index 7ff5647932..0c7453d6c7 100644 --- a/tests/SAML2/XML/mdui/DescriptionTest.php +++ b/tests/SAML2/XML/mdui/DescriptionTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\mdui\Description; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/DiscoHintsTest.php b/tests/SAML2/XML/mdui/DiscoHintsTest.php index 6c5e546294..82557559ff 100644 --- a/tests/SAML2/XML/mdui/DiscoHintsTest.php +++ b/tests/SAML2/XML/mdui/DiscoHintsTest.php @@ -18,7 +18,7 @@ }; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/DisplayNameTest.php b/tests/SAML2/XML/mdui/DisplayNameTest.php index 2ea06974af..b7af0259c1 100644 --- a/tests/SAML2/XML/mdui/DisplayNameTest.php +++ b/tests/SAML2/XML/mdui/DisplayNameTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\mdui\DisplayName; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/InformationURLTest.php b/tests/SAML2/XML/mdui/InformationURLTest.php index 163d075d00..db25586158 100644 --- a/tests/SAML2/XML/mdui/InformationURLTest.php +++ b/tests/SAML2/XML/mdui/InformationURLTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\mdui\InformationURL; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/KeywordsTest.php b/tests/SAML2/XML/mdui/KeywordsTest.php index ed40309bc5..0fa9299b64 100644 --- a/tests/SAML2/XML/mdui/KeywordsTest.php +++ b/tests/SAML2/XML/mdui/KeywordsTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, Keywords}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/LogoTest.php b/tests/SAML2/XML/mdui/LogoTest.php index ae95273cfd..b1ed6465ed 100644 --- a/tests/SAML2/XML/mdui/LogoTest.php +++ b/tests/SAML2/XML/mdui/LogoTest.php @@ -11,9 +11,9 @@ use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, Logo}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php index 9df2802cec..408e0d245b 100644 --- a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php +++ b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\mdui\PrivacyStatementURL; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/UIInfoTest.php b/tests/SAML2/XML/mdui/UIInfoTest.php index ba0fa86891..e470ba2d8b 100644 --- a/tests/SAML2/XML/mdui/UIInfoTest.php +++ b/tests/SAML2/XML/mdui/UIInfoTest.php @@ -23,7 +23,7 @@ }; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{LanguageValue, PositiveIntegerValue}; +use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AssertionIDRefTest.php b/tests/SAML2/XML/saml/AssertionIDRefTest.php index 4bc3eab445..ef845ed875 100644 --- a/tests/SAML2/XML/saml/AssertionIDRefTest.php +++ b/tests/SAML2/XML/saml/AssertionIDRefTest.php @@ -9,7 +9,7 @@ use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AssertionIDRef}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AssertionTest.php b/tests/SAML2/XML/saml/AssertionTest.php index 62f9517ef3..825f536efb 100644 --- a/tests/SAML2/XML/saml/AssertionTest.php +++ b/tests/SAML2/XML/saml/AssertionTest.php @@ -38,9 +38,9 @@ }; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{Base64BinaryValue, IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Type\{Base64BinaryValue, IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\Exception\SignatureVerificationFailedException; @@ -1175,7 +1175,7 @@ public function testNameIdEncryption(): void $this->assertInstanceOf(EncryptedID::class, $identifier); $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $identifier->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $identifier->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), ); $nameID = $identifier->decrypt($decryptor); @@ -1331,7 +1331,7 @@ public function testEncryption(): void $doc = DOMDocumentFactory::fromString(strval($encass)); $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encass->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encass->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::OTHER_PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/AttributeTest.php b/tests/SAML2/XML/saml/AttributeTest.php index 2faea67734..9ea6e2e2a1 100644 --- a/tests/SAML2/XML/saml/AttributeTest.php +++ b/tests/SAML2/XML/saml/AttributeTest.php @@ -13,9 +13,9 @@ use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Attribute, AttributeValue, EncryptedAttribute}; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingAttributeException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Type\StringValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; @@ -134,7 +134,7 @@ public function testEncryption(): void $encattr = EncryptedAttribute::fromXML($doc->documentElement); $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encattr->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encattr->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/AttributeValueTest.php b/tests/SAML2/XML/saml/AttributeValueTest.php index 5b505c2d49..ea0b1730fd 100644 --- a/tests/SAML2/XML/saml/AttributeValueTest.php +++ b/tests/SAML2/XML/saml/AttributeValueTest.php @@ -11,6 +11,7 @@ use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AttributeValue, NameID}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; use function strval; @@ -84,8 +85,8 @@ public function testMarshallingInteger(): void $this->assertEquals('xs:integer', $av->getXsiType()); $nssaml = C::NS_SAML; - $nsxs = C::NS_XS; - $nsxsi = C::NS_XSI; + $nsxs = C_XSI::NS_XS; + $nsxsi = C_XSI::NS_XSI; $xml = <<3 XML; @@ -109,8 +110,8 @@ public function testMarshallingDateTime(): void $this->assertEquals('xs:dateTime', $av->getXsiType()); $nssaml = C::NS_SAML; - $nsxs = C::NS_XS; - $nsxsi = C::NS_XSI; + $nsxs = C_XSI::NS_XS; + $nsxsi = C_XSI::NS_XSI; $xml = <<2024-04-04T04:44:44Z XML; @@ -130,7 +131,7 @@ public function testMarshallingNull(): void $this->assertEquals('xs:nil', $av->getXsiType()); $nssaml = C::NS_SAML; - $nsxsi = C::NS_XSI; + $nsxsi = C_XSI::NS_XSI; $xml = << XML; diff --git a/tests/SAML2/XML/saml/AuthnContextDeclTest.php b/tests/SAML2/XML/saml/AuthnContextDeclTest.php index c5e4b93481..e13e3bdde6 100644 --- a/tests/SAML2/XML/saml/AuthnContextDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextDeclTest.php @@ -10,7 +10,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextTest.php b/tests/SAML2/XML/saml/AuthnContextTest.php index 9ae8afb7fe..16aa864312 100644 --- a/tests/SAML2/XML/saml/AuthnContextTest.php +++ b/tests/SAML2/XML/saml/AuthnContextTest.php @@ -19,7 +19,7 @@ AuthnContextDeclRef, }; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function dirname; diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php index b697778cec..145ca50d8f 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php @@ -18,7 +18,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php index 52eb2e0e38..93ed7d43e2 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php @@ -9,8 +9,7 @@ use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority, AuthnContext, AuthnContextDeclRef}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; -use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php index 8b15880ad1..eddf356492 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php @@ -11,7 +11,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\StringValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnStatementTest.php b/tests/SAML2/XML/saml/AuthnStatementTest.php index 4d09851e18..152975f466 100644 --- a/tests/SAML2/XML/saml/AuthnStatementTest.php +++ b/tests/SAML2/XML/saml/AuthnStatementTest.php @@ -18,8 +18,8 @@ SubjectLocality, }; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\{MissingAttributeException, MissingElementException, TooManyElementsException}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, MissingElementException, TooManyElementsException}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/BaseIDTest.php b/tests/SAML2/XML/saml/BaseIDTest.php index bf0b2c7dfa..7f6b0d96b6 100644 --- a/tests/SAML2/XML/saml/BaseIDTest.php +++ b/tests/SAML2/XML/saml/BaseIDTest.php @@ -18,6 +18,7 @@ use SimpleSAML\Test\SAML2\{Constants as C, CustomBaseID}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; use function strval; @@ -125,7 +126,7 @@ public function testUnmarshalling(): void public function testUnmarshallingUnregistered(): void { $element = clone self::$xmlRepresentation->documentElement; - $element->setAttributeNS(C::NS_XSI, 'xsi:type', 'ssp:UnknownBaseIDType'); + $element->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'ssp:UnknownBaseIDType'); $baseId = AbstractBaseID::fromXML($element); diff --git a/tests/SAML2/XML/saml/ConditionTest.php b/tests/SAML2/XML/saml/ConditionTest.php index db0b156adb..a309a0235b 100644 --- a/tests/SAML2/XML/saml/ConditionTest.php +++ b/tests/SAML2/XML/saml/ConditionTest.php @@ -18,6 +18,7 @@ use SimpleSAML\Test\SAML2\{Constants as C, CustomCondition}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; use function strval; @@ -98,7 +99,7 @@ public function testMarshalling(): void public function testUnmarshallingUnregistered(): void { $element = clone self::$xmlRepresentation->documentElement; - $element->setAttributeNS(C::NS_XSI, 'xsi:type', 'ssp:UnknownConditionType'); + $element->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'ssp:UnknownConditionType'); $condition = AbstractCondition::fromXML($element); diff --git a/tests/SAML2/XML/saml/ConditionsTest.php b/tests/SAML2/XML/saml/ConditionsTest.php index 42de26b9d7..f304d50ead 100644 --- a/tests/SAML2/XML/saml/ConditionsTest.php +++ b/tests/SAML2/XML/saml/ConditionsTest.php @@ -18,7 +18,7 @@ }; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\NonNegativeIntegerValue; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/EncryptedAssertionTest.php b/tests/SAML2/XML/saml/EncryptedAssertionTest.php index 2f6b82747a..cbd79c1aa0 100644 --- a/tests/SAML2/XML/saml/EncryptedAssertionTest.php +++ b/tests/SAML2/XML/saml/EncryptedAssertionTest.php @@ -20,7 +20,8 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; +use SimpleSAML\XPath\Constants as C_XPATH; +use SimpleSAML\XMLSchema\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; use SimpleSAML\XMLSecurity\XML\ds\{ @@ -99,7 +100,7 @@ public function testMarshalling(): void { $transforms = new Transforms([ new Transform( - SAMLAnyURIValue::fromString(C::XPATH10_URI), + SAMLAnyURIValue::fromString(C_XPATH::XPATH10_URI), new XPath( StringValue::fromString('self::xenc:CipherValue[@Id="example1"]'), ), @@ -177,7 +178,7 @@ public function testEncryption(): void $encAssertion = EncryptedAssertion::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encAssertion->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encAssertion->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::SELFSIGNED_PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/EncryptedAttributeTest.php b/tests/SAML2/XML/saml/EncryptedAttributeTest.php index a4ca2f3b7e..40093fd661 100644 --- a/tests/SAML2/XML/saml/EncryptedAttributeTest.php +++ b/tests/SAML2/XML/saml/EncryptedAttributeTest.php @@ -98,7 +98,7 @@ public function testDecryptAttribute(): void /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encryptedAttribute->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encryptedAttribute->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/saml/EncryptedIDTest.php b/tests/SAML2/XML/saml/EncryptedIDTest.php index f7fba6ff4d..d4bf324058 100644 --- a/tests/SAML2/XML/saml/EncryptedIDTest.php +++ b/tests/SAML2/XML/saml/EncryptedIDTest.php @@ -22,7 +22,7 @@ use SimpleSAML\Test\SAML2\CustomBaseID; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; +use SimpleSAML\XMLSchema\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; @@ -235,7 +235,7 @@ public function testEncryption(): void $encid = EncryptedID::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encid->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), $privKey, ); $id = $encid->decrypt($decryptor); @@ -260,7 +260,7 @@ public function testEncryption(): void $encid = EncryptedID::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encid->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), $privKey, ); $id = $encid->decrypt($decryptor); @@ -283,7 +283,7 @@ public function testEncryption(): void $encid = EncryptedID::fromXML($doc->documentElement); /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encid->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), $privKey, ); $id = $encid->decrypt($decryptor); diff --git a/tests/SAML2/XML/saml/ProxyRestrictionTest.php b/tests/SAML2/XML/saml/ProxyRestrictionTest.php index 820e13b3fa..50f2ebc682 100644 --- a/tests/SAML2/XML/saml/ProxyRestrictionTest.php +++ b/tests/SAML2/XML/saml/ProxyRestrictionTest.php @@ -10,7 +10,7 @@ use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Audience, ProxyRestriction}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\NonNegativeIntegerValue; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/StatementTest.php b/tests/SAML2/XML/saml/StatementTest.php index e863f23998..48ae467ca0 100644 --- a/tests/SAML2/XML/saml/StatementTest.php +++ b/tests/SAML2/XML/saml/StatementTest.php @@ -18,6 +18,7 @@ use SimpleSAML\Test\SAML2\{Constants as C, CustomStatement}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; use function strval; @@ -118,7 +119,7 @@ public function testUnmarshalling(): void public function testUnmarshallingUnregistered(): void { $element = clone self::$xmlRepresentation->documentElement; - $element->setAttributeNS(C::NS_XSI, 'xsi:type', 'ssp:UnknownStatementType'); + $element->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'ssp:UnknownStatementType'); $statement = AbstractStatement::fromXML($element); diff --git a/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php index a6466b019c..a37f247930 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php @@ -11,7 +11,7 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\{Attribute as XMLAttribute, Chunk, DOMDocumentFactory}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{NCNameValue, StringValue}; +use SimpleSAML\XMLSchema\Type\{NCNameValue, StringValue}; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; diff --git a/tests/SAML2/XML/saml/SubjectConfirmationTest.php b/tests/SAML2/XML/saml/SubjectConfirmationTest.php index 1105c6d4fd..29ccac03c0 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationTest.php @@ -14,9 +14,9 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\{MissingAttributeException, TooManyElementsException}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{NCNameValue, StringValue}; +use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\{NCNameValue, StringValue}; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; diff --git a/tests/SAML2/XML/saml/SubjectTest.php b/tests/SAML2/XML/saml/SubjectTest.php index ef6a8b7986..54f76f6e66 100644 --- a/tests/SAML2/XML/saml/SubjectTest.php +++ b/tests/SAML2/XML/saml/SubjectTest.php @@ -20,9 +20,10 @@ }; use SimpleSAML\Test\SAML2\{Constants as C, CustomBaseID}; use SimpleSAML\XML\{Attribute as XMLAttribute, Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\Exception\TooManyElementsException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{NCNameValue, StringValue}; +use SimpleSAML\XMLSchema\Constants as C_XSI; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\{NCNameValue, StringValue}; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; use function dirname; @@ -322,7 +323,7 @@ public function testManyNameIDThrowsException(): void public function testMultipleIdentifiers(): void { $samlNamespace = Subject::NS; - $xsiNamespace = C::NS_XSI; + $xsiNamespace = C_XSI::NS_XSI; $document = DOMDocumentFactory::fromString( <<getAlgorithm( - $identifier->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $identifier->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::SELFSIGNED_PRIVATE_KEY), ); diff --git a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php index 61ebded987..4afdda8f0d 100644 --- a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php @@ -19,7 +19,7 @@ use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/IDPListTest.php b/tests/SAML2/XML/samlp/IDPListTest.php index f391d27eb4..6cdf420894 100644 --- a/tests/SAML2/XML/samlp/IDPListTest.php +++ b/tests/SAML2/XML/samlp/IDPListTest.php @@ -10,8 +10,8 @@ use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, GetComplete, IDPEntry, IDPList}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\MissingElementException; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Exception\MissingElementException; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/LogoutRequestTest.php b/tests/SAML2/XML/samlp/LogoutRequestTest.php index bb74a1dfaa..4cdc3cba11 100644 --- a/tests/SAML2/XML/samlp/LogoutRequestTest.php +++ b/tests/SAML2/XML/samlp/LogoutRequestTest.php @@ -21,9 +21,9 @@ SessionIndex, }; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\{MissingElementException, TooManyElementsException}; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\IDValue; +use SimpleSAML\XMLSchema\Exception\{MissingElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\{PEMCertificatesMock, SignedElementTestTrait}; @@ -178,7 +178,7 @@ public function testUnmarshalling(): void /** @psalm-suppress PossiblyNullArgument */ $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( - $encid->getEncryptedKey()->getEncryptionMethod()?->getAlgorithm()->getValue(), + $encid->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::SELFSIGNED_PRIVATE_KEY), ); $identifier = $encid->decrypt($decryptor); diff --git a/tests/SAML2/XML/samlp/LogoutResponseTest.php b/tests/SAML2/XML/samlp/LogoutResponseTest.php index 6274e7ae5b..15caf867a4 100644 --- a/tests/SAML2/XML/samlp/LogoutResponseTest.php +++ b/tests/SAML2/XML/samlp/LogoutResponseTest.php @@ -19,7 +19,7 @@ }; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/MessageFactoryTest.php b/tests/SAML2/XML/samlp/MessageFactoryTest.php index ad3180a782..73db60eab4 100644 --- a/tests/SAML2/XML/samlp/MessageFactoryTest.php +++ b/tests/SAML2/XML/samlp/MessageFactoryTest.php @@ -18,7 +18,7 @@ Response, }; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function dirname; diff --git a/tests/SAML2/XML/samlp/NameIDPolicyTest.php b/tests/SAML2/XML/samlp/NameIDPolicyTest.php index d24f54fc30..b2acbc5368 100644 --- a/tests/SAML2/XML/samlp/NameIDPolicyTest.php +++ b/tests/SAML2/XML/samlp/NameIDPolicyTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, NameIDPolicy}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php index 6e00b04012..7250c63f54 100644 --- a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php +++ b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php @@ -12,8 +12,8 @@ use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, AuthnContextComparisonTypeEnum, RequestedAuthnContext}; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Exception\SchemaViolationException; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/ResponseTest.php b/tests/SAML2/XML/samlp/ResponseTest.php index 8a3c8815b1..c9d771c4b7 100644 --- a/tests/SAML2/XML/samlp/ResponseTest.php +++ b/tests/SAML2/XML/samlp/ResponseTest.php @@ -19,7 +19,7 @@ }; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/ScopingTest.php b/tests/SAML2/XML/samlp/ScopingTest.php index 6342792711..0e0bc71d8c 100644 --- a/tests/SAML2/XML/samlp/ScopingTest.php +++ b/tests/SAML2/XML/samlp/ScopingTest.php @@ -19,7 +19,7 @@ }; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\NonNegativeIntegerValue; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php index 95cc7ca123..59593704a7 100644 --- a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php +++ b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php @@ -11,7 +11,7 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\{Base64BinaryValue, IDValue, UnsignedByteValue}; +use SimpleSAML\XMLSchema\Type\{Base64BinaryValue, IDValue, UnsignedByteValue}; use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, X509Certificate, X509Data}; use function dirname; diff --git a/tests/SAML2/XML/shibmd/ScopeTest.php b/tests/SAML2/XML/shibmd/ScopeTest.php index 03e7340c07..798218123b 100644 --- a/tests/SAML2/XML/shibmd/ScopeTest.php +++ b/tests/SAML2/XML/shibmd/ScopeTest.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\shibmd\{AbstractShibmdElement, Scope}; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XML\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; use function strval; diff --git a/tests/bin/signedresponse_with_signedassertion.php b/tests/bin/signedresponse_with_signedassertion.php index 8213fce171..37ccbcbc78 100644 --- a/tests/bin/signedresponse_with_signedassertion.php +++ b/tests/bin/signedresponse_with_signedassertion.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/bin/signedresponse_with_unsignedassertion.php b/tests/bin/signedresponse_with_unsignedassertion.php index 1ad35bc45b..6972cb95dc 100644 --- a/tests/bin/signedresponse_with_unsignedassertion.php +++ b/tests/bin/signedresponse_with_unsignedassertion.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/bin/unsignedresponse_with_signedassertion.php b/tests/bin/unsignedresponse_with_signedassertion.php index bff82610b3..d5b82ac349 100644 --- a/tests/bin/unsignedresponse_with_signedassertion.php +++ b/tests/bin/unsignedresponse_with_signedassertion.php @@ -11,7 +11,7 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/resources/xml/ecp_RelayState.xml b/tests/resources/xml/ecp_RelayState.xml index d008c399a3..f8a04412a0 100644 --- a/tests/resources/xml/ecp_RelayState.xml +++ b/tests/resources/xml/ecp_RelayState.xml @@ -1 +1 @@ -AGDY854379dskssda +AGDY854379dskssda diff --git a/tests/resources/xml/ecp_Request.xml b/tests/resources/xml/ecp_Request.xml index 086c06a1dc..79d5ff7777 100644 --- a/tests/resources/xml/ecp_Request.xml +++ b/tests/resources/xml/ecp_Request.xml @@ -1,4 +1,4 @@ - + urn:x-simplesamlphp:issuer diff --git a/tests/resources/xml/ecp_RequestAuthenticated.xml b/tests/resources/xml/ecp_RequestAuthenticated.xml index f421834542..3452e6ec45 100644 --- a/tests/resources/xml/ecp_RequestAuthenticated.xml +++ b/tests/resources/xml/ecp_RequestAuthenticated.xml @@ -1 +1 @@ - + diff --git a/tests/resources/xml/ecp_Response.xml b/tests/resources/xml/ecp_Response.xml index 8fa9a60a27..f2909ce167 100644 --- a/tests/resources/xml/ecp_Response.xml +++ b/tests/resources/xml/ecp_Response.xml @@ -1 +1 @@ - + diff --git a/tests/resources/xml/ecp_SubjectConfirmation.xml b/tests/resources/xml/ecp_SubjectConfirmation.xml index aa3465f756..2ff0bb24b6 100644 --- a/tests/resources/xml/ecp_SubjectConfirmation.xml +++ b/tests/resources/xml/ecp_SubjectConfirmation.xml @@ -1,4 +1,4 @@ - + SomeKey From 88a0b94337975c38376f5b747e3ad6479acce056 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 27 Aug 2025 23:09:23 +0200 Subject: [PATCH 12/34] Fix code quality --- src/XML/IdentifierTrait.php | 3 ++- src/XML/ecp/RequestAuthenticated.php | 3 --- tests/SAML2/XML/md/RoleDescriptorTest.php | 7 ++++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/XML/IdentifierTrait.php b/src/XML/IdentifierTrait.php index 3c5392f3ff..d0a5832185 100644 --- a/src/XML/IdentifierTrait.php +++ b/src/XML/IdentifierTrait.php @@ -53,7 +53,8 @@ protected function setIdentifier(?IdentifierInterface $identifier): void * * @param \DOMElement $xml * @return \SimpleSAML\SAML2\XML\saml\IdentifierInterface|null - * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException if too many child-elements of a type are specified + * @throws \SimpleSAML\XMLSchema\Exception\TooManyElementsException + * if too many child-elements of a type are specified */ protected static function getIdentifierFromXML(DOMElement $xml): ?IdentifierInterface { diff --git a/src/XML/ecp/RequestAuthenticated.php b/src/XML/ecp/RequestAuthenticated.php index 2141ae96e8..40643a92cb 100644 --- a/src/XML/ecp/RequestAuthenticated.php +++ b/src/XML/ecp/RequestAuthenticated.php @@ -12,9 +12,6 @@ use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; -use function intval; -use function strval; - /** * Class representing the ECP RequestAuthenticated element. * diff --git a/tests/SAML2/XML/md/RoleDescriptorTest.php b/tests/SAML2/XML/md/RoleDescriptorTest.php index a3e24a87a4..0242d9b437 100644 --- a/tests/SAML2/XML/md/RoleDescriptorTest.php +++ b/tests/SAML2/XML/md/RoleDescriptorTest.php @@ -269,7 +269,12 @@ public function testUnmarshallingUnregistered(): void $element = clone self::$xmlRepresentation->documentElement; $element->setAttributeNS(C_XSI::NS_XSI, 'xsi:type', 'ssp:UnknownRoleDescriptorType'); - $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', StringValue::fromString('ssp:UnknownRoleDescriptorType')); + $type = new XMLAttribute( + C_XSI::NS_XSI, + 'xsi', + 'type', + StringValue::fromString('ssp:UnknownRoleDescriptorType'), + ); $type->toXML($element); $descriptor = AbstractRoleDescriptor::fromXML($element); From 354e77484df54726e3660489447633fff4e72fb4 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 24 Sep 2025 00:19:53 +0200 Subject: [PATCH 13/34] Fix codesniffer issues --- phpstan-baseline-dev.neon | 1236 ++++++++++++++--- phpstan-baseline.neon | 266 +++- src/Assert/SAMLAnyURITrait.php | 1 + .../SubjectConfirmationRecipientMatches.php | 3 +- .../SubjectConfirmationResponseToMatches.php | 3 +- src/Binding/SOAP.php | 10 +- src/Compat/AbstractContainer.php | 3 +- src/SOAPClient.php | 4 +- src/Type/EntityIDValue.php | 1 + src/XML/EncryptedElementTrait.php | 3 +- src/XML/ExtensionPointInterface.php | 4 +- src/XML/ExtensionPointTrait.php | 3 +- src/XML/IdentifierTrait.php | 5 +- src/XML/SignableElementTrait.php | 24 +- src/XML/alg/DigestMethod.php | 3 +- src/XML/alg/SigningMethod.php | 3 +- src/XML/ecp/RelayState.php | 7 +- src/XML/ecp/Request.php | 7 +- src/XML/ecp/RequestAuthenticated.php | 6 +- src/XML/ecp/Response.php | 6 +- src/XML/ecp/SubjectConfirmation.php | 7 +- src/XML/emd/RepublishRequest.php | 6 +- src/XML/emd/RepublishTarget.php | 1 + src/XML/idpdisc/DiscoveryResponse.php | 6 +- src/XML/init/RequestInitiator.php | 3 +- src/XML/md/AbstractEndpointType.php | 3 +- src/XML/md/AbstractIndexedEndpointType.php | 3 +- src/XML/md/AbstractLocalizedName.php | 6 +- src/XML/md/AbstractLocalizedURI.php | 6 +- src/XML/md/AbstractMetadataDocument.php | 12 +- src/XML/md/AbstractRoleDescriptor.php | 18 +- src/XML/md/AbstractRoleDescriptorType.php | 7 +- src/XML/md/AbstractSSODescriptor.php | 7 +- src/XML/md/AbstractSignedMdElement.php | 6 +- src/XML/md/AdditionalMetadataLocation.php | 3 +- src/XML/md/AffiliateMember.php | 4 +- src/XML/md/AffiliationDescriptor.php | 13 +- src/XML/md/ArtifactResolutionService.php | 6 +- src/XML/md/AssertionConsumerService.php | 3 +- src/XML/md/AttributeAuthorityDescriptor.php | 14 +- src/XML/md/AttributeConsumingService.php | 9 +- src/XML/md/AttributeProfile.php | 4 +- src/XML/md/AttributeService.php | 3 +- src/XML/md/AuthnAuthorityDescriptor.php | 13 +- src/XML/md/Company.php | 4 +- src/XML/md/ContactPerson.php | 9 +- src/XML/md/EmailAddress.php | 11 +- src/XML/md/EncryptionMethod.php | 3 +- src/XML/md/EntitiesDescriptor.php | 18 +- src/XML/md/EntityDescriptor.php | 13 +- src/XML/md/Extensions.php | 29 +- src/XML/md/GivenName.php | 4 +- src/XML/md/IDPSSODescriptor.php | 14 +- src/XML/md/IndexedElementTrait.php | 3 +- src/XML/md/KeyDescriptor.php | 7 +- src/XML/md/NameIDFormat.php | 4 +- src/XML/md/NameIDMappingService.php | 3 +- src/XML/md/Organization.php | 11 +- src/XML/md/OrganizationDisplayName.php | 3 +- src/XML/md/OrganizationName.php | 3 +- src/XML/md/OrganizationURL.php | 3 +- src/XML/md/PDPDescriptor.php | 13 +- src/XML/md/RequestedAttribute.php | 3 +- src/XML/md/SPSSODescriptor.php | 14 +- src/XML/md/ServiceDescription.php | 3 +- src/XML/md/ServiceName.php | 3 +- src/XML/md/SingleSignOnService.php | 3 +- src/XML/md/SurName.php | 4 +- src/XML/md/TelephoneNumber.php | 11 +- src/XML/md/UnknownRoleDescriptor.php | 8 +- src/XML/mdattr/EntityAttributes.php | 8 +- src/XML/mdrpi/Publication.php | 8 +- src/XML/mdrpi/PublicationInfo.php | 9 +- src/XML/mdrpi/PublicationPath.php | 3 +- src/XML/mdrpi/RegistrationInfo.php | 9 +- src/XML/mdui/DiscoHints.php | 8 +- src/XML/mdui/DomainHint.php | 4 +- src/XML/mdui/GeolocationHint.php | 4 +- src/XML/mdui/IPHint.php | 3 +- src/XML/mdui/Keywords.php | 8 +- src/XML/mdui/Logo.php | 14 +- src/XML/mdui/UIInfo.php | 7 +- src/XML/saml/AbstractBaseID.php | 12 +- src/XML/saml/AbstractCondition.php | 9 +- src/XML/saml/AbstractStatement.php | 9 +- src/XML/saml/Action.php | 4 +- src/XML/saml/Advice.php | 7 +- src/XML/saml/Assertion.php | 22 +- src/XML/saml/AssertionIDRef.php | 4 +- src/XML/saml/AssertionURIRef.php | 4 +- src/XML/saml/Attribute.php | 6 +- src/XML/saml/AttributeStatement.php | 3 +- src/XML/saml/AttributeValue.php | 3 +- src/XML/saml/Audience.php | 4 +- src/XML/saml/AudienceRestriction.php | 6 +- src/XML/saml/AuthenticatingAuthority.php | 4 +- src/XML/saml/AuthnContext.php | 10 +- src/XML/saml/AuthnContextClassRef.php | 4 +- src/XML/saml/AuthnContextDecl.php | 10 +- src/XML/saml/AuthnContextDeclRef.php | 5 +- src/XML/saml/AuthnStatement.php | 10 +- src/XML/saml/AuthzDecisionStatement.php | 13 +- src/XML/saml/Conditions.php | 3 +- src/XML/saml/EncryptedAssertion.php | 4 +- src/XML/saml/EncryptedAttribute.php | 4 +- src/XML/saml/EncryptedID.php | 10 +- src/XML/saml/Evidence.php | 6 +- src/XML/saml/Issuer.php | 6 +- src/XML/saml/NameID.php | 6 +- src/XML/saml/NameIDType.php | 4 +- src/XML/saml/OneTimeUse.php | 3 +- src/XML/saml/ProxyRestriction.php | 3 +- src/XML/saml/Subject.php | 8 +- src/XML/saml/SubjectConfirmation.php | 8 +- src/XML/saml/SubjectConfirmationData.php | 10 +- src/XML/saml/SubjectLocality.php | 6 +- src/XML/samlp/AbstractMessage.php | 9 +- src/XML/samlp/AbstractStatusResponse.php | 6 +- src/XML/samlp/AbstractSubjectQuery.php | 6 +- src/XML/samlp/Artifact.php | 3 +- src/XML/samlp/ArtifactResolve.php | 14 +- src/XML/samlp/ArtifactResponse.php | 16 +- src/XML/samlp/AssertionIDRequest.php | 16 +- src/XML/samlp/AttributeQuery.php | 18 +- src/XML/samlp/AuthnQuery.php | 17 +- src/XML/samlp/AuthnRequest.php | 21 +- src/XML/samlp/AuthzDecisionQuery.php | 25 +- src/XML/samlp/Extensions.php | 3 +- src/XML/samlp/GetComplete.php | 4 +- src/XML/samlp/IDPEntry.php | 7 +- src/XML/samlp/IDPList.php | 7 +- src/XML/samlp/LogoutRequest.php | 22 +- src/XML/samlp/LogoutResponse.php | 13 +- src/XML/samlp/NameIDPolicy.php | 6 +- src/XML/samlp/RequestedAuthnContext.php | 11 +- src/XML/samlp/RequesterID.php | 4 +- src/XML/samlp/Response.php | 21 +- src/XML/samlp/Scoping.php | 3 +- src/XML/samlp/SessionIndex.php | 3 +- src/XML/samlp/Status.php | 7 +- src/XML/samlp/StatusCode.php | 3 +- src/XML/samlp/StatusDetail.php | 4 +- src/XML/samlp/StatusMessage.php | 4 +- src/XML/shibmd/KeyAuthority.php | 4 +- src/XML/shibmd/Scope.php | 4 +- tests/SAML2/Assert/CIDRTest.php | 4 +- tests/SAML2/Assert/DomainTest.php | 4 +- tests/SAML2/Assert/EntityIDTest.php | 4 +- tests/SAML2/Assert/SAMLAnyURITest.php | 4 +- tests/SAML2/Assert/SAMLDateTimeTest.php | 4 +- tests/SAML2/Assert/SAMLStringTest.php | 4 +- .../NameIdDecryptionTransformerTest.php | 40 +- .../Validation/AssertionValidatorTest.php | 17 +- .../ConstraintValidator/NotBeforeTest.php | 21 +- .../ConstraintValidator/NotOnOrAfterTest.php | 21 +- .../SessionNotOnOrAfterTest.php | 13 +- .../SpIsValidAudienceTest.php | 25 +- .../SubjectConfirmationMethodTest.php | 3 +- .../SubjectConfirmationNotBeforeTest.php | 9 +- .../SubjectConfirmationNotOnOrAfterTest.php | 15 +- ...ubjectConfirmationRecipientMatchesTest.php | 9 +- ...bjectConfirmationResponseToMatchesTest.php | 8 +- .../SubjectConfirmationValidatorTest.php | 17 +- tests/SAML2/Binding/HTTPArtifactTest.php | 3 +- tests/SAML2/Binding/HTTPPostTest.php | 13 +- tests/SAML2/Binding/HTTPRedirectTest.php | 17 +- tests/SAML2/Binding/SOAPTest.php | 9 +- tests/SAML2/BindingTest.php | 3 +- tests/SAML2/CustomBaseID.php | 6 +- tests/SAML2/CustomCondition.php | 3 +- tests/SAML2/CustomRoleDescriptor.php | 26 +- tests/SAML2/CustomStatement.php | 3 +- .../DestinationMatchesTest.php | 3 +- .../ConstraintValidator/IsSuccessfulTest.php | 11 +- tests/SAML2/Signature/ValidatorChainTest.php | 13 +- tests/SAML2/Type/AnyURIListValueTest.php | 4 +- .../AuthnContextComparisonTypeValueTest.php | 3 +- tests/SAML2/Type/DecisionTypeValueTest.php | 3 +- tests/SAML2/Type/EntityIDValueTest.php | 4 +- tests/SAML2/Type/ListOfStringsValueTest.php | 4 +- tests/SAML2/Type/SAMLAnyURIValueTest.php | 4 +- tests/SAML2/Type/SAMLDateTimeValueTest.php | 4 +- tests/SAML2/Type/SAMLStringValueTest.php | 4 +- tests/SAML2/UtilsTest.php | 7 +- tests/SAML2/XML/alg/DigestMethodTest.php | 12 +- tests/SAML2/XML/alg/SigningMethodTest.php | 12 +- tests/SAML2/XML/ecp/RelayStateTest.php | 9 +- .../XML/ecp/RequestAuthenticatedTest.php | 9 +- tests/SAML2/XML/ecp/RequestTest.php | 17 +- tests/SAML2/XML/ecp/ResponseTest.php | 9 +- .../SAML2/XML/ecp/SubjectConfirmationTest.php | 23 +- tests/SAML2/XML/emd/RepublishRequestTest.php | 11 +- tests/SAML2/XML/emd/RepublishTargetTest.php | 6 +- .../XML/idpdisc/DiscoveryResponseTest.php | 19 +- tests/SAML2/XML/init/RequestInitiatorTest.php | 12 +- .../XML/md/AbstractLocalizedNameTest.php | 10 +- .../XML/md/AdditionalMetadataLocationTest.php | 9 +- tests/SAML2/XML/md/AffiliateMemberTest.php | 9 +- .../XML/md/AffiliationDescriptorTest.php | 33 +- .../XML/md/ArtifactResolutionServiceTest.php | 18 +- .../XML/md/AssertionConsumerServiceTest.php | 18 +- .../md/AttributeAuthorityDescriptorTest.php | 35 +- .../XML/md/AttributeConsumingServiceTest.php | 28 +- tests/SAML2/XML/md/AttributeProfileTest.php | 9 +- .../XML/md/AuthnAuthorityDescriptorTest.php | 28 +- tests/SAML2/XML/md/CompanyTest.php | 9 +- tests/SAML2/XML/md/ContactPersonTest.php | 13 +- tests/SAML2/XML/md/EmailAddressTest.php | 10 +- tests/SAML2/XML/md/EncryptionMethodTest.php | 15 +- tests/SAML2/XML/md/EndpointTypeTest.php | 23 +- tests/SAML2/XML/md/EntitiesDescriptorTest.php | 30 +- tests/SAML2/XML/md/EntityDescriptorTest.php | 79 +- tests/SAML2/XML/md/ExtensionsTest.php | 36 +- tests/SAML2/XML/md/GivenNameTest.php | 9 +- tests/SAML2/XML/md/IDPSSODescriptorTest.php | 55 +- .../SAML2/XML/md/IndexedEndpointTypeTest.php | 17 +- tests/SAML2/XML/md/KeyDescriptorTest.php | 17 +- tests/SAML2/XML/md/NameIDFormatTest.php | 9 +- .../SAML2/XML/md/NameIDMappingServiceTest.php | 6 +- .../XML/md/OrganizationDisplayNameTest.php | 11 +- tests/SAML2/XML/md/OrganizationNameTest.php | 11 +- tests/SAML2/XML/md/OrganizationTest.php | 30 +- tests/SAML2/XML/md/OrganizationURLTest.php | 12 +- tests/SAML2/XML/md/PDPDescriptorTest.php | 29 +- tests/SAML2/XML/md/RequestedAttributeTest.php | 12 +- tests/SAML2/XML/md/RoleDescriptorTest.php | 77 +- tests/SAML2/XML/md/SPSSODescriptorTest.php | 81 +- tests/SAML2/XML/md/ServiceDescriptionTest.php | 11 +- tests/SAML2/XML/md/ServiceNameTest.php | 11 +- .../SAML2/XML/md/SingleSignOnServiceTest.php | 11 +- tests/SAML2/XML/md/SurNameTest.php | 9 +- tests/SAML2/XML/md/TelephoneNumberTest.php | 10 +- .../SAML2/XML/mdattr/EntityAttributesTest.php | 35 +- tests/SAML2/XML/mdrpi/PublicationInfoTest.php | 22 +- tests/SAML2/XML/mdrpi/PublicationPathTest.php | 14 +- tests/SAML2/XML/mdrpi/PublicationTest.php | 13 +- .../SAML2/XML/mdrpi/RegistrationInfoTest.php | 22 +- .../XML/mdrpi/RegistrationPolicyTest.php | 12 +- tests/SAML2/XML/mdrpi/UsagePolicyTest.php | 12 +- tests/SAML2/XML/mdui/DescriptionTest.php | 9 +- tests/SAML2/XML/mdui/DiscoHintsTest.php | 29 +- tests/SAML2/XML/mdui/DisplayNameTest.php | 9 +- tests/SAML2/XML/mdui/DomainHintTest.php | 6 +- tests/SAML2/XML/mdui/GeolocationHintTest.php | 9 +- tests/SAML2/XML/mdui/IPHintTest.php | 9 +- tests/SAML2/XML/mdui/InformationURLTest.php | 10 +- tests/SAML2/XML/mdui/KeywordsTest.php | 10 +- tests/SAML2/XML/mdui/LogoTest.php | 13 +- .../XML/mdui/PrivacyStatementURLTest.php | 10 +- tests/SAML2/XML/mdui/UIInfoTest.php | 40 +- tests/SAML2/XML/saml/ActionTest.php | 9 +- tests/SAML2/XML/saml/AdviceTest.php | 23 +- tests/SAML2/XML/saml/AssertionIDRefTest.php | 9 +- tests/SAML2/XML/saml/AssertionTest.php | 67 +- tests/SAML2/XML/saml/AssertionURIRefTest.php | 9 +- .../SAML2/XML/saml/AttributeStatementTest.php | 6 +- tests/SAML2/XML/saml/AttributeTest.php | 17 +- tests/SAML2/XML/saml/AttributeValueTest.php | 10 +- .../XML/saml/AudienceRestrictionTest.php | 10 +- tests/SAML2/XML/saml/AudienceTest.php | 10 +- .../XML/saml/AuthenticatingAuthorityTest.php | 9 +- .../XML/saml/AuthnContextClassRefTest.php | 9 +- .../XML/saml/AuthnContextDeclRefTest.php | 9 +- tests/SAML2/XML/saml/AuthnContextDeclTest.php | 12 +- tests/SAML2/XML/saml/AuthnContextTest.php | 20 +- ...AuthnContextWithClassRefAndDeclRefTest.php | 21 +- .../AuthnContextWithClassRefAndDeclTest.php | 24 +- .../XML/saml/AuthnContextWithClassRefTest.php | 14 +- .../XML/saml/AuthnContextWithDeclRefTest.php | 14 +- .../XML/saml/AuthnContextWithDeclTest.php | 14 +- tests/SAML2/XML/saml/AuthnStatementTest.php | 30 +- .../XML/saml/AuthzDecisionStatementTest.php | 24 +- tests/SAML2/XML/saml/BaseIDTest.php | 27 +- tests/SAML2/XML/saml/ConditionTest.php | 24 +- tests/SAML2/XML/saml/ConditionsTest.php | 23 +- .../SAML2/XML/saml/EncryptedAssertionTest.php | 58 +- .../SAML2/XML/saml/EncryptedAttributeTest.php | 14 +- tests/SAML2/XML/saml/EncryptedIDTest.php | 49 +- tests/SAML2/XML/saml/EvidenceTest.php | 20 +- tests/SAML2/XML/saml/IssuerTest.php | 13 +- tests/SAML2/XML/saml/NameIDTest.php | 14 +- tests/SAML2/XML/saml/OneTimeUseTest.php | 10 +- tests/SAML2/XML/saml/ProxyRestrictionTest.php | 10 +- tests/SAML2/XML/saml/StatementTest.php | 24 +- .../XML/saml/SubjectConfirmationDataTest.php | 23 +- .../XML/saml/SubjectConfirmationTest.php | 28 +- tests/SAML2/XML/saml/SubjectLocalityTest.php | 12 +- tests/SAML2/XML/saml/SubjectTest.php | 40 +- tests/SAML2/XML/samlp/AbstractMessageTest.php | 26 +- .../XML/samlp/AbstractStatusResponseTest.php | 28 +- tests/SAML2/XML/samlp/ArtifactResolveTest.php | 24 +- .../SAML2/XML/samlp/ArtifactResponseTest.php | 32 +- tests/SAML2/XML/samlp/ArtifactTest.php | 9 +- .../XML/samlp/AssertionIDRequestTest.php | 21 +- tests/SAML2/XML/samlp/AttributeQueryTest.php | 32 +- tests/SAML2/XML/samlp/AuthnQueryTest.php | 32 +- tests/SAML2/XML/samlp/AuthnRequestTest.php | 75 +- .../XML/samlp/AuthzDecisionQueryTest.php | 29 +- tests/SAML2/XML/samlp/ExtensionsTest.php | 12 +- tests/SAML2/XML/samlp/GetCompleteTest.php | 10 +- tests/SAML2/XML/samlp/IDPEntryTest.php | 14 +- tests/SAML2/XML/samlp/IDPListTest.php | 16 +- tests/SAML2/XML/samlp/LogoutRequestTest.php | 31 +- tests/SAML2/XML/samlp/LogoutResponseTest.php | 27 +- tests/SAML2/XML/samlp/MessageFactoryTest.php | 22 +- tests/SAML2/XML/samlp/NameIDPolicyTest.php | 13 +- .../XML/samlp/RequestedAuthnContextTest.php | 17 +- tests/SAML2/XML/samlp/RequesterIDTest.php | 10 +- tests/SAML2/XML/samlp/ResponseTest.php | 30 +- tests/SAML2/XML/samlp/ScopingTest.php | 24 +- tests/SAML2/XML/samlp/SessionIndexTest.php | 9 +- tests/SAML2/XML/samlp/StatusCodeTest.php | 9 +- tests/SAML2/XML/samlp/StatusDetailTest.php | 12 +- tests/SAML2/XML/samlp/StatusMessageTest.php | 9 +- tests/SAML2/XML/samlp/StatusTest.php | 18 +- tests/SAML2/XML/shibmd/KeyAuthorityTest.php | 17 +- tests/SAML2/XML/shibmd/ScopeTest.php | 11 +- tests/bin/authnrequest.php | 4 +- tests/bin/entityattributes.php | 4 +- tests/bin/logoutrequest.php | 3 +- .../signedresponse_with_signedassertion.php | 7 +- .../signedresponse_with_unsignedassertion.php | 7 +- .../unsignedresponse_with_signedassertion.php | 7 +- 323 files changed, 3842 insertions(+), 1761 deletions(-) diff --git a/phpstan-baseline-dev.neon b/phpstan-baseline-dev.neon index a395860c1f..903d22304c 100644 --- a/phpstan-baseline-dev.neon +++ b/phpstan-baseline-dev.neon @@ -1,5 +1,29 @@ parameters: ignoreErrors: + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assert/EntityIDTest.php + + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assert/SAMLAnyURITest.php + + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assert/SAMLDateTimeTest.php + + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assert/SAMLStringTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -265,7 +289,7 @@ parameters: path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php @@ -276,6 +300,18 @@ parameters: count: 5 path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php + - + message: '#^Access to constant NS_XS on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php + + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -289,7 +325,7 @@ parameters: path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php @@ -360,6 +396,12 @@ parameters: count: 4 path: tests/SAML2/Binding/HTTPRedirectTest.php + - + message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/Binding/SOAPTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' identifier: method.notFound @@ -379,7 +421,7 @@ parameters: path: tests/SAML2/Binding/SOAPTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\SOAP11\\Type\\MustUnderstandValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/Binding/SOAPTest.php @@ -403,7 +445,25 @@ parameters: path: tests/SAML2/Certificate/KeyLoaderTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/CustomBaseID.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomBaseID.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/CustomBaseID.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' identifier: class.notFound count: 1 path: tests/SAML2/CustomBaseID.php @@ -427,55 +487,109 @@ parameters: path: tests/SAML2/CustomBaseID.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/CustomCondition.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/CustomCondition.php - - message: '#^Call to method getNamespacePrefix\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/CustomCondition.php + + - + message: '#^PHPDoc tag @throws with type SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException is not subtype of Throwable$#' + identifier: throws.notThrowable + count: 1 + path: tests/SAML2/CustomCondition.php + + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' identifier: class.notFound count: 1 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Call to method getNamespaceURI\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Call to method getNamespacePrefix\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Call to method getNamespaceURI\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound count: 1 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Class SimpleSAML\\XML\\Type\\DurationValue not found\.$#' + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Type\\DurationValue not found\.$#' identifier: class.notFound count: 1 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Class SimpleSAML\\XML\\Type\\IDValue not found\.$#' + message: '#^Class SimpleSAML\\XMLSchema\\Type\\IDValue not found\.$#' identifier: class.notFound count: 1 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Parameter \#3 \$ID of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XML\\Type\\IDValue\|null, string given\.$#' + message: '#^PHPDoc tag @throws with type SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException is not subtype of Throwable$#' + identifier: throws.notThrowable + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \#2 \$protocolSupportEnumeration of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\SAML2\\Type\\AnyURIListValue, string given\.$#' identifier: argument.type count: 1 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Parameter \#4 \$attrValue of class SimpleSAML\\XML\\Attribute constructor expects string, SimpleSAML\\XML\\Type\\QNameValue given\.$#' + message: '#^Parameter \#3 \$ID of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XMLSchema\\Type\\IDValue\|null, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/CustomRoleDescriptor.php + + - + message: '#^Parameter \#4 \$attrValue of class SimpleSAML\\XML\\Attribute constructor expects string, SimpleSAML\\XMLSchema\\Type\\QNameValue given\.$#' identifier: argument.type count: 1 path: tests/SAML2/CustomRoleDescriptor.php @@ -487,7 +601,7 @@ parameters: path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Parameter \#5 \$cacheDuration of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XML\\Type\\DurationValue\|null, string given\.$#' + message: '#^Parameter \#5 \$cacheDuration of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XMLSchema\\Type\\DurationValue\|null, string given\.$#' identifier: argument.type count: 1 path: tests/SAML2/CustomRoleDescriptor.php @@ -499,13 +613,13 @@ parameters: path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Parameter \$ID of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Parameter \$ID of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Parameter \$cacheDuration of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XML\\Type\\DurationValue\.$#' + message: '#^Parameter \$cacheDuration of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/CustomRoleDescriptor.php @@ -517,11 +631,29 @@ parameters: path: tests/SAML2/CustomRoleDescriptor.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/CustomStatement.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/CustomStatement.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/CustomStatement.php + + - + message: '#^PHPDoc tag @throws with type SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException is not subtype of Throwable$#' + identifier: throws.notThrowable + count: 1 + path: tests/SAML2/CustomStatement.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -582,36 +714,102 @@ parameters: count: 1 path: tests/SAML2/Signature/ValidatorChainTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Type/AnyURIListValueTest.php + + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/AnyURIListValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AuthnContextComparisonTypeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php + + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DecisionTypeValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 2 + path: tests/SAML2/Type/DecisionTypeValueTest.php + + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/DecisionTypeValueTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound count: 1 path: tests/SAML2/Type/EntityIDValueTest.php + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/EntityIDValueTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound count: 2 path: tests/SAML2/Type/ListOfStringsValueTest.php + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/ListOfStringsValueTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound count: 1 path: tests/SAML2/Type/SAMLAnyURIValueTest.php + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/SAMLAnyURIValueTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound count: 1 path: tests/SAML2/Type/SAMLDateTimeValueTest.php + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/SAMLDateTimeValueTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound count: 1 path: tests/SAML2/Type/SAMLStringValueTest.php + - + message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/Type/SAMLStringValueTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -642,6 +840,18 @@ parameters: count: 1 path: tests/SAML2/XML/alg/DigestMethodTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/alg/DigestMethodTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/alg/DigestMethodTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -649,11 +859,29 @@ parameters: path: tests/SAML2/XML/alg/SigningMethodTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/alg/SigningMethodTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/alg/SigningMethodTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/alg/SigningMethodTest.php + + - + message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/ecp/RelayStateTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -667,11 +895,47 @@ parameters: path: tests/SAML2/XML/ecp/RelayStateTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/ecp/RelayStateTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/ecp/RelayStateTest.php + + - + message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php + - + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\SOAP11\\Type\\MustUnderstandValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php + + - + message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/ecp/RequestTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -691,7 +955,7 @@ parameters: path: tests/SAML2/XML/ecp/RequestTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/ecp/RequestTest.php @@ -702,12 +966,48 @@ parameters: count: 1 path: tests/SAML2/XML/ecp/RequestTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/ecp/RequestTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/ecp/RequestTest.php + + - + message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/ecp/ResponseTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound count: 2 path: tests/SAML2/XML/ecp/ResponseTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/ecp/ResponseTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 3 + path: tests/SAML2/XML/ecp/ResponseTest.php + + - + message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -733,17 +1033,29 @@ parameters: path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 3 + path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -769,13 +1081,13 @@ parameters: path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php @@ -792,12 +1104,42 @@ parameters: count: 1 path: tests/SAML2/XML/init/RequestInitiatorTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AbstractLocalizedNameTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AbstractLocalizedNameTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/md/AbstractLocalizedNameTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound count: 2 path: tests/SAML2/XML/md/AdditionalMetadataLocationTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AdditionalMetadataLocationTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/AdditionalMetadataLocationTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -829,13 +1171,13 @@ parameters: path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/AffiliationDescriptorTest.php @@ -846,6 +1188,18 @@ parameters: count: 2 path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/AffiliationDescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -853,19 +1207,19 @@ parameters: path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php @@ -877,23 +1231,29 @@ parameters: path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 5 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -907,7 +1267,7 @@ parameters: path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php @@ -924,6 +1284,18 @@ parameters: count: 3 path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -937,23 +1309,41 @@ parameters: path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 5 path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 4 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 5 + path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -973,7 +1363,7 @@ parameters: path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php @@ -1009,7 +1399,7 @@ parameters: path: tests/SAML2/XML/md/ContactPersonTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/ContactPersonTest.php @@ -1044,6 +1434,18 @@ parameters: count: 1 path: tests/SAML2/XML/md/ContactPersonTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/ContactPersonTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/ContactPersonTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1075,11 +1477,23 @@ parameters: path: tests/SAML2/XML/md/EncryptionMethodTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/EncryptionMethodTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EncryptionMethodTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/EncryptionMethodTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1087,11 +1501,29 @@ parameters: path: tests/SAML2/XML/md/EndpointTypeTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EndpointTypeTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EndpointTypeTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/EndpointTypeTest.php + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 3 + path: tests/SAML2/XML/md/EndpointTypeTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1111,17 +1543,23 @@ parameters: path: tests/SAML2/XML/md/EntitiesDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/EntitiesDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/EntitiesDescriptorTest.php + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:getValue\(\)\.$#' identifier: method.notFound @@ -1134,6 +1572,12 @@ parameters: count: 2 path: tests/SAML2/XML/md/EntityDescriptorTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1165,37 +1609,37 @@ parameters: path: tests/SAML2/XML/md/EntityDescriptorTest.php - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/EntityDescriptorTest.php - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/EntityDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/EntityDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/EntityDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 8 path: tests/SAML2/XML/md/EntityDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/EntityDescriptorTest.php @@ -1212,6 +1656,24 @@ parameters: count: 6 path: tests/SAML2/XML/md/EntityDescriptorTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 3 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1231,19 +1693,19 @@ parameters: path: tests/SAML2/XML/md/ExtensionsTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/ExtensionsTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/ExtensionsTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/ExtensionsTest.php @@ -1266,6 +1728,12 @@ parameters: count: 1 path: tests/SAML2/XML/md/GivenNameTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1279,19 +1747,19 @@ parameters: path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/IDPSSODescriptorTest.php @@ -1315,11 +1783,29 @@ parameters: path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1327,11 +1813,23 @@ parameters: path: tests/SAML2/XML/md/KeyDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/KeyDescriptorTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/KeyDescriptorTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/KeyDescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1357,7 +1855,7 @@ parameters: path: tests/SAML2/XML/md/OrganizationDisplayNameTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/OrganizationDisplayNameTest.php @@ -1369,7 +1867,7 @@ parameters: path: tests/SAML2/XML/md/OrganizationNameTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/OrganizationNameTest.php @@ -1387,13 +1885,13 @@ parameters: path: tests/SAML2/XML/md/OrganizationTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 3 path: tests/SAML2/XML/md/OrganizationTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/OrganizationTest.php @@ -1405,11 +1903,17 @@ parameters: path: tests/SAML2/XML/md/OrganizationURLTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/OrganizationURLTest.php + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 4 + path: tests/SAML2/XML/md/PDPDescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1417,7 +1921,7 @@ parameters: path: tests/SAML2/XML/md/PDPDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/PDPDescriptorTest.php @@ -1447,7 +1951,7 @@ parameters: path: tests/SAML2/XML/md/RequestedAttributeTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/RequestedAttributeTest.php @@ -1464,6 +1968,12 @@ parameters: count: 1 path: tests/SAML2/XML/md/RequestedAttributeTest.php + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:getValue\(\)\.$#' identifier: method.notFound @@ -1501,43 +2011,43 @@ parameters: path: tests/SAML2/XML/md/RoleDescriptorTest.php - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/md/RoleDescriptorTest.php - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/RoleDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\AnyURIValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\AnyURIValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/RoleDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/RoleDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/RoleDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 3 path: tests/SAML2/XML/md/RoleDescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/XML/md/RoleDescriptorTest.php @@ -1572,6 +2082,24 @@ parameters: count: 2 path: tests/SAML2/XML/md/RoleDescriptorTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' + identifier: staticMethod.notFound + count: 3 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1597,37 +2125,37 @@ parameters: path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 4 path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\DurationValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/SPSSODescriptorTest.php @@ -1644,6 +2172,18 @@ parameters: count: 1 path: tests/SAML2/XML/md/SPSSODescriptorTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/md/SPSSODescriptorTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1651,7 +2191,7 @@ parameters: path: tests/SAML2/XML/md/ServiceDescriptionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/ServiceDescriptionTest.php @@ -1663,11 +2203,23 @@ parameters: path: tests/SAML2/XML/md/ServiceNameTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/md/ServiceNameTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/md/ServiceNameTest.php + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/md/ServiceNameTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1759,11 +2311,23 @@ parameters: path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 3 path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1788,6 +2352,18 @@ parameters: count: 2 path: tests/SAML2/XML/mdrpi/PublicationTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/PublicationTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/mdrpi/PublicationTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1813,11 +2389,23 @@ parameters: path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 3 path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -1825,7 +2413,7 @@ parameters: path: tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php @@ -1837,7 +2425,7 @@ parameters: path: tests/SAML2/XML/mdrpi/UsagePolicyTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdrpi/UsagePolicyTest.php @@ -1849,7 +2437,7 @@ parameters: path: tests/SAML2/XML/mdui/DescriptionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdui/DescriptionTest.php @@ -1885,7 +2473,7 @@ parameters: path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdui/DiscoHintsTest.php @@ -1915,7 +2503,7 @@ parameters: path: tests/SAML2/XML/mdui/DisplayNameTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdui/DisplayNameTest.php @@ -1963,7 +2551,7 @@ parameters: path: tests/SAML2/XML/mdui/InformationURLTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdui/InformationURLTest.php @@ -1975,7 +2563,7 @@ parameters: path: tests/SAML2/XML/mdui/KeywordsTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/mdui/KeywordsTest.php @@ -1993,23 +2581,35 @@ parameters: path: tests/SAML2/XML/mdui/LogoTest.php - - message: '#^Call to method toInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + message: '#^Call to method toInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/XML/mdui/LogoTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/mdui/LogoTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdui/LogoTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/mdui/LogoTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/mdui/LogoTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2017,7 +2617,7 @@ parameters: path: tests/SAML2/XML/mdui/PrivacyStatementURLTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/mdui/PrivacyStatementURLTest.php @@ -2047,13 +2647,13 @@ parameters: path: tests/SAML2/XML/mdui/UIInfoTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\PositiveIntegerValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' identifier: class.notFound count: 4 path: tests/SAML2/XML/mdui/UIInfoTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\LanguageValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' identifier: class.notFound count: 16 path: tests/SAML2/XML/mdui/UIInfoTest.php @@ -2083,7 +2683,7 @@ parameters: path: tests/SAML2/XML/saml/AdviceTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/AssertionIDRefTest.php @@ -2136,6 +2736,18 @@ parameters: count: 1 path: tests/SAML2/XML/saml/AssertionTest.php + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAssertion\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' identifier: method.notFound @@ -2185,25 +2797,25 @@ parameters: path: tests/SAML2/XML/saml/AssertionTest.php - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/AssertionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/AssertionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 4 path: tests/SAML2/XML/saml/AssertionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/AssertionTest.php @@ -2211,7 +2823,7 @@ parameters: - message: '#^Cannot call method getValue\(\) on string\.$#' identifier: method.nonObject - count: 6 + count: 4 path: tests/SAML2/XML/saml/AssertionTest.php - @@ -2238,6 +2850,18 @@ parameters: count: 1 path: tests/SAML2/XML/saml/AssertionTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2256,6 +2880,12 @@ parameters: count: 3 path: tests/SAML2/XML/saml/AttributeStatementTest.php + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAttribute\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/AttributeTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2269,16 +2899,34 @@ parameters: path: tests/SAML2/XML/saml/AttributeTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/saml/AttributeTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AttributeTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/saml/AttributeTest.php + + - + message: '#^Access to constant NS_XS on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' identifier: class.notFound count: 2 - path: tests/SAML2/XML/saml/AttributeTest.php + path: tests/SAML2/XML/saml/AttributeValueTest.php - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject - count: 1 - path: tests/SAML2/XML/saml/AttributeTest.php + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/saml/AttributeValueTest.php - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' @@ -2347,7 +2995,7 @@ parameters: path: tests/SAML2/XML/saml/AuthnContextDeclRefTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/AuthnContextDeclTest.php @@ -2382,6 +3030,18 @@ parameters: count: 1 path: tests/SAML2/XML/saml/AuthnContextTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/saml/AuthnContextTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 3 + path: tests/SAML2/XML/saml/AuthnContextTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2425,7 +3085,7 @@ parameters: path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php @@ -2497,7 +3157,7 @@ parameters: path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php @@ -2550,6 +3210,30 @@ parameters: count: 2 path: tests/SAML2/XML/saml/AuthnStatementTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 4 + path: tests/SAML2/XML/saml/AuthnStatementTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2562,6 +3246,12 @@ parameters: count: 2 path: tests/SAML2/XML/saml/AuthzDecisionStatementTest.php + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/BaseIDTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' identifier: method.notFound @@ -2581,7 +3271,7 @@ parameters: path: tests/SAML2/XML/saml/BaseIDTest.php - - message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/BaseIDTest.php @@ -2592,6 +3282,12 @@ parameters: count: 1 path: tests/SAML2/XML/saml/BaseIDTest.php + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/ConditionTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2599,7 +3295,7 @@ parameters: path: tests/SAML2/XML/saml/ConditionTest.php - - message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/ConditionTest.php @@ -2623,7 +3319,7 @@ parameters: path: tests/SAML2/XML/saml/ConditionsTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/ConditionsTest.php @@ -2634,6 +3330,18 @@ parameters: count: 2 path: tests/SAML2/XML/saml/ConditionsTest.php + - + message: '#^Access to constant XPATH10_URI on an unknown class SimpleSAML\\XPath\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAssertion\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2653,34 +3361,34 @@ parameters: path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\AnyURIValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\AnyURIValue\.$#' identifier: class.notFound count: 5 path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAttribute\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound count: 1 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php + path: tests/SAML2/XML/saml/EncryptedAttributeTest.php - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' @@ -2689,10 +3397,10 @@ parameters: path: tests/SAML2/XML/saml/EncryptedAttributeTest.php - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject - count: 1 - path: tests/SAML2/XML/saml/EncryptedAttributeTest.php + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound + count: 3 + path: tests/SAML2/XML/saml/EncryptedIDTest.php - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' @@ -2707,35 +3415,29 @@ parameters: path: tests/SAML2/XML/saml/EncryptedIDTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\AnyURIValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\AnyURIValue\.$#' identifier: class.notFound count: 10 path: tests/SAML2/XML/saml/EncryptedIDTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/XML/saml/EncryptedIDTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/saml/EncryptedIDTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 4 path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject - count: 3 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' identifier: new.noConstructor @@ -2779,7 +3481,7 @@ parameters: path: tests/SAML2/XML/saml/ProxyRestrictionTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/ProxyRestrictionTest.php @@ -2790,6 +3492,12 @@ parameters: count: 2 path: tests/SAML2/XML/saml/ProxyRestrictionTest.php + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/StatementTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' identifier: method.notFound @@ -2803,7 +3511,7 @@ parameters: path: tests/SAML2/XML/saml/StatementTest.php - - message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XML\\Type\\QNameValue\.$#' + message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/StatementTest.php @@ -2851,19 +3559,19 @@ parameters: path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 6 path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php @@ -2899,17 +3607,35 @@ parameters: path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' identifier: class.notFound count: 3 path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 4 + path: tests/SAML2/XML/saml/SubjectConfirmationTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2922,6 +3648,12 @@ parameters: count: 1 path: tests/SAML2/XML/saml/SubjectLocalityTest.php + - + message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/saml/SubjectTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -2947,13 +3679,13 @@ parameters: path: tests/SAML2/XML/saml/SubjectTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 3 path: tests/SAML2/XML/saml/SubjectTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\StringValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' identifier: class.notFound count: 9 path: tests/SAML2/XML/saml/SubjectTest.php @@ -2964,6 +3696,18 @@ parameters: count: 1 path: tests/SAML2/XML/saml/SubjectTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/saml/SubjectTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 3 + path: tests/SAML2/XML/saml/SubjectTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' identifier: method.notFound @@ -2989,11 +3733,23 @@ parameters: path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 3 path: tests/SAML2/XML/samlp/AbstractMessageTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AbstractMessageTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/samlp/AbstractMessageTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage\:\:getContent\(\)\.$#' identifier: method.notFound @@ -3025,7 +3781,7 @@ parameters: path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php @@ -3036,6 +3792,18 @@ parameters: count: 2 path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -3049,13 +3817,13 @@ parameters: path: tests/SAML2/XML/samlp/ArtifactResolveTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/ArtifactResolveTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/ArtifactResolveTest.php @@ -3085,25 +3853,25 @@ parameters: path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/ArtifactTest.php @@ -3133,13 +3901,13 @@ parameters: path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php @@ -3181,11 +3949,35 @@ parameters: path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/samlp/AttributeQueryTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 5 + path: tests/SAML2/XML/samlp/AttributeQueryTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -3205,7 +3997,7 @@ parameters: path: tests/SAML2/XML/samlp/AuthnQueryTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/AuthnQueryTest.php @@ -3228,6 +4020,12 @@ parameters: count: 1 path: tests/SAML2/XML/samlp/AuthnRequestTest.php + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' identifier: method.notFound @@ -3277,35 +4075,29 @@ parameters: path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedShortValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 4 path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' identifier: new.noConstructor @@ -3330,6 +4122,24 @@ parameters: count: 1 path: tests/SAML2/XML/samlp/AuthnRequestTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 3 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 4 + path: tests/SAML2/XML/samlp/AuthnRequestTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -3349,7 +4159,7 @@ parameters: path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php @@ -3414,12 +4224,30 @@ parameters: count: 2 path: tests/SAML2/XML/samlp/IDPListTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/IDPListTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 1 + path: tests/SAML2/XML/samlp/IDPListTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' identifier: method.notFound count: 2 path: tests/SAML2/XML/samlp/LogoutRequestTest.php + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' identifier: method.notFound @@ -3451,21 +4279,33 @@ parameters: path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 7 path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject + message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' + identifier: new.noConstructor + count: 6 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' + identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 6 + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/LogoutRequestTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 path: tests/SAML2/XML/samlp/LogoutRequestTest.php - @@ -3487,17 +4327,29 @@ parameters: path: tests/SAML2/XML/samlp/LogoutResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/LogoutResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/LogoutResponseTest.php + - + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' + identifier: class.notFound + count: 2 + path: tests/SAML2/XML/samlp/MessageFactoryTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' + identifier: argument.type + count: 2 + path: tests/SAML2/XML/samlp/MessageFactoryTest.php + - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' identifier: staticMethod.notFound @@ -3511,7 +4363,7 @@ parameters: path: tests/SAML2/XML/samlp/NameIDPolicyTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/NameIDPolicyTest.php @@ -3535,7 +4387,13 @@ parameters: path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php - - message: '#^Parameter \#1 \$requestedAuthnContexts of class SimpleSAML\\SAML2\\XML\\samlp\\RequestedAuthnContext constructor expects array\, array\ given\.$#' + message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' + identifier: class.notFound + count: 1 + path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php + + - + message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' identifier: argument.type count: 1 path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php @@ -3571,13 +4429,13 @@ parameters: path: tests/SAML2/XML/samlp/ResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/ResponseTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/samlp/ResponseTest.php @@ -3601,7 +4459,7 @@ parameters: path: tests/SAML2/XML/samlp/ScopingTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\NonNegativeIntegerValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/samlp/ScopingTest.php @@ -3673,19 +4531,19 @@ parameters: path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XML\\Type\\UnsignedByteValue\.$#' + message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedByteValue\.$#' identifier: class.notFound count: 1 path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\Base64BinaryValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php @@ -3703,13 +4561,13 @@ parameters: path: tests/SAML2/XML/shibmd/ScopeTest.php - - message: '#^Call to method toBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to method toBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/shibmd/ScopeTest.php - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XML\\Type\\BooleanValue\.$#' + message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' identifier: class.notFound count: 2 path: tests/SAML2/XML/shibmd/ScopeTest.php @@ -3823,13 +4681,13 @@ parameters: path: tests/bin/signedresponse_with_signedassertion.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/bin/signedresponse_with_signedassertion.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/bin/signedresponse_with_signedassertion.php @@ -3853,13 +4711,13 @@ parameters: path: tests/bin/signedresponse_with_unsignedassertion.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/bin/signedresponse_with_unsignedassertion.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/bin/signedresponse_with_unsignedassertion.php @@ -3883,13 +4741,13 @@ parameters: path: tests/bin/unsignedresponse_with_signedassertion.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' identifier: class.notFound count: 1 path: tests/bin/unsignedresponse_with_signedassertion.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\NCNameValue\.$#' + message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' identifier: class.notFound count: 1 path: tests/bin/unsignedresponse_with_signedassertion.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 954f8e8207..6930ce98fc 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,281 +1,433 @@ parameters: ignoreErrors: - - message: "#^Call to an undefined method SimpleSAML\\\\SAML2\\\\XML\\\\samlp\\\\AbstractMessage\\:\\:addValidator\\(\\)\\.$#" + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\AbstractMessage\:\:addValidator\(\)\.$#' + identifier: method.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Call to an undefined method SimpleSAML\\\\SAML2\\\\XML\\\\samlp\\\\ArtifactResponse\\:\\:validate\\(\\)\\.$#" + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\ArtifactResponse\:\:validate\(\)\.$#' + identifier: method.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Call to method addURLparameters\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\HTTP\\.$#" + message: '#^Call to method addURLparameters\(\) on an unknown class SimpleSAML\\Utils\\HTTP\.$#' + identifier: class.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Call to method getString\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getString\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Call to static method addSign\\(\\) on an unknown class SimpleSAML\\\\Module\\\\saml\\\\Message\\.$#" + message: '#^Call to static method addSign\(\) on an unknown class SimpleSAML\\Module\\saml\\Message\.$#' + identifier: class.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to static method getInstance\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Binding/HTTPArtifact.php - - message: "#^Call to static method getInstance\\(\\) on an unknown class SimpleSAML\\\\Store\\\\StoreFactory\\.$#" + message: '#^Call to static method getInstance\(\) on an unknown class SimpleSAML\\Store\\StoreFactory\.$#' + identifier: class.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Call to static method getMetadataHandler\\(\\) on an unknown class SimpleSAML\\\\Metadata\\\\MetaDataStorageHandler\\.$#" + message: '#^Call to static method getMetadataHandler\(\) on an unknown class SimpleSAML\\Metadata\\MetaDataStorageHandler\.$#' + identifier: class.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Instantiated class SimpleSAML\\\\Utils\\\\HTTP not found\\.$#" + message: '#^Instantiated class SimpleSAML\\Utils\\HTTP not found\.$#' + identifier: class.notFound count: 1 path: src/Binding/HTTPArtifact.php - - message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:validateSignature\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + message: '#^Parameter \$key of method SimpleSAML\\SAML2\\Binding\\HTTPArtifact\:\:validateSignature\(\) has invalid type SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 2 path: src/Binding/HTTPArtifact.php - - message: "#^Parameter \\$sp of method SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:setSPMetadata\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$sp of method SimpleSAML\\SAML2\\Binding\\HTTPArtifact\:\:setSPMetadata\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Binding/HTTPArtifact.php - - message: "#^Property SimpleSAML\\\\SAML2\\\\Binding\\\\HTTPArtifact\\:\\:\\$spMetadata has unknown class SimpleSAML\\\\Configuration as its type\\.$#" + message: '#^Property SimpleSAML\\SAML2\\Binding\\HTTPArtifact\:\:\$spMetadata has unknown class SimpleSAML\\Configuration as its type\.$#' + identifier: class.notFound count: 2 path: src/Binding/HTTPArtifact.php - - message: "#^Call to an undefined method SimpleSAML\\\\XMLSecurity\\\\XML\\\\ds\\\\SignatureValue\\:\\:getContent\\(\\)\\.$#" + message: '#^Call to an undefined method SimpleSAML\\XMLSecurity\\XML\\ds\\SignatureValue\:\:getContent\(\)\.$#' + identifier: method.notFound count: 1 path: src/Binding/HTTPRedirect.php - - message: "#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + message: '#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 1 path: src/Certificate/PrivateKeyLoader.php - - message: "#^Access to property \\$passphrase on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + message: '#^Access to property \$passphrase on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 2 path: src/Certificate/PrivateKeyLoader.php - - message: "#^Call to method loadKey\\(\\) on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + message: '#^Call to method loadKey\(\) on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 2 path: src/Certificate/PrivateKeyLoader.php - - message: "#^Instantiated class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey not found\\.$#" + message: '#^Instantiated class SimpleSAML\\XMLSecurity\\XMLSecurityKey not found\.$#' + identifier: class.notFound count: 2 path: src/Certificate/PrivateKeyLoader.php - - message: "#^Method SimpleSAML\\\\SAML2\\\\Certificate\\\\PrivateKeyLoader\\:\\:convertPrivateKeyToRsaKey\\(\\) has invalid return type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + message: '#^Method SimpleSAML\\SAML2\\Certificate\\PrivateKeyLoader\:\:convertPrivateKeyToRsaKey\(\) has invalid return type SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 2 path: src/Certificate/PrivateKeyLoader.php - - message: "#^Call to method getArray\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getArray\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 1 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Call to method getBoolean\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getBoolean\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Call to method getString\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getString\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 10 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Call to method getValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 1 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Call to method hasValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method hasValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 7 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:convertToIdentityProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:convertToServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:convertToServiceProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForDecryptionProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForDecryptionProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForIdentityProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForIdentityProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:enrichForServiceProvider\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForServiceProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Parameter \\$configuration of method SimpleSAML\\\\SAML2\\\\Configuration\\\\SimpleSAMLConverter\\:\\:pluckConfiguration\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:pluckConfiguration\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/Configuration/SimpleSAMLConverter.php - - message: "#^Access to property \\$key on an unknown class SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + message: '#^Access to property \$key on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: "#^Call to an undefined method SimpleSAML\\\\SAML2\\\\XML\\\\samlp\\\\AbstractMessage\\:\\:addValidator\\(\\)\\.$#" + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\AbstractMessage\:\:addValidator\(\)\.$#' + identifier: method.notFound count: 1 path: src/SOAPClient.php - - message: "#^Call to method getCertPath\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\Config\\.$#" + message: '#^Call to method getCertPath\(\) on an unknown class SimpleSAML\\Utils\\Config\.$#' + identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: "#^Call to method getPublicKeys\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getPublicKeys\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: "#^Call to method getString\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getString\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 3 path: src/SOAPClient.php - - message: "#^Call to method getValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 3 path: src/SOAPClient.php - - message: "#^Call to method hasValue\\(\\) on an unknown class SimpleSAML\\\\Configuration\\.$#" + message: '#^Call to method hasValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 5 path: src/SOAPClient.php - - message: "#^Call to method loadPrivateKey\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\Crypto\\.$#" + message: '#^Call to method loadPrivateKey\(\) on an unknown class SimpleSAML\\Utils\\Crypto\.$#' + identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: "#^Call to method loadPublicKey\\(\\) on an unknown class SimpleSAML\\\\Utils\\\\Crypto\\.$#" + message: '#^Call to method loadPublicKey\(\) on an unknown class SimpleSAML\\Utils\\Crypto\.$#' + identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Config not found\\.$#" + message: '#^Instantiated class SimpleSAML\\Utils\\Config not found\.$#' + identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: "#^Instantiated class SimpleSAML\\\\Utils\\\\Crypto not found\\.$#" + message: '#^Instantiated class SimpleSAML\\Utils\\Crypto not found\.$#' + identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: "#^Parameter \\$dstMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$dstMetadata of method SimpleSAML\\SAML2\\SOAPClient\:\:send\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/SOAPClient.php - - message: "#^Parameter \\$key of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:validateSSL\\(\\) has invalid type SimpleSAML\\\\XMLSecurity\\\\XMLSecurityKey\\.$#" + message: '#^Parameter \$key of method SimpleSAML\\SAML2\\SOAPClient\:\:validateSSL\(\) has invalid type SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 2 path: src/SOAPClient.php - - message: "#^Parameter \\$srcMetadata of method SimpleSAML\\\\SAML2\\\\SOAPClient\\:\\:send\\(\\) has invalid type SimpleSAML\\\\Configuration\\.$#" + message: '#^Parameter \$srcMetadata of method SimpleSAML\\SAML2\\SOAPClient\:\:send\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/SOAPClient.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/alg/DigestMethod.php + + - + message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/alg/SigningMethod.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 2 + path: src/XML/md/AbstractEndpointType.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 2 path: src/XML/md/AbstractEndpointType.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 2 path: src/XML/md/AbstractIndexedEndpointType.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 2 path: src/XML/md/AbstractLocalizedName.php - - message: "#^Call to an undefined static method SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractSignedMdElement\\:\\:getXsiTypeNamespaceURI\\(\\)\\.$#" + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/md/AbstractRoleDescriptorType.php + + - + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\XML\\md\\AbstractSignedMdElement\:\:getXsiTypeNamespaceURI\(\)\.$#' + identifier: staticMethod.notFound count: 1 path: src/XML/md/AbstractSignedMdElement.php - - message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\AbstractElement\\:\\:getList\\(\\)\\.$#" + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/md/AffiliationDescriptor.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound count: 1 path: src/XML/md/ContactPerson.php - - message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\AbstractElement\\:\\:getList\\(\\)\\.$#" + message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/XML/md/ContactPerson.php + + - + message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' + identifier: method.notFound count: 1 path: src/XML/md/EntitiesDescriptor.php - - message: "#^Call to an undefined method SimpleSAML\\\\XML\\\\AbstractElement\\:\\:getList\\(\\)\\.$#" + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/md/EntityDescriptor.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound count: 1 path: src/XML/md/Organization.php - - message: "#^Call to an undefined method DOMDocument\\:\\:setAttribute\\(\\)\\.$#" + message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' + identifier: method.notFound count: 1 - path: src/XML/mdui/Keywords.php + path: src/XML/md/Organization.php - - message: "#^Call to an undefined method SimpleSAML\\\\XMLSchema\\\\Type\\\\Interface\\\\ValueTypeInterface\\:\\:toArray\\(\\)\\.$#" + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/mdui/DiscoHints.php + + - + message: '#^Call to an undefined method SimpleSAML\\XMLSchema\\Type\\Interface\\ValueTypeInterface\:\:toArray\(\)\.$#' + identifier: method.notFound count: 1 path: src/XML/mdui/Keywords.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/mdui/UIInfo.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/saml/Advice.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound count: 1 path: src/XML/saml/Attribute.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/XML/saml/Attribute.php + + - + message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 2 + path: src/XML/saml/AuthnContextDecl.php + + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 1 path: src/XML/saml/EncryptedAttribute.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 1 path: src/XML/saml/EncryptedID.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 1 path: src/XML/saml/NameIDType.php + + - + message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/saml/SubjectConfirmationData.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/saml/SubjectConfirmationData.php + + - + message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/samlp/StatusDetail.php + + - + message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' + identifier: class.notFound + count: 1 + path: src/XML/shibmd/KeyAuthority.php diff --git a/src/Assert/SAMLAnyURITrait.php b/src/Assert/SAMLAnyURITrait.php index 4f6d39d57d..dcc9769c69 100644 --- a/src/Assert/SAMLAnyURITrait.php +++ b/src/Assert/SAMLAnyURITrait.php @@ -14,6 +14,7 @@ trait SAMLAnyURITrait { private static string $scheme_regex = '/^([a-z][a-z0-9\+\-\.]+[:])/i'; + /** * @param string $value * @param string $message diff --git a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php index 5a74a25510..d2b85ca29d 100644 --- a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php +++ b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatches.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator; -use SimpleSAML\SAML2\Assertion\Validation\{Result, SubjectConfirmationConstraintValidator}; +use SimpleSAML\SAML2\Assertion\Validation\Result; +use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationConstraintValidator; use SimpleSAML\SAML2\Configuration\Destination; use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; diff --git a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php index cf794a031a..0158473242 100644 --- a/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php +++ b/src/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatches.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator; -use SimpleSAML\SAML2\Assertion\Validation\{Result, SubjectConfirmationConstraintValidator}; +use SimpleSAML\SAML2\Assertion\Validation\Result; +use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationConstraintValidator; use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; use SimpleSAML\SAML2\XML\samlp\Response; diff --git a/src/Binding/SOAP.php b/src/Binding/SOAP.php index a87cdc3030..4bf651a231 100644 --- a/src/Binding/SOAP.php +++ b/src/Binding/SOAP.php @@ -6,18 +6,22 @@ use Exception; use Nyholm\Psr7\Response; -use Psr\Http\Message\{ResponseInterface, ServerRequestInterface}; +use Psr\Http\Message\ResponseInterface; +use Psr\Http\Message\ServerRequestInterface; use SimpleSAML\SAML2\Binding; use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\ecp\{RequestAuthenticated, Response as ECPResponse}; +use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated; +use SimpleSAML\SAML2\XML\ecp\Response as ECPResponse; use SimpleSAML\SAML2\XML\samlp\AbstractMessage; use SimpleSAML\SAML2\XML\samlp\MessageFactory; use SimpleSAML\SAML2\XML\samlp\Response as SAML2_Response; use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\SOAP11\Utils\XPath; -use SimpleSAML\SOAP11\XML\{Body, Envelope, Header}; +use SimpleSAML\SOAP11\XML\Body; +use SimpleSAML\SOAP11\XML\Envelope; +use SimpleSAML\SOAP11\XML\Header; use SimpleSAML\XML\DOMDocumentFactory; use function file_get_contents; diff --git a/src/Compat/AbstractContainer.php b/src/Compat/AbstractContainer.php index ca4baed805..1e7660df7c 100644 --- a/src/Compat/AbstractContainer.php +++ b/src/Compat/AbstractContainer.php @@ -8,7 +8,8 @@ use Psr\Log\LoggerInterface; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\ExtensionPointInterface; -use SimpleSAML\XML\{AbstractElement, ElementInterface}; +use SimpleSAML\XML\AbstractElement; +use SimpleSAML\XML\ElementInterface; use SimpleSAML\XMLSchema\Type\QNameValue; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; diff --git a/src/SOAPClient.php b/src/SOAPClient.php index d8aebb927a..5ab61ab956 100644 --- a/src/SOAPClient.php +++ b/src/SOAPClient.php @@ -11,7 +11,9 @@ use SimpleSAML\SAML2\XML\samlp\AbstractMessage; use SimpleSAML\SAML2\XML\samlp\MessageFactory; use SimpleSAML\SOAP11\Utils\XPath; -use SimpleSAML\SOAP11\XML\{Body, Envelope, Fault}; +use SimpleSAML\SOAP11\XML\Body; +use SimpleSAML\SOAP11\XML\Envelope; +use SimpleSAML\SOAP11\XML\Fault; use SimpleSAML\Utils\Config; use SimpleSAML\Utils\Crypto; use SimpleSAML\XML\Chunk; diff --git a/src/Type/EntityIDValue.php b/src/Type/EntityIDValue.php index 1d38808fbd..33f96e1a9e 100644 --- a/src/Type/EntityIDValue.php +++ b/src/Type/EntityIDValue.php @@ -23,6 +23,7 @@ class EntityIDValue extends SAMLAnyURIValue /** @var string */ public const SCHEMA_NAMESPACE_PREFIX = AbstractMdElement::NS_PREFIX; + /** * Validate the value. * diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index 8c1ad3da48..95cadcc8e2 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -9,7 +9,8 @@ use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\AbstractElement; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\XML\EncryptedElementTrait as ParentEncryptedElementTrait; diff --git a/src/XML/ExtensionPointInterface.php b/src/XML/ExtensionPointInterface.php index 420c4ce76f..887458a1b6 100644 --- a/src/XML/ExtensionPointInterface.php +++ b/src/XML/ExtensionPointInterface.php @@ -4,7 +4,9 @@ namespace SimpleSAML\SAML2\XML; -use SimpleSAML\XMLSchema\Type\{AnyURIValue, NCNameValue, QNameValue}; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Interface for several extension points objects. diff --git a/src/XML/ExtensionPointTrait.php b/src/XML/ExtensionPointTrait.php index 34b754c659..ac9a5e5b46 100644 --- a/src/XML/ExtensionPointTrait.php +++ b/src/XML/ExtensionPointTrait.php @@ -6,7 +6,8 @@ use RuntimeException; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XMLSchema\Type\{AnyURIValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use function constant; use function defined; diff --git a/src/XML/IdentifierTrait.php b/src/XML/IdentifierTrait.php index d0a5832185..51f6a90b60 100644 --- a/src/XML/IdentifierTrait.php +++ b/src/XML/IdentifierTrait.php @@ -6,7 +6,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, EncryptedID, IdentifierInterface, NameID}; +use SimpleSAML\SAML2\XML\saml\AbstractBaseID; +use SimpleSAML\SAML2\XML\saml\EncryptedID; +use SimpleSAML\SAML2\XML\saml\IdentifierInterface; +use SimpleSAML\SAML2\XML\saml\NameID; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; diff --git a/src/XML/SignableElementTrait.php b/src/XML/SignableElementTrait.php index c4b284f56f..0d52cac2c9 100644 --- a/src/XML/SignableElementTrait.php +++ b/src/XML/SignableElementTrait.php @@ -8,21 +8,21 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XMLSchema\Type\{AnyURIValue, Base64BinaryValue}; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmInterface; use SimpleSAML\XMLSecurity\Constants as C; -use SimpleSAML\XMLSecurity\Exception\{RuntimeException, UnsupportedAlgorithmException}; +use SimpleSAML\XMLSecurity\Exception\RuntimeException; +use SimpleSAML\XMLSecurity\Exception\UnsupportedAlgorithmException; use SimpleSAML\XMLSecurity\Utils\XML; -use SimpleSAML\XMLSecurity\XML\ds\{ - CanonicalizationMethod, - KeyInfo, - Signature, - SignatureMethod, - SignatureValue, - SignedInfo, - Transform, - Transforms, -}; +use SimpleSAML\XMLSecurity\XML\ds\CanonicalizationMethod; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\Signature; +use SimpleSAML\XMLSecurity\XML\ds\SignatureMethod; +use SimpleSAML\XMLSecurity\XML\ds\SignatureValue; +use SimpleSAML\XMLSecurity\XML\ds\SignedInfo; +use SimpleSAML\XMLSecurity\XML\ds\Transform; +use SimpleSAML\XMLSecurity\XML\ds\Transforms; use SimpleSAML\XMLSecurity\XML\SignableElementTrait as BaseSignableElementTrait; use function base64_encode; diff --git a/src/XML/alg/DigestMethod.php b/src/XML/alg/DigestMethod.php index 59427766df..1b7994129f 100644 --- a/src/XML/alg/DigestMethod.php +++ b/src/XML/alg/DigestMethod.php @@ -8,7 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/alg/SigningMethod.php b/src/XML/alg/SigningMethod.php index 1c110b1d63..09cd28a230 100644 --- a/src/XML/alg/SigningMethod.php +++ b/src/XML/alg/SigningMethod.php @@ -8,7 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/ecp/RelayState.php b/src/XML/ecp/RelayState.php index 27f6af6a0d..7f04c58941 100644 --- a/src/XML/ecp/RelayState.php +++ b/src/XML/ecp/RelayState.php @@ -10,9 +10,11 @@ use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SOAP11\Constants as C; use SimpleSAML\SOAP11\Type\MustUnderstandValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; /** * Class representing the ECP RelayState element. @@ -24,6 +26,7 @@ final class RelayState extends AbstractEcpElement implements SchemaValidatableEl use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; diff --git a/src/XML/ecp/Request.php b/src/XML/ecp/Request.php index 160e53c2d0..e43130243c 100644 --- a/src/XML/ecp/Request.php +++ b/src/XML/ecp/Request.php @@ -12,8 +12,11 @@ use SimpleSAML\SAML2\XML\samlp\IDPList; use SimpleSAML\SOAP11\Constants as C; use SimpleSAML\SOAP11\Type\MustUnderstandValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\BooleanValue; use function intval; diff --git a/src/XML/ecp/RequestAuthenticated.php b/src/XML/ecp/RequestAuthenticated.php index 40643a92cb..a066dc89a5 100644 --- a/src/XML/ecp/RequestAuthenticated.php +++ b/src/XML/ecp/RequestAuthenticated.php @@ -9,8 +9,10 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SOAP11\Constants as C; use SimpleSAML\SOAP11\Type\MustUnderstandValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; /** * Class representing the ECP RequestAuthenticated element. diff --git a/src/XML/ecp/Response.php b/src/XML/ecp/Response.php index f801778282..1e272697b7 100644 --- a/src/XML/ecp/Response.php +++ b/src/XML/ecp/Response.php @@ -10,8 +10,10 @@ use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SOAP11\Constants as C; use SimpleSAML\SOAP11\Type\MustUnderstandValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; /** * Class representing the ECP Response element. diff --git a/src/XML/ecp/SubjectConfirmation.php b/src/XML/ecp/SubjectConfirmation.php index 2ee38a7281..32ab09f9f0 100644 --- a/src/XML/ecp/SubjectConfirmation.php +++ b/src/XML/ecp/SubjectConfirmation.php @@ -11,8 +11,11 @@ use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; use SimpleSAML\SOAP11\Constants as C; use SimpleSAML\SOAP11\Type\MustUnderstandValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; /** * Class representing the ECP SubjectConfirmation element. diff --git a/src/XML/emd/RepublishRequest.php b/src/XML/emd/RepublishRequest.php index a5fafff191..10cfbf8dde 100644 --- a/src/XML/emd/RepublishRequest.php +++ b/src/XML/emd/RepublishRequest.php @@ -9,8 +9,10 @@ use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use function array_pop; diff --git a/src/XML/emd/RepublishTarget.php b/src/XML/emd/RepublishTarget.php index d2726223e8..2e1483d8b7 100644 --- a/src/XML/emd/RepublishTarget.php +++ b/src/XML/emd/RepublishTarget.php @@ -17,6 +17,7 @@ final class RepublishTarget extends AbstractEmdElement { use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; diff --git a/src/XML/idpdisc/DiscoveryResponse.php b/src/XML/idpdisc/DiscoveryResponse.php index f319c511ff..75dc661d5f 100644 --- a/src/XML/idpdisc/DiscoveryResponse.php +++ b/src/XML/idpdisc/DiscoveryResponse.php @@ -9,8 +9,10 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; /** * Abstract class to be implemented by all the classes in this namespace diff --git a/src/XML/init/RequestInitiator.php b/src/XML/init/RequestInitiator.php index aff1551dcd..005414b8ea 100644 --- a/src/XML/init/RequestInitiator.php +++ b/src/XML/init/RequestInitiator.php @@ -9,7 +9,8 @@ use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\md\AbstractEndpointType; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/md/AbstractEndpointType.php b/src/XML/md/AbstractEndpointType.php index 458e47e6e2..a2975299f0 100644 --- a/src/XML/md/AbstractEndpointType.php +++ b/src/XML/md/AbstractEndpointType.php @@ -10,7 +10,8 @@ use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait}; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/md/AbstractIndexedEndpointType.php b/src/XML/md/AbstractIndexedEndpointType.php index 94ee488db8..e498912986 100644 --- a/src/XML/md/AbstractIndexedEndpointType.php +++ b/src/XML/md/AbstractIndexedEndpointType.php @@ -12,7 +12,8 @@ use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function array_filter; use function array_key_exists; diff --git a/src/XML/md/AbstractLocalizedName.php b/src/XML/md/AbstractLocalizedName.php index 1de1eea368..ae6aed9f5d 100644 --- a/src/XML/md/AbstractLocalizedName.php +++ b/src/XML/md/AbstractLocalizedName.php @@ -6,12 +6,13 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\TypedTextContentTrait; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\LanguageValue; use function array_key_first; @@ -25,6 +26,7 @@ abstract class AbstractLocalizedName extends AbstractMdElement implements Arrayi { use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; diff --git a/src/XML/md/AbstractLocalizedURI.php b/src/XML/md/AbstractLocalizedURI.php index 15d253912e..88331a5dc5 100644 --- a/src/XML/md/AbstractLocalizedURI.php +++ b/src/XML/md/AbstractLocalizedURI.php @@ -7,8 +7,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\LanguageValue; use function array_key_first; diff --git a/src/XML/md/AbstractMetadataDocument.php b/src/XML/md/AbstractMetadataDocument.php index d42da13463..5beadee153 100644 --- a/src/XML/md/AbstractMetadataDocument.php +++ b/src/XML/md/AbstractMetadataDocument.php @@ -6,12 +6,16 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\XML\ExtendableElementTrait; -use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, PublicationPath, RegistrationInfo}; -use SimpleSAML\SAML2\XML\mdui\{DiscoHints, UIInfo}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; +use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; +use SimpleSAML\SAML2\XML\mdui\DiscoHints; +use SimpleSAML\SAML2\XML\mdui\UIInfo; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; /** * Class to represent a metadata document diff --git a/src/XML/md/AbstractRoleDescriptor.php b/src/XML/md/AbstractRoleDescriptor.php index 457dde0b2e..3d2975d59f 100644 --- a/src/XML/md/AbstractRoleDescriptor.php +++ b/src/XML/md/AbstractRoleDescriptor.php @@ -7,14 +7,22 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; +use SimpleSAML\SAML2\XML\ExtensionPointInterface; +use SimpleSAML\SAML2\XML\ExtensionPointTrait; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, QNameValue}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; use function array_pop; diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index 1bb3271a85..12da032ce3 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -8,9 +8,12 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function strval; diff --git a/src/XML/md/AbstractSSODescriptor.php b/src/XML/md/AbstractSSODescriptor.php index ddb5051f33..2e01d84b85 100644 --- a/src/XML/md/AbstractSSODescriptor.php +++ b/src/XML/md/AbstractSSODescriptor.php @@ -7,9 +7,12 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XMLSchema\Type\{IDValue, DurationValue}; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; /** * Class representing SAML 2 SSODescriptorType. diff --git a/src/XML/md/AbstractSignedMdElement.php b/src/XML/md/AbstractSignedMdElement.php index 11cac83037..17e699f4f2 100644 --- a/src/XML/md/AbstractSignedMdElement.php +++ b/src/XML/md/AbstractSignedMdElement.php @@ -5,8 +5,10 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\SAML2\XML\{SignableElementTrait, SignedElementTrait}; -use SimpleSAML\XMLSecurity\XML\{SignableElementInterface, SignedElementInterface}; +use SimpleSAML\SAML2\XML\SignableElementTrait; +use SimpleSAML\SAML2\XML\SignedElementTrait; +use SimpleSAML\XMLSecurity\XML\SignableElementInterface; +use SimpleSAML\XMLSecurity\XML\SignedElementInterface; use function method_exists; diff --git a/src/XML/md/AdditionalMetadataLocation.php b/src/XML/md/AdditionalMetadataLocation.php index 08838ca9d6..5026008099 100644 --- a/src/XML/md/AdditionalMetadataLocation.php +++ b/src/XML/md/AdditionalMetadataLocation.php @@ -7,7 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/md/AffiliateMember.php b/src/XML/md/AffiliateMember.php index af960d3274..e8e6be83f8 100644 --- a/src/XML/md/AffiliateMember.php +++ b/src/XML/md/AffiliateMember.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\md; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class AffiliateMember extends AbstractMdElement implements SchemaValidatab use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = EntityIDValue::class; } diff --git a/src/XML/md/AffiliationDescriptor.php b/src/XML/md/AffiliationDescriptor.php index 2fb445093f..318b063650 100644 --- a/src/XML/md/AffiliationDescriptor.php +++ b/src/XML/md/AffiliationDescriptor.php @@ -7,10 +7,15 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue}; -use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use SimpleSAML\XMLSecurity\XML\ds\Signature; diff --git a/src/XML/md/ArtifactResolutionService.php b/src/XML/md/ArtifactResolutionService.php index 1df85fe268..a4417d0d84 100644 --- a/src/XML/md/ArtifactResolutionService.php +++ b/src/XML/md/ArtifactResolutionService.php @@ -6,8 +6,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; /** * A class implementing the md:ArtifactResolutionService element. diff --git a/src/XML/md/AssertionConsumerService.php b/src/XML/md/AssertionConsumerService.php index 090f347459..b234a0b3ae 100644 --- a/src/XML/md/AssertionConsumerService.php +++ b/src/XML/md/AssertionConsumerService.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class implementing the md:AssertionConsumerService element. diff --git a/src/XML/md/AttributeAuthorityDescriptor.php b/src/XML/md/AttributeAuthorityDescriptor.php index b337d434c0..6658a88bcd 100644 --- a/src/XML/md/AttributeAuthorityDescriptor.php +++ b/src/XML/md/AttributeAuthorityDescriptor.php @@ -6,12 +6,18 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** diff --git a/src/XML/md/AttributeConsumingService.php b/src/XML/md/AttributeConsumingService.php index da522c545a..549da9f176 100644 --- a/src/XML/md/AttributeConsumingService.php +++ b/src/XML/md/AttributeConsumingService.php @@ -7,9 +7,12 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function var_export; diff --git a/src/XML/md/AttributeProfile.php b/src/XML/md/AttributeProfile.php index 85cb0409d8..d78326cc46 100644 --- a/src/XML/md/AttributeProfile.php +++ b/src/XML/md/AttributeProfile.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\md; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class AttributeProfile extends AbstractMdElement implements SchemaValidata use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/md/AttributeService.php b/src/XML/md/AttributeService.php index 43d60cafe9..c0626f728e 100644 --- a/src/XML/md/AttributeService.php +++ b/src/XML/md/AttributeService.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * AttributeService elements of type EndpointType diff --git a/src/XML/md/AuthnAuthorityDescriptor.php b/src/XML/md/AuthnAuthorityDescriptor.php index c1ce775fe9..4bae53661a 100644 --- a/src/XML/md/AuthnAuthorityDescriptor.php +++ b/src/XML/md/AuthnAuthorityDescriptor.php @@ -6,11 +6,16 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** diff --git a/src/XML/md/Company.php b/src/XML/md/Company.php index 97ade90bf3..45cad9ad3c 100644 --- a/src/XML/md/Company.php +++ b/src/XML/md/Company.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\md; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class Company extends AbstractMdElement implements SchemaValidatableElemen use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/ContactPerson.php b/src/XML/md/ContactPerson.php index 71c417f533..7854831074 100644 --- a/src/XML/md/ContactPerson.php +++ b/src/XML/md/ContactPerson.php @@ -7,13 +7,16 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Type\{EmailAddressValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function array_change_key_case; diff --git a/src/XML/md/EmailAddress.php b/src/XML/md/EmailAddress.php index 0b651b33c5..c09cda195f 100644 --- a/src/XML/md/EmailAddress.php +++ b/src/XML/md/EmailAddress.php @@ -7,12 +7,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\EmailAddressValue; -use SimpleSAML\XML\{ - ArrayizableElementInterface, - SchemaValidatableElementInterface, - SchemaValidatableElementTrait, - TypedTextContentTrait, -}; +use SimpleSAML\XML\ArrayizableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; use function preg_filter; @@ -29,6 +27,7 @@ final class EmailAddress extends AbstractMdElement implements use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = EmailAddressValue::class; diff --git a/src/XML/md/EncryptionMethod.php b/src/XML/md/EncryptionMethod.php index 6fe8f3369e..6116d02bdf 100644 --- a/src/XML/md/EncryptionMethod.php +++ b/src/XML/md/EncryptionMethod.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\XML\xenc\AbstractEncryptionMethod; /** diff --git a/src/XML/md/EntitiesDescriptor.php b/src/XML/md/EntitiesDescriptor.php index cab1e0914c..415927093f 100644 --- a/src/XML/md/EntitiesDescriptor.php +++ b/src/XML/md/EntitiesDescriptor.php @@ -7,18 +7,24 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, PublicationPath, RegistrationInfo}; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; +use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; -use function count; use function array_filter; use function array_merge; use function array_values; +use function count; /** * Class representing SAML 2 EntitiesDescriptor element. diff --git a/src/XML/md/EntityDescriptor.php b/src/XML/md/EntityDescriptor.php index c232ff7303..837e65fdda 100644 --- a/src/XML/md/EntityDescriptor.php +++ b/src/XML/md/EntityDescriptor.php @@ -8,10 +8,15 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue}; -use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use SimpleSAML\XMLSecurity\XML\ds\Signature; diff --git a/src/XML/md/Extensions.php b/src/XML/md/Extensions.php index aa308e87fe..01481d80eb 100644 --- a/src/XML/md/Extensions.php +++ b/src/XML/md/Extensions.php @@ -7,30 +7,25 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\alg\{ - AbstractAlgElement as ALG, - DigestMethod, - SigningMethod, -}; +use SimpleSAML\SAML2\XML\alg\AbstractAlgElement as ALG; +use SimpleSAML\SAML2\XML\alg\DigestMethod; +use SimpleSAML\SAML2\XML\alg\SigningMethod; use SimpleSAML\SAML2\XML\emd\RepublishRequest; use SimpleSAML\SAML2\XML\ExtensionsTrait; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; use SimpleSAML\SAML2\XML\init\RequestInitiator; use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; -use SimpleSAML\SAML2\XML\mdrpi\{ - AbstractMdrpiElement as MDRPI, - PublicationInfo, - PublicationPath, - RegistrationInfo, -}; -use SimpleSAML\SAML2\XML\mdui\{ - AbstractMduiElement as MDUI, - DiscoHints, - UIInfo, -}; +use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement as MDRPI; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; +use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; +use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement as MDUI; +use SimpleSAML\SAML2\XML\mdui\DiscoHints; +use SimpleSAML\SAML2\XML\mdui\UIInfo; use SimpleSAML\SAML2\XML\shibmd\Scope; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_key_exists; diff --git a/src/XML/md/GivenName.php b/src/XML/md/GivenName.php index 8be023402c..83b7a52aac 100644 --- a/src/XML/md/GivenName.php +++ b/src/XML/md/GivenName.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\md; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class GivenName extends AbstractMdElement implements SchemaValidatableElem use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/IDPSSODescriptor.php b/src/XML/md/IDPSSODescriptor.php index c7e667f1f1..18068a9951 100644 --- a/src/XML/md/IDPSSODescriptor.php +++ b/src/XML/md/IDPSSODescriptor.php @@ -6,12 +6,18 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, DurationValue, IDValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function var_export; diff --git a/src/XML/md/IndexedElementTrait.php b/src/XML/md/IndexedElementTrait.php index 1d02b5909e..d89f1426c7 100644 --- a/src/XML/md/IndexedElementTrait.php +++ b/src/XML/md/IndexedElementTrait.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; /** * Trait adding methods to handle elements that can be indexed. diff --git a/src/XML/md/KeyDescriptor.php b/src/XML/md/KeyDescriptor.php index bc31d48ff4..d5f68060d7 100644 --- a/src/XML/md/KeyDescriptor.php +++ b/src/XML/md/KeyDescriptor.php @@ -8,8 +8,11 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\KeyTypesValue; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; use function array_pop; diff --git a/src/XML/md/NameIDFormat.php b/src/XML/md/NameIDFormat.php index 0d625da68e..10d98aa9be 100644 --- a/src/XML/md/NameIDFormat.php +++ b/src/XML/md/NameIDFormat.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\md; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class NameIDFormat extends AbstractMdElement implements SchemaValidatableE use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/md/NameIDMappingService.php b/src/XML/md/NameIDMappingService.php index 7742e5c405..0b7d6c0341 100644 --- a/src/XML/md/NameIDMappingService.php +++ b/src/XML/md/NameIDMappingService.php @@ -6,7 +6,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing an md:NameIDMappingService element. diff --git a/src/XML/md/Organization.php b/src/XML/md/Organization.php index 5fde7896c3..4791049e6d 100644 --- a/src/XML/md/Organization.php +++ b/src/XML/md/Organization.php @@ -6,13 +6,18 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use function array_change_key_case; diff --git a/src/XML/md/OrganizationDisplayName.php b/src/XML/md/OrganizationDisplayName.php index 0c30847624..a30e057005 100644 --- a/src/XML/md/OrganizationDisplayName.php +++ b/src/XML/md/OrganizationDisplayName.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A localized name representing an organization's name for display purposes. diff --git a/src/XML/md/OrganizationName.php b/src/XML/md/OrganizationName.php index bd1d7e5303..7891505fd4 100644 --- a/src/XML/md/OrganizationName.php +++ b/src/XML/md/OrganizationName.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A localized name representing an organization's name. diff --git a/src/XML/md/OrganizationURL.php b/src/XML/md/OrganizationURL.php index 17db0c4918..fd02103137 100644 --- a/src/XML/md/OrganizationURL.php +++ b/src/XML/md/OrganizationURL.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A localized name representing an organization's url. diff --git a/src/XML/md/PDPDescriptor.php b/src/XML/md/PDPDescriptor.php index 709684000a..983e421cc4 100644 --- a/src/XML/md/PDPDescriptor.php +++ b/src/XML/md/PDPDescriptor.php @@ -6,11 +6,16 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** diff --git a/src/XML/md/RequestedAttribute.php b/src/XML/md/RequestedAttribute.php index e80493959f..d8a715b3c6 100644 --- a/src/XML/md/RequestedAttribute.php +++ b/src/XML/md/RequestedAttribute.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Attribute; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; diff --git a/src/XML/md/SPSSODescriptor.php b/src/XML/md/SPSSODescriptor.php index 1772e97e66..9dc6f0e8fb 100644 --- a/src/XML/md/SPSSODescriptor.php +++ b/src/XML/md/SPSSODescriptor.php @@ -6,11 +6,17 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, DurationValue, IDValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_filter; diff --git a/src/XML/md/ServiceDescription.php b/src/XML/md/ServiceDescription.php index f10807683a..f749c6ac93 100644 --- a/src/XML/md/ServiceDescription.php +++ b/src/XML/md/ServiceDescription.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A localized name representing a service's description. diff --git a/src/XML/md/ServiceName.php b/src/XML/md/ServiceName.php index 6c3f98e3b0..58f0cf3fd6 100644 --- a/src/XML/md/ServiceName.php +++ b/src/XML/md/ServiceName.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\md; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * A localized name representing a service's name. diff --git a/src/XML/md/SingleSignOnService.php b/src/XML/md/SingleSignOnService.php index fcb4464866..10f6538f20 100644 --- a/src/XML/md/SingleSignOnService.php +++ b/src/XML/md/SingleSignOnService.php @@ -7,7 +7,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing an md:SingleSignOnService element. diff --git a/src/XML/md/SurName.php b/src/XML/md/SurName.php index f2a3143a77..6b57a2df7f 100644 --- a/src/XML/md/SurName.php +++ b/src/XML/md/SurName.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\md; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class SurName extends AbstractMdElement implements SchemaValidatableElemen use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/md/TelephoneNumber.php b/src/XML/md/TelephoneNumber.php index 9734d09c21..ca19021cbc 100644 --- a/src/XML/md/TelephoneNumber.php +++ b/src/XML/md/TelephoneNumber.php @@ -7,12 +7,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\{ - ArrayizableElementInterface, - SchemaValidatableElementInterface, - SchemaValidatableElementTrait, - TypedTextContentTrait, -}; +use SimpleSAML\XML\ArrayizableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; @@ -28,6 +26,7 @@ final class TelephoneNumber extends AbstractMdElement implements use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; diff --git a/src/XML/md/UnknownRoleDescriptor.php b/src/XML/md/UnknownRoleDescriptor.php index b74d88b3b3..604b9df8d5 100644 --- a/src/XML/md/UnknownRoleDescriptor.php +++ b/src/XML/md/UnknownRoleDescriptor.php @@ -5,9 +5,13 @@ namespace SimpleSAML\SAML2\XML\md; use DOMElement; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\XML\Chunk; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, QNameValue}; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; /** * Class representing unknown RoleDescriptors. diff --git a/src/XML/mdattr/EntityAttributes.php b/src/XML/mdattr/EntityAttributes.php index 46b1173386..c7fa26c589 100644 --- a/src/XML/mdattr/EntityAttributes.php +++ b/src/XML/mdattr/EntityAttributes.php @@ -8,8 +8,12 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\saml\{Assertion, Attribute, AttributeStatement, NameID}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeStatement; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_filter; diff --git a/src/XML/mdrpi/Publication.php b/src/XML/mdrpi/Publication.php index 12935030b8..c5aeff245a 100644 --- a/src/XML/mdrpi/Publication.php +++ b/src/XML/mdrpi/Publication.php @@ -6,10 +6,12 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/mdrpi/PublicationInfo.php b/src/XML/mdrpi/PublicationInfo.php index ed9d15183d..dc85068ec8 100644 --- a/src/XML/mdrpi/PublicationInfo.php +++ b/src/XML/mdrpi/PublicationInfo.php @@ -7,10 +7,13 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_change_key_case; diff --git a/src/XML/mdrpi/PublicationPath.php b/src/XML/mdrpi/PublicationPath.php index d716ecb71a..96eccda8e1 100644 --- a/src/XML/mdrpi/PublicationPath.php +++ b/src/XML/mdrpi/PublicationPath.php @@ -9,7 +9,8 @@ use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/mdrpi/RegistrationInfo.php b/src/XML/mdrpi/RegistrationInfo.php index cc40c4755b..6b6e444331 100644 --- a/src/XML/mdrpi/RegistrationInfo.php +++ b/src/XML/mdrpi/RegistrationInfo.php @@ -7,10 +7,13 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/mdui/DiscoHints.php b/src/XML/mdui/DiscoHints.php index 7ca70b489e..60cfbd5d6f 100644 --- a/src/XML/mdui/DiscoHints.php +++ b/src/XML/mdui/DiscoHints.php @@ -7,12 +7,16 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Type\{CIDRValue, DomainValue, GeolocationValue}; +use SimpleSAML\SAML2\Type\CIDRValue; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\SAML2\Type\GeolocationValue; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, SerializableElementInterface}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/mdui/DomainHint.php b/src/XML/mdui/DomainHint.php index a488ddf570..266e2dbc0e 100644 --- a/src/XML/mdui/DomainHint.php +++ b/src/XML/mdui/DomainHint.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\mdui; use SimpleSAML\SAML2\Type\DomainValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class DomainHint extends AbstractMduiElement implements SchemaValidatableE use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = DomainValue::class; } diff --git a/src/XML/mdui/GeolocationHint.php b/src/XML/mdui/GeolocationHint.php index 684fcd00c8..abf21f978b 100644 --- a/src/XML/mdui/GeolocationHint.php +++ b/src/XML/mdui/GeolocationHint.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\mdui; use SimpleSAML\SAML2\Type\GeolocationValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class GeolocationHint extends AbstractMduiElement implements SchemaValidat use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = GeolocationValue::class; } diff --git a/src/XML/mdui/IPHint.php b/src/XML/mdui/IPHint.php index eb8a17d54d..5e2af91197 100644 --- a/src/XML/mdui/IPHint.php +++ b/src/XML/mdui/IPHint.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\mdui; use SimpleSAML\SAML2\Type\CIDRValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** diff --git a/src/XML/mdui/Keywords.php b/src/XML/mdui/Keywords.php index bcd3dc2bb9..b0eb2596d1 100644 --- a/src/XML/mdui/Keywords.php +++ b/src/XML/mdui/Keywords.php @@ -6,10 +6,12 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\ListOfStringsValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\LanguageValue; @@ -29,6 +31,7 @@ final class Keywords extends AbstractMduiElement implements use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = ListOfStringsValue::class; @@ -92,7 +95,6 @@ public static function fromXML(DOMElement $xml): static */ public function toXML(?DOMElement $parent = null): DOMElement { - /** @psalm-var \DOMDocument $e->ownerDocument */ $e = $this->instantiateParentElement($parent); $e->setAttribute('xml:lang', $this->getLanguage()->getValue()); $e->textContent = $this->getContent()->getValue(); diff --git a/src/XML/mdui/Logo.php b/src/XML/mdui/Logo.php index 8a1f41f362..7573c5f810 100644 --- a/src/XML/mdui/Logo.php +++ b/src/XML/mdui/Logo.php @@ -6,13 +6,17 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; -use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; /** * Class for handling the Logo metadata extensions for login and discovery user interface @@ -27,9 +31,11 @@ final class Logo extends AbstractMduiElement implements use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; + /** @var string */ private static string $scheme_regex = '/^(data|http[s]?[:])/i'; diff --git a/src/XML/mdui/UIInfo.php b/src/XML/mdui/UIInfo.php index b861964cd4..95c0624b65 100644 --- a/src/XML/mdui/UIInfo.php +++ b/src/XML/mdui/UIInfo.php @@ -6,12 +6,15 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\{ArrayValidationException, ProtocolViolationException}; +use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\XML\ArrayizableElementInterface; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\Constants as C; use SimpleSAML\XML\ExtendableElementTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, SerializableElementInterface}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/saml/AbstractBaseID.php b/src/XML/saml/AbstractBaseID.php index e7afb64944..96585e77ea 100644 --- a/src/XML/saml/AbstractBaseID.php +++ b/src/XML/saml/AbstractBaseID.php @@ -7,14 +7,18 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\{EncryptableElementTrait, ExtensionPointInterface, ExtensionPointTrait}; use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\Utils; +use SimpleSAML\SAML2\XML\EncryptableElementTrait; +use SimpleSAML\SAML2\XML\ExtensionPointInterface; +use SimpleSAML\SAML2\XML\ExtensionPointTrait; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use SimpleSAML\XMLSchema\Type\QNameValue; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; diff --git a/src/XML/saml/AbstractCondition.php b/src/XML/saml/AbstractCondition.php index 9a0c2baba4..a7bc84b897 100644 --- a/src/XML/saml/AbstractCondition.php +++ b/src/XML/saml/AbstractCondition.php @@ -8,12 +8,15 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; +use SimpleSAML\SAML2\XML\ExtensionPointInterface; +use SimpleSAML\SAML2\XML\ExtensionPointTrait; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use SimpleSAML\XMLSchema\Type\QNameValue; /** diff --git a/src/XML/saml/AbstractStatement.php b/src/XML/saml/AbstractStatement.php index 1b165a55c0..683a8444c0 100644 --- a/src/XML/saml/AbstractStatement.php +++ b/src/XML/saml/AbstractStatement.php @@ -8,12 +8,15 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\{ExtensionPointInterface, ExtensionPointTrait}; +use SimpleSAML\SAML2\XML\ExtensionPointInterface; +use SimpleSAML\SAML2\XML\ExtensionPointTrait; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use SimpleSAML\XMLSchema\Type\QNameValue; /** diff --git a/src/XML/saml/Action.php b/src/XML/saml/Action.php index a17c222bfa..1c8275d3c8 100644 --- a/src/XML/saml/Action.php +++ b/src/XML/saml/Action.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\TypedTextContentTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -21,6 +22,7 @@ final class Action extends AbstractSamlElement { use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; diff --git a/src/XML/saml/Advice.php b/src/XML/saml/Advice.php index 7c824421ce..f125ecb3f2 100644 --- a/src/XML/saml/Advice.php +++ b/src/XML/saml/Advice.php @@ -7,8 +7,11 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\XML\{ExtendableElementTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** diff --git a/src/XML/saml/Assertion.php b/src/XML/saml/Assertion.php index 4e49f560c0..64af86bab7 100644 --- a/src/XML/saml/Assertion.php +++ b/src/XML/saml/Assertion.php @@ -7,17 +7,25 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\{EncryptableElementTrait, SignableElementTrait, SignedElementTrait}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\SAML2\XML\EncryptableElementTrait; +use SimpleSAML\SAML2\XML\SignableElementTrait; +use SimpleSAML\SAML2\XML\SignedElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\ds\Signature; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; -use SimpleSAML\XMLSecurity\XML\{SignableElementInterface, SignedElementInterface}; +use SimpleSAML\XMLSecurity\XML\SignableElementInterface; +use SimpleSAML\XMLSecurity\XML\SignedElementInterface; use function array_filter; use function array_merge; @@ -40,6 +48,8 @@ final class Assertion extends AbstractSamlElement implements EncryptableElementTrait::getBlacklistedAlgorithms insteadof SignedElementTrait; EncryptableElementTrait::getBlacklistedAlgorithms insteadof SignableElementTrait; } + + use SchemaValidatableElementTrait; use SignableElementTrait; use SignedElementTrait; diff --git a/src/XML/saml/AssertionIDRef.php b/src/XML/saml/AssertionIDRef.php index 8800df4f67..71d09e9bd1 100644 --- a/src/XML/saml/AssertionIDRef.php +++ b/src/XML/saml/AssertionIDRef.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\saml; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; use SimpleSAML\XMLSchema\Type\NCNameValue; @@ -18,6 +19,7 @@ final class AssertionIDRef extends AbstractSamlElement implements SchemaValidata use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = NCNameValue::class; } diff --git a/src/XML/saml/AssertionURIRef.php b/src/XML/saml/AssertionURIRef.php index 1afa94808f..b4d4e8a95c 100644 --- a/src/XML/saml/AssertionURIRef.php +++ b/src/XML/saml/AssertionURIRef.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class AssertionURIRef extends AbstractSamlElement implements SchemaValidat use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/Attribute.php b/src/XML/saml/Attribute.php index e137f33444..e94674ea8c 100644 --- a/src/XML/saml/Attribute.php +++ b/src/XML/saml/Attribute.php @@ -7,10 +7,12 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\EncryptableElementTrait; use SimpleSAML\XML\ExtendableAttributesTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; diff --git a/src/XML/saml/AttributeStatement.php b/src/XML/saml/AttributeStatement.php index 6f0e46b719..c1161fd5a2 100644 --- a/src/XML/saml/AttributeStatement.php +++ b/src/XML/saml/AttributeStatement.php @@ -7,7 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/saml/AttributeValue.php b/src/XML/saml/AttributeValue.php index 35a2be4820..480c9fbe45 100644 --- a/src/XML/saml/AttributeValue.php +++ b/src/XML/saml/AttributeValue.php @@ -11,7 +11,8 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\XML\AbstractElement; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; diff --git a/src/XML/saml/Audience.php b/src/XML/saml/Audience.php index 713066a7d6..b7d8f5176b 100644 --- a/src/XML/saml/Audience.php +++ b/src/XML/saml/Audience.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class Audience extends AbstractSamlElement implements SchemaValidatableEle use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AudienceRestriction.php b/src/XML/saml/AudienceRestriction.php index b862d664db..b3be527eea 100644 --- a/src/XML/saml/AudienceRestriction.php +++ b/src/XML/saml/AudienceRestriction.php @@ -7,8 +7,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * SAML AudienceRestriction data type. diff --git a/src/XML/saml/AuthenticatingAuthority.php b/src/XML/saml/AuthenticatingAuthority.php index 1f2d52ed25..5b970104b9 100644 --- a/src/XML/saml/AuthenticatingAuthority.php +++ b/src/XML/saml/AuthenticatingAuthority.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class AuthenticatingAuthority extends AbstractSamlElement implements Schem use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = EntityIDValue::class; } diff --git a/src/XML/saml/AuthnContext.php b/src/XML/saml/AuthnContext.php index 243b96684e..c99d901829 100644 --- a/src/XML/saml/AuthnContext.php +++ b/src/XML/saml/AuthnContext.php @@ -6,10 +6,14 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDecl, AuthnContextDeclRef}; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; use function is_null; diff --git a/src/XML/saml/AuthnContextClassRef.php b/src/XML/saml/AuthnContextClassRef.php index ecebd4600e..a43118b477 100644 --- a/src/XML/saml/AuthnContextClassRef.php +++ b/src/XML/saml/AuthnContextClassRef.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class AuthnContextClassRef extends AbstractSamlElement implements SchemaVa use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AuthnContextDecl.php b/src/XML/saml/AuthnContextDecl.php index 2fe6e1bf89..12ccd0a5b5 100644 --- a/src/XML/saml/AuthnContextDecl.php +++ b/src/XML/saml/AuthnContextDecl.php @@ -6,12 +6,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\{ - ExtendableAttributesTrait, - ExtendableElementTrait, - SchemaValidatableElementInterface, - SchemaValidatableElementTrait, -}; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/saml/AuthnContextDeclRef.php b/src/XML/saml/AuthnContextDeclRef.php index 4f1728380c..2d1d748fe9 100644 --- a/src/XML/saml/AuthnContextDeclRef.php +++ b/src/XML/saml/AuthnContextDeclRef.php @@ -5,7 +5,9 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait, TypedTextContentTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\TypedTextContentTrait; /** * Class representing SAML2 AuthnContextDeclRef @@ -17,6 +19,7 @@ final class AuthnContextDeclRef extends AbstractSamlElement implements SchemaVal use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; } diff --git a/src/XML/saml/AuthnStatement.php b/src/XML/saml/AuthnStatement.php index 0ebf8d826f..fc4b4b39a7 100644 --- a/src/XML/saml/AuthnStatement.php +++ b/src/XML/saml/AuthnStatement.php @@ -6,9 +6,13 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; diff --git a/src/XML/saml/AuthzDecisionStatement.php b/src/XML/saml/AuthzDecisionStatement.php index 20f2193594..3d8a1cfccd 100644 --- a/src/XML/saml/AuthzDecisionStatement.php +++ b/src/XML/saml/AuthzDecisionStatement.php @@ -8,13 +8,12 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\DecisionTypeValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{ - InvalidDOMElementException, - MissingElementException, - SchemaViolationException, - TooManyElementsException, -}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\AnyURIValue; use function array_pop; diff --git a/src/XML/saml/Conditions.php b/src/XML/saml/Conditions.php index 348c48cda2..5592de7abf 100644 --- a/src/XML/saml/Conditions.php +++ b/src/XML/saml/Conditions.php @@ -9,7 +9,8 @@ use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_pop; diff --git a/src/XML/saml/EncryptedAssertion.php b/src/XML/saml/EncryptedAssertion.php index 63caf3dfb1..93f310b226 100644 --- a/src/XML/saml/EncryptedAssertion.php +++ b/src/XML/saml/EncryptedAssertion.php @@ -5,7 +5,9 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\XML\EncryptedElementTrait; -use SimpleSAML\XML\{DOMDocumentFactory, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface; diff --git a/src/XML/saml/EncryptedAttribute.php b/src/XML/saml/EncryptedAttribute.php index ce38395006..308bed61b5 100644 --- a/src/XML/saml/EncryptedAttribute.php +++ b/src/XML/saml/EncryptedAttribute.php @@ -5,7 +5,9 @@ namespace SimpleSAML\SAML2\XML\saml; use SimpleSAML\SAML2\XML\EncryptedElementTrait; -use SimpleSAML\XML\{DOMDocumentFactory, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface; diff --git a/src/XML/saml/EncryptedID.php b/src/XML/saml/EncryptedID.php index 6d3746dda7..dbb947ccb3 100644 --- a/src/XML/saml/EncryptedID.php +++ b/src/XML/saml/EncryptedID.php @@ -6,12 +6,10 @@ use InvalidArgumentException; use SimpleSAML\SAML2\XML\EncryptedElementTrait; -use SimpleSAML\XML\{ - DOMDocumentFactory, - SchemaValidatableElementInterface, - SchemaValidatableElementTrait, - SerializableElementInterface, -}; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface; diff --git a/src/XML/saml/Evidence.php b/src/XML/saml/Evidence.php index fa4fdffca1..446b081916 100644 --- a/src/XML/saml/Evidence.php +++ b/src/XML/saml/Evidence.php @@ -7,8 +7,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; /** * Class representing a saml:Evidence element. diff --git a/src/XML/saml/Issuer.php b/src/XML/saml/Issuer.php index 2738ed1ca4..c7fa754720 100644 --- a/src/XML/saml/Issuer.php +++ b/src/XML/saml/Issuer.php @@ -7,8 +7,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; /** * Class representing the saml:Issuer element. diff --git a/src/XML/saml/NameID.php b/src/XML/saml/NameID.php index 4976a1c83b..8338cc269d 100644 --- a/src/XML/saml/NameID.php +++ b/src/XML/saml/NameID.php @@ -7,9 +7,11 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ArrayValidationException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\EncryptableElementTrait; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; diff --git a/src/XML/saml/NameIDType.php b/src/XML/saml/NameIDType.php index 4582034b68..4f232ad96b 100644 --- a/src/XML/saml/NameIDType.php +++ b/src/XML/saml/NameIDType.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\TypedTextContentTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; @@ -23,6 +24,7 @@ abstract class NameIDType extends AbstractSamlElement implements IdentifierInter use IDNameQualifiersTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; diff --git a/src/XML/saml/OneTimeUse.php b/src/XML/saml/OneTimeUse.php index ba7839cf47..269fb283fd 100644 --- a/src/XML/saml/OneTimeUse.php +++ b/src/XML/saml/OneTimeUse.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/saml/ProxyRestriction.php b/src/XML/saml/ProxyRestriction.php index 9ba95f18d5..5e3931e1ac 100644 --- a/src/XML/saml/ProxyRestriction.php +++ b/src/XML/saml/ProxyRestriction.php @@ -7,7 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; diff --git a/src/XML/saml/Subject.php b/src/XML/saml/Subject.php index 06a636cadb..cc07d13a06 100644 --- a/src/XML/saml/Subject.php +++ b/src/XML/saml/Subject.php @@ -8,8 +8,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\XML\IdentifierTrait; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; /** * Class representing SAML 2 Subject element. @@ -100,7 +102,7 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - /** @var \SimpleSAML\XML\SerializableElementInterface|null $identifier */ + /** @var \SimpleSAML\XML\SerializableElementInterface&\SimpleSAML\SAML2\XML\saml\IdentifierInterface $identifier */ $identifier = $this->getIdentifier(); $identifier?->toXML($e); diff --git a/src/XML/saml/SubjectConfirmation.php b/src/XML/saml/SubjectConfirmation.php index eb8989eb33..0e80660376 100644 --- a/src/XML/saml/SubjectConfirmation.php +++ b/src/XML/saml/SubjectConfirmation.php @@ -8,8 +8,10 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\IdentifierTrait; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; @@ -107,7 +109,7 @@ public function toXML(?DOMElement $parent = null): DOMElement $e = $this->instantiateParentElement($parent); $e->setAttribute('Method', $this->getMethod()->getValue()); - /** @var \SimpleSAML\XML\SerializableElementInterface|null $identifier */ + /** @var \SimpleSAML\XML\SerializableElementInterface&\SimpleSAML\SAML2\XML\saml\IdentifierInterface $identifier */ $identifier = $this->getIdentifier(); $identifier?->toXML($e); diff --git a/src/XML/saml/SubjectConfirmationData.php b/src/XML/saml/SubjectConfirmationData.php index da0fb8ebbd..9de3506757 100644 --- a/src/XML/saml/SubjectConfirmationData.php +++ b/src/XML/saml/SubjectConfirmationData.php @@ -7,10 +7,14 @@ use DOMElement; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\XML\{ExtendableAttributesTrait, ExtendableElementTrait}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/saml/SubjectLocality.php b/src/XML/saml/SubjectLocality.php index 21c4b0f2d5..2695133535 100644 --- a/src/XML/saml/SubjectLocality.php +++ b/src/XML/saml/SubjectLocality.php @@ -6,8 +6,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{DomainValue, SAMLStringValue}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/samlp/AbstractMessage.php b/src/XML/samlp/AbstractMessage.php index 1f635dcf15..c00f21e30c 100644 --- a/src/XML/samlp/AbstractMessage.php +++ b/src/XML/samlp/AbstractMessage.php @@ -6,13 +6,16 @@ use DOMElement; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\ExtendableElementTrait; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\{SignableElementTrait, SignedElementTrait}; +use SimpleSAML\SAML2\XML\SignableElementTrait; +use SimpleSAML\SAML2\XML\SignedElementTrait; use SimpleSAML\XMLSchema\Type\IDValue; -use SimpleSAML\XMLSecurity\XML\{SignableElementInterface, SignedElementInterface}; +use SimpleSAML\XMLSecurity\XML\SignableElementInterface; +use SimpleSAML\XMLSecurity\XML\SignedElementInterface; use function array_pop; diff --git a/src/XML/samlp/AbstractStatusResponse.php b/src/XML/samlp/AbstractStatusResponse.php index d23a2157ba..e4e05d3241 100644 --- a/src/XML/samlp/AbstractStatusResponse.php +++ b/src/XML/samlp/AbstractStatusResponse.php @@ -6,9 +6,11 @@ use DOMElement; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; /** * Base class for all SAML 2 response messages. diff --git a/src/XML/samlp/AbstractSubjectQuery.php b/src/XML/samlp/AbstractSubjectQuery.php index 18a0554089..ff0bfbba3d 100644 --- a/src/XML/samlp/AbstractSubjectQuery.php +++ b/src/XML/samlp/AbstractSubjectQuery.php @@ -6,8 +6,10 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; -use SimpleSAML\SAML2\XML\saml\{Issuer, Subject}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\Subject; use SimpleSAML\XMLSchema\Type\IDValue; /** diff --git a/src/XML/samlp/Artifact.php b/src/XML/samlp/Artifact.php index a63fe21672..4d5a7cb71c 100644 --- a/src/XML/samlp/Artifact.php +++ b/src/XML/samlp/Artifact.php @@ -4,7 +4,8 @@ namespace SimpleSAML\SAML2\XML\samlp; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; use SimpleSAML\XMLSchema\Type\Base64BinaryValue; diff --git a/src/XML/samlp/ArtifactResolve.php b/src/XML/samlp/ArtifactResolve.php index d3e022f945..5106e0d5cb 100644 --- a/src/XML/samlp/ArtifactResolve.php +++ b/src/XML/samlp/ArtifactResolve.php @@ -6,11 +6,17 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; diff --git a/src/XML/samlp/ArtifactResponse.php b/src/XML/samlp/ArtifactResponse.php index ca720c3f65..af3b9eca42 100644 --- a/src/XML/samlp/ArtifactResponse.php +++ b/src/XML/samlp/ArtifactResponse.php @@ -6,13 +6,19 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; diff --git a/src/XML/samlp/AssertionIDRequest.php b/src/XML/samlp/AssertionIDRequest.php index 69aaee5923..e1bae46c66 100644 --- a/src/XML/samlp/AssertionIDRequest.php +++ b/src/XML/samlp/AssertionIDRequest.php @@ -6,12 +6,18 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\XML\saml\{AssertionIDRef, Issuer}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AssertionIDRef; +use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; diff --git a/src/XML/samlp/AttributeQuery.php b/src/XML/samlp/AttributeQuery.php index 20276d9127..d4681a05fd 100644 --- a/src/XML/samlp/AttributeQuery.php +++ b/src/XML/samlp/AttributeQuery.php @@ -7,12 +7,20 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{Attribute, Issuer, Subject}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; diff --git a/src/XML/samlp/AuthnQuery.php b/src/XML/samlp/AuthnQuery.php index 860cc4a80a..57a77fc0a3 100644 --- a/src/XML/samlp/AuthnQuery.php +++ b/src/XML/samlp/AuthnQuery.php @@ -6,12 +6,19 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{Issuer, Subject}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\Subject; use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; diff --git a/src/XML/samlp/AuthnRequest.php b/src/XML/samlp/AuthnRequest.php index beac989bd5..28d97f1589 100644 --- a/src/XML/samlp/AuthnRequest.php +++ b/src/XML/samlp/AuthnRequest.php @@ -6,13 +6,22 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{Conditions, Issuer, Subject}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, IDValue, UnsignedShortValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; diff --git a/src/XML/samlp/AuthzDecisionQuery.php b/src/XML/samlp/AuthzDecisionQuery.php index 54eb282cf3..b4e3da51c7 100644 --- a/src/XML/samlp/AuthzDecisionQuery.php +++ b/src/XML/samlp/AuthzDecisionQuery.php @@ -7,16 +7,21 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{Action, Evidence, Issuer, Subject}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{ - InvalidDOMElementException, - MissingElementException, - SchemaViolationException, - TooManyElementsException, -}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\Action; +use SimpleSAML\SAML2\XML\saml\Evidence; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; diff --git a/src/XML/samlp/Extensions.php b/src/XML/samlp/Extensions.php index 4ad6481e03..69692479ee 100644 --- a/src/XML/samlp/Extensions.php +++ b/src/XML/samlp/Extensions.php @@ -9,7 +9,8 @@ use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\ExtensionsTrait; use SimpleSAML\XML\Chunk; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; /** diff --git a/src/XML/samlp/GetComplete.php b/src/XML/samlp/GetComplete.php index d89ceb5f0c..ba9946c855 100644 --- a/src/XML/samlp/GetComplete.php +++ b/src/XML/samlp/GetComplete.php @@ -7,7 +7,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; @@ -23,6 +24,7 @@ final class GetComplete extends AbstractSamlpElement implements SchemaValidatabl use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLAnyURIValue::class; diff --git a/src/XML/samlp/IDPEntry.php b/src/XML/samlp/IDPEntry.php index c0add5e7f8..5a3ea9cecf 100644 --- a/src/XML/samlp/IDPEntry.php +++ b/src/XML/samlp/IDPEntry.php @@ -7,8 +7,11 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function array_change_key_case; diff --git a/src/XML/samlp/IDPList.php b/src/XML/samlp/IDPList.php index 18b9128e35..5729593326 100644 --- a/src/XML/samlp/IDPList.php +++ b/src/XML/samlp/IDPList.php @@ -8,8 +8,11 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_change_key_case; use function array_filter; diff --git a/src/XML/samlp/LogoutRequest.php b/src/XML/samlp/LogoutRequest.php index 0edfb52453..196b11d1ee 100644 --- a/src/XML/samlp/LogoutRequest.php +++ b/src/XML/samlp/LogoutRequest.php @@ -7,12 +7,22 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\IdentifierTrait; -use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, EncryptedID, IdentifierInterface, Issuer, NameID}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\SAML2\XML\saml\AbstractBaseID; +use SimpleSAML\SAML2\XML\saml\EncryptedID; +use SimpleSAML\SAML2\XML\saml\IdentifierInterface; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; @@ -193,7 +203,7 @@ protected function toUnsignedXML(?DOMElement $parent = null): DOMElement $e->setAttribute('Reason', $this->getReason()->getValue()); } - /** @var \SimpleSAML\XML\SerializableElementInterface $identifier */ + /** @var \SimpleSAML\XML\SerializableElementInterface&\SimpleSAML\SAML2\XML\saml\IdentifierInterface $identifier */ $identifier = $this->getIdentifier(); $identifier->toXML($e); diff --git a/src/XML/samlp/LogoutResponse.php b/src/XML/samlp/LogoutResponse.php index fe0ea8bb09..52bf38ac9a 100644 --- a/src/XML/samlp/LogoutResponse.php +++ b/src/XML/samlp/LogoutResponse.php @@ -6,12 +6,17 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_pop; diff --git a/src/XML/samlp/NameIDPolicy.php b/src/XML/samlp/NameIDPolicy.php index 565ec35cd9..e2dbdc4cfa 100644 --- a/src/XML/samlp/NameIDPolicy.php +++ b/src/XML/samlp/NameIDPolicy.php @@ -7,9 +7,11 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\XML\ArrayizableElementInterface; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\BooleanValue; diff --git a/src/XML/samlp/RequestedAuthnContext.php b/src/XML/samlp/RequestedAuthnContext.php index 12f80b3e83..504b09a99b 100644 --- a/src/XML/samlp/RequestedAuthnContext.php +++ b/src/XML/samlp/RequestedAuthnContext.php @@ -7,11 +7,14 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{AuthnContextComparisonTypeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; +use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use function array_merge; use function strval; diff --git a/src/XML/samlp/RequesterID.php b/src/XML/samlp/RequesterID.php index d31622328c..a28b0cf9c7 100644 --- a/src/XML/samlp/RequesterID.php +++ b/src/XML/samlp/RequesterID.php @@ -7,7 +7,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ArrayValidationException; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; use function array_key_first; @@ -22,6 +23,7 @@ final class RequesterID extends AbstractSamlpElement implements SchemaValidatabl use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = EntityIDValue::class; diff --git a/src/XML/samlp/Response.php b/src/XML/samlp/Response.php index 54db4b1ced..1f7afcc28a 100644 --- a/src/XML/samlp/Response.php +++ b/src/XML/samlp/Response.php @@ -7,12 +7,21 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\Protocol\{RequestVersionTooHighException, RequestVersionTooLowException}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{Assertion, EncryptedAssertion, Issuer}; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; +use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function array_merge; diff --git a/src/XML/samlp/Scoping.php b/src/XML/samlp/Scoping.php index 58b5ba9cc1..3dfcd6d541 100644 --- a/src/XML/samlp/Scoping.php +++ b/src/XML/samlp/Scoping.php @@ -7,7 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; diff --git a/src/XML/samlp/SessionIndex.php b/src/XML/samlp/SessionIndex.php index 286f00d936..747c254a15 100644 --- a/src/XML/samlp/SessionIndex.php +++ b/src/XML/samlp/SessionIndex.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\samlp; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** diff --git a/src/XML/samlp/Status.php b/src/XML/samlp/Status.php index fc0c21a329..92fd1cc5cd 100644 --- a/src/XML/samlp/Status.php +++ b/src/XML/samlp/Status.php @@ -8,8 +8,11 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function array_pop; use function strval; diff --git a/src/XML/samlp/StatusCode.php b/src/XML/samlp/StatusCode.php index d730c15faf..478df02555 100644 --- a/src/XML/samlp/StatusCode.php +++ b/src/XML/samlp/StatusCode.php @@ -8,7 +8,8 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use function strval; diff --git a/src/XML/samlp/StatusDetail.php b/src/XML/samlp/StatusDetail.php index d9d782c74f..d765f8b453 100644 --- a/src/XML/samlp/StatusDetail.php +++ b/src/XML/samlp/StatusDetail.php @@ -6,7 +6,9 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\XML\{ExtendableElementTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\ExtendableElementTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/samlp/StatusMessage.php b/src/XML/samlp/StatusMessage.php index e7351505f8..03c1e868e1 100644 --- a/src/XML/samlp/StatusMessage.php +++ b/src/XML/samlp/StatusMessage.php @@ -5,7 +5,8 @@ namespace SimpleSAML\SAML2\XML\samlp; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; /** @@ -18,6 +19,7 @@ final class StatusMessage extends AbstractSamlpElement implements SchemaValidata use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; } diff --git a/src/XML/shibmd/KeyAuthority.php b/src/XML/shibmd/KeyAuthority.php index 63a6a71901..19ca74fa0f 100644 --- a/src/XML/shibmd/KeyAuthority.php +++ b/src/XML/shibmd/KeyAuthority.php @@ -7,7 +7,9 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\XML\Constants as C; -use SimpleSAML\XML\{ExtendableAttributesTrait, SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\ExtendableAttributesTrait; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\UnsignedByteValue; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; diff --git a/src/XML/shibmd/Scope.php b/src/XML/shibmd/Scope.php index 0cc3ff1f83..415170ec8b 100644 --- a/src/XML/shibmd/Scope.php +++ b/src/XML/shibmd/Scope.php @@ -7,7 +7,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\XML\{SchemaValidatableElementInterface, SchemaValidatableElementTrait}; +use SimpleSAML\XML\SchemaValidatableElementInterface; +use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\TypedTextContentTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\BooleanValue; @@ -23,6 +24,7 @@ final class Scope extends AbstractShibmdElement implements SchemaValidatableElem use SchemaValidatableElementTrait; use TypedTextContentTrait; + /** @var string */ public const TEXTCONTENT_TYPE = SAMLStringValue::class; diff --git a/tests/SAML2/Assert/CIDRTest.php b/tests/SAML2/Assert/CIDRTest.php index f6ff14c508..d1e16fd697 100644 --- a/tests/SAML2/Assert/CIDRTest.php +++ b/tests/SAML2/Assert/CIDRTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Assert; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; diff --git a/tests/SAML2/Assert/DomainTest.php b/tests/SAML2/Assert/DomainTest.php index cf07c635e3..6b48f7a891 100644 --- a/tests/SAML2/Assert/DomainTest.php +++ b/tests/SAML2/Assert/DomainTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Assert; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; diff --git a/tests/SAML2/Assert/EntityIDTest.php b/tests/SAML2/Assert/EntityIDTest.php index 920dd22083..cbfc970f6b 100644 --- a/tests/SAML2/Assert/EntityIDTest.php +++ b/tests/SAML2/Assert/EntityIDTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Assert; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; diff --git a/tests/SAML2/Assert/SAMLAnyURITest.php b/tests/SAML2/Assert/SAMLAnyURITest.php index 6694a0d5a9..520dbfc517 100644 --- a/tests/SAML2/Assert/SAMLAnyURITest.php +++ b/tests/SAML2/Assert/SAMLAnyURITest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Assert; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; diff --git a/tests/SAML2/Assert/SAMLDateTimeTest.php b/tests/SAML2/Assert/SAMLDateTimeTest.php index 778a773c9f..8b5c01cf4e 100644 --- a/tests/SAML2/Assert/SAMLDateTimeTest.php +++ b/tests/SAML2/Assert/SAMLDateTimeTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\SAML2\Test\Assert; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Assert\Assert; diff --git a/tests/SAML2/Assert/SAMLStringTest.php b/tests/SAML2/Assert/SAMLStringTest.php index 4db2d04cd2..5ae3d24ab0 100644 --- a/tests/SAML2/Assert/SAMLStringTest.php +++ b/tests/SAML2/Assert/SAMLStringTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Assert; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Exception\ProtocolViolationException; diff --git a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php index 5ffba6485c..221894d47a 100644 --- a/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php +++ b/tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php @@ -5,28 +5,36 @@ namespace SimpleSAML\Test\SAML2\Assertion\Transformer; use DOMDocument; -use PHPUnit\Framework\Attributes\{PreserveGlobalState, RunInSeparateProcess}; +use PHPUnit\Framework\Attributes\PreserveGlobalState; +use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use Psr\Log\{LoggerInterface, NullLogger}; -use SimpleSAML\SAML2\Assertion\{Processor, ProcessorBuilder}; +use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; +use SimpleSAML\SAML2\Assertion\Processor; +use SimpleSAML\SAML2\Assertion\ProcessorBuilder; use SimpleSAML\SAML2\Compat\ContainerSingleton; -use SimpleSAML\SAML2\Configuration\{Destination, IdentityProvider, PrivateKey, ServiceProvider}; +use SimpleSAML\SAML2\Configuration\Destination; +use SimpleSAML\SAML2\Configuration\IdentityProvider; +use SimpleSAML\SAML2\Configuration\PrivateKey; +use SimpleSAML\SAML2\Configuration\ServiceProvider; use SimpleSAML\SAML2\Signature\Validator; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utilities\ArrayCollection; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\{ - Assertion, - AuthnContext, - AuthnContextClassRef, - AuthnStatement, - EncryptedID, - Issuer, - NameID, - Subject, -}; -use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnStatement; +use SimpleSAML\SAML2\XML\saml\EncryptedID; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; diff --git a/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php b/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php index 6b5c407141..55ea4e8085 100644 --- a/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php +++ b/tests/SAML2/Assertion/Validation/AssertionValidatorTest.php @@ -11,16 +11,23 @@ use PHPUnit\Framework\Attributes\RunInSeparateProcess; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use Psr\Log\{LoggerInterface, NullLogger}; +use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; use SimpleSAML\SAML2\Assertion\Exception\InvalidAssertionException; -use SimpleSAML\SAML2\Assertion\{Processor, ProcessorBuilder}; +use SimpleSAML\SAML2\Assertion\Processor; +use SimpleSAML\SAML2\Assertion\ProcessorBuilder; use SimpleSAML\SAML2\Assertion\Validation\AssertionValidator; -use SimpleSAML\SAML2\Configuration\{Destination, IdentityProvider, ServiceProvider}; +use SimpleSAML\SAML2\Configuration\Destination; +use SimpleSAML\SAML2\Configuration\IdentityProvider; +use SimpleSAML\SAML2\Configuration\ServiceProvider; use SimpleSAML\SAML2\Signature\Validator; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\Type\IDValue; diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php index 25c8c7543f..5ad521650d 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php @@ -5,21 +5,22 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\NotBefore; use SimpleSAML\SAML2\Assertion\Validation\Result; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\{ - Assertion, - AuthnContext, - AuthnContextClassRef, - AuthnStatement, - Conditions, - Issuer, -}; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnStatement; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Type\IDValue; diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php index af81ef79da..f0b3d386b5 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php @@ -5,21 +5,22 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\NotOnOrAfter; use SimpleSAML\SAML2\Assertion\Validation\Result; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\{ - Assertion, - AuthnContext, - AuthnContextClassRef, - AuthnStatement, - Conditions, - Issuer, -}; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnStatement; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Type\IDValue; diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php index a3a01071a8..afb6e67953 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php @@ -5,14 +5,21 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SessionNotOnOrAfter; use SimpleSAML\SAML2\Assertion\Validation\Result; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\{Assertion, AuthnContext, AuthnContextClassRef, AuthnStatement, Issuer}; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnStatement; +use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Type\IDValue; diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php index 7cc606bb0c..e4440f8484 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php @@ -7,23 +7,24 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SpIsValidAudience; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Configuration\ServiceProvider; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\{ - Assertion, - Audience, - AudienceRestriction, - AuthnContext, - AuthnContextClassRef, - AuthnStatement, - Conditions, - Issuer, -}; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\AudienceRestriction; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnStatement; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Type\IDValue; diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php index 5003d50d23..10787da26c 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php @@ -4,7 +4,8 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationMethod; use SimpleSAML\SAML2\Assertion\Validation\Result; diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php index 95d5c9cfc6..c19f46e01d 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php @@ -5,15 +5,18 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationNotBefore; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; /** * @package simplesamlphp/saml2 diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php index 2a7cf420b6..fc0d2e672e 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php @@ -5,18 +5,19 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; use DateInterval; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\{ - SubjectConfirmationNotBefore, - SubjectConfirmationNotOnOrAfter, -}; +use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationNotBefore; +use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationNotOnOrAfter; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; /** * @package simplesamlphp/saml2 diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php index 1ca56814aa..1630b88b6f 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php @@ -4,14 +4,17 @@ namespace SimpleSAML\Test\SAML2\Assertion\Validation\ConstraintValidator; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationRecipientMatches; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Configuration\Destination; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; -use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; /** * @package simplesamlphp/saml2 diff --git a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php index 9f93a6ad58..7258991621 100644 --- a/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php +++ b/tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php @@ -7,12 +7,14 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use SimpleSAML\SAML2\Assertion\Validation\ConstraintValidator\SubjectConfirmationResponseToMatches; use SimpleSAML\SAML2\Assertion\Validation\Result; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; -use SimpleSAML\SAML2\XML\saml\{SubjectConfirmation, SubjectConfirmationData}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; use SimpleSAML\SAML2\XML\samlp\Response; use SimpleSAML\XMLSchema\Type\NCNameValue; diff --git a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php index 1a82867a26..a3636aec92 100644 --- a/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php +++ b/tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php @@ -9,16 +9,23 @@ use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use Psr\Log\{LoggerInterface, NullLogger}; +use Psr\Log\LoggerInterface; +use Psr\Log\NullLogger; use SimpleSAML\SAML2\Assertion\Exception\InvalidSubjectConfirmationException; -use SimpleSAML\SAML2\Assertion\{Processor, ProcessorBuilder}; +use SimpleSAML\SAML2\Assertion\Processor; +use SimpleSAML\SAML2\Assertion\ProcessorBuilder; use SimpleSAML\SAML2\Assertion\Validation\SubjectConfirmationValidator; -use SimpleSAML\SAML2\Configuration\{Destination, IdentityProvider, ServiceProvider}; +use SimpleSAML\SAML2\Configuration\Destination; +use SimpleSAML\SAML2\Configuration\IdentityProvider; +use SimpleSAML\SAML2\Configuration\ServiceProvider; use SimpleSAML\SAML2\Signature\Validator; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\saml\Assertion; -use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XMLSchema\Constants as C_XSI; diff --git a/tests/SAML2/Binding/HTTPArtifactTest.php b/tests/SAML2/Binding/HTTPArtifactTest.php index 05b0c553b2..460a1cf740 100644 --- a/tests/SAML2/Binding/HTTPArtifactTest.php +++ b/tests/SAML2/Binding/HTTPArtifactTest.php @@ -6,7 +6,8 @@ use Exception; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Binding\HTTPArtifact; diff --git a/tests/SAML2/Binding/HTTPPostTest.php b/tests/SAML2/Binding/HTTPPostTest.php index ffb3b679f2..76cdb61145 100644 --- a/tests/SAML2/Binding/HTTPPostTest.php +++ b/tests/SAML2/Binding/HTTPPostTest.php @@ -6,15 +6,22 @@ use Exception; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\{CoversClass, DoesNotPerformAssertions, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Binding\HTTPPost; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{AuthnRequest, Response, Status, StatusCode}; +use SimpleSAML\SAML2\XML\samlp\AuthnRequest; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/SAML2/Binding/HTTPRedirectTest.php b/tests/SAML2/Binding/HTTPRedirectTest.php index ffae14d189..8a465a9fe6 100644 --- a/tests/SAML2/Binding/HTTPRedirectTest.php +++ b/tests/SAML2/Binding/HTTPRedirectTest.php @@ -6,15 +6,24 @@ use Exception; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\{CoversClass, DoesNotPerformAssertions, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DoesNotPerformAssertions; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Binding\HTTPRedirect; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{AbstractRequest, AuthnRequest, Response, Status, StatusCode}; +use SimpleSAML\SAML2\XML\samlp\AbstractRequest; +use SimpleSAML\SAML2\XML\samlp\AuthnRequest; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\XML\Type\IDValue; /** diff --git a/tests/SAML2/Binding/SOAPTest.php b/tests/SAML2/Binding/SOAPTest.php index 746eaa39a6..521178f75c 100644 --- a/tests/SAML2/Binding/SOAPTest.php +++ b/tests/SAML2/Binding/SOAPTest.php @@ -6,12 +6,15 @@ use Mockery\Adapter\Phpunit\MockeryTestCase; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use SimpleSAML\SAML2\Binding\SOAP; use SimpleSAML\SAML2\Exception\Protocol\UnsupportedBindingException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\ecp\{RequestAuthenticated, Response}; -use SimpleSAML\SAML2\XML\samlp\{ArtifactResolve, MessageFactory}; +use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated; +use SimpleSAML\SAML2\XML\ecp\Response; +use SimpleSAML\SAML2\XML\samlp\ArtifactResolve; +use SimpleSAML\SAML2\XML\samlp\MessageFactory; use SimpleSAML\SOAP11\Constants as C; use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\DOMDocumentFactory; diff --git a/tests/SAML2/BindingTest.php b/tests/SAML2/BindingTest.php index 6b64f3157a..d80735751c 100644 --- a/tests/SAML2/BindingTest.php +++ b/tests/SAML2/BindingTest.php @@ -5,7 +5,8 @@ namespace SimpleSAML\Test\SAML2; use Nyholm\Psr7\ServerRequest; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Binding; use SimpleSAML\SAML2\Binding\HTTPArtifact; diff --git a/tests/SAML2/CustomBaseID.php b/tests/SAML2/CustomBaseID.php index db19defb9d..94b1e43976 100644 --- a/tests/SAML2/CustomBaseID.php +++ b/tests/SAML2/CustomBaseID.php @@ -7,10 +7,12 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\saml\{AbstractBaseID, Audience}; +use SimpleSAML\SAML2\XML\saml\AbstractBaseID; +use SimpleSAML\SAML2\XML\saml\Audience; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XMLSchema\Constants as C_XSI; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use SimpleSAML\XMLSchema\Type\QNameValue; /** diff --git a/tests/SAML2/CustomCondition.php b/tests/SAML2/CustomCondition.php index 2059ab137a..5c2b201524 100644 --- a/tests/SAML2/CustomCondition.php +++ b/tests/SAML2/CustomCondition.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\{AbstractCondition, Audience}; +use SimpleSAML\SAML2\XML\saml\AbstractCondition; +use SimpleSAML\SAML2\XML\saml\Audience; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XMLSchema\Constants as C_XSI; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; diff --git a/tests/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index 66236fa9f1..46bae11f7f 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -6,21 +6,25 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLDateTimeValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractRoleDescriptor, - ContactPerson, - Extensions, - KeyDescriptor, - Organization, -}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; +use SimpleSAML\SAML2\XML\md\ContactPerson; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\XML\md\Organization; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingElementException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, QNameValue}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\QNameValue; use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; /** @@ -32,6 +36,7 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor { use ExtendableElementTrait; + /** @var string */ protected const XSI_TYPE_NAME = 'CustomRoleDescriptorType'; @@ -44,6 +49,7 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; + /** * CustomRoleDescriptor constructor. * diff --git a/tests/SAML2/CustomStatement.php b/tests/SAML2/CustomStatement.php index e43f4bcc5d..7c2847b0a2 100644 --- a/tests/SAML2/CustomStatement.php +++ b/tests/SAML2/CustomStatement.php @@ -6,7 +6,8 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; -use SimpleSAML\SAML2\XML\saml\{AbstractStatement, Audience}; +use SimpleSAML\SAML2\XML\saml\AbstractStatement; +use SimpleSAML\SAML2\XML\saml\Audience; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XMLSchema\Constants as C_XSI; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; diff --git a/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php b/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php index 645014142f..8de74abe31 100644 --- a/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php +++ b/tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php @@ -7,7 +7,8 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use SimpleSAML\SAML2\Configuration\Destination; use SimpleSAML\SAML2\Response\Validation\ConstraintValidator\DestinationMatches; use SimpleSAML\SAML2\Response\Validation\Result; diff --git a/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php b/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php index c314ce6d88..a0dc0a8bbb 100644 --- a/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php +++ b/tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php @@ -7,12 +7,17 @@ use Mockery; use Mockery\Adapter\Phpunit\MockeryTestCase; use Mockery\MockInterface; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Response\Validation\ConstraintValidator\IsSuccessful; use SimpleSAML\SAML2\Response\Validation\Result; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode, StatusMessage}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\StatusMessage; /** * @package simplesamlphp/saml2 diff --git a/tests/SAML2/Signature/ValidatorChainTest.php b/tests/SAML2/Signature/ValidatorChainTest.php index 9449df7b99..8925d3b5d2 100644 --- a/tests/SAML2/Signature/ValidatorChainTest.php +++ b/tests/SAML2/Signature/ValidatorChainTest.php @@ -4,16 +4,21 @@ namespace SimpleSAML\Test\SAML2\Signature; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use Psr\Log\NullLogger; use SimpleSAML\SAML2\Configuration\IdentityProvider; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Signature\{MissingConfigurationException, ValidatorChain}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; +use SimpleSAML\SAML2\Signature\MissingConfigurationException; +use SimpleSAML\SAML2\Signature\ValidatorChain; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; use SimpleSAML\SAML2\Utils; -use SimpleSAML\SAML2\XML\samlp\{Response, Status, StatusCode}; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\XML\Type\IDValue; /** diff --git a/tests/SAML2/Type/AnyURIListValueTest.php b/tests/SAML2/Type/AnyURIListValueTest.php index 64188943a0..3e2e0131cb 100644 --- a/tests/SAML2/Type/AnyURIListValueTest.php +++ b/tests/SAML2/Type/AnyURIListValueTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\XML\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\AnyURIListValue; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; diff --git a/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php b/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php index a04c272dfa..f7a18dcbad 100644 --- a/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php +++ b/tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php @@ -4,7 +4,8 @@ namespace SimpleSAML\Test\SAML2\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DependsOnClass}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; use SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum; diff --git a/tests/SAML2/Type/DecisionTypeValueTest.php b/tests/SAML2/Type/DecisionTypeValueTest.php index 83ca14da84..9da378f152 100644 --- a/tests/SAML2/Type/DecisionTypeValueTest.php +++ b/tests/SAML2/Type/DecisionTypeValueTest.php @@ -4,7 +4,8 @@ namespace SimpleSAML\Test\SAML2\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DependsOnClass}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\DecisionTypeValue; use SimpleSAML\SAML2\XML\saml\DecisionTypeEnum; diff --git a/tests/SAML2/Type/EntityIDValueTest.php b/tests/SAML2/Type/EntityIDValueTest.php index 324299496a..2c5b1029c4 100644 --- a/tests/SAML2/Type/EntityIDValueTest.php +++ b/tests/SAML2/Type/EntityIDValueTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; diff --git a/tests/SAML2/Type/ListOfStringsValueTest.php b/tests/SAML2/Type/ListOfStringsValueTest.php index a6c4eab1f9..a679971b56 100644 --- a/tests/SAML2/Type/ListOfStringsValueTest.php +++ b/tests/SAML2/Type/ListOfStringsValueTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\XML\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, DataProviderExternal, DependsOnClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\ListOfStringsValue; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; diff --git a/tests/SAML2/Type/SAMLAnyURIValueTest.php b/tests/SAML2/Type/SAMLAnyURIValueTest.php index fd17e8a743..65796ffe5a 100644 --- a/tests/SAML2/Type/SAMLAnyURIValueTest.php +++ b/tests/SAML2/Type/SAMLAnyURIValueTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; diff --git a/tests/SAML2/Type/SAMLDateTimeValueTest.php b/tests/SAML2/Type/SAMLDateTimeValueTest.php index d84ddcbf6b..78b5f6550b 100644 --- a/tests/SAML2/Type/SAMLDateTimeValueTest.php +++ b/tests/SAML2/Type/SAMLDateTimeValueTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; diff --git a/tests/SAML2/Type/SAMLStringValueTest.php b/tests/SAML2/Type/SAMLStringValueTest.php index 826e226858..f8d3809623 100644 --- a/tests/SAML2/Type/SAMLStringValueTest.php +++ b/tests/SAML2/Type/SAMLStringValueTest.php @@ -4,7 +4,9 @@ namespace SimpleSAML\Test\SAML2\Type; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLStringValue; diff --git a/tests/SAML2/UtilsTest.php b/tests/SAML2/UtilsTest.php index 360e568255..c064383ef9 100644 --- a/tests/SAML2/UtilsTest.php +++ b/tests/SAML2/UtilsTest.php @@ -8,10 +8,13 @@ use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{NameID, Subject}; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; use SimpleSAML\SAML2\XML\samlp\AttributeQuery; use SimpleSAML\XML\Type\IDValue; diff --git a/tests/SAML2/XML/alg/DigestMethodTest.php b/tests/SAML2/XML/alg/DigestMethodTest.php index 722b816484..5640374ce6 100644 --- a/tests/SAML2/XML/alg/DigestMethodTest.php +++ b/tests/SAML2/XML/alg/DigestMethodTest.php @@ -4,14 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\alg; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\alg\{AbstractAlgElement, DigestMethod}; +use SimpleSAML\SAML2\XML\alg\AbstractAlgElement; +use SimpleSAML\SAML2\XML\alg\DigestMethod; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; use function dirname; use function strval; diff --git a/tests/SAML2/XML/alg/SigningMethodTest.php b/tests/SAML2/XML/alg/SigningMethodTest.php index 8eaee24385..6e9c1de42f 100644 --- a/tests/SAML2/XML/alg/SigningMethodTest.php +++ b/tests/SAML2/XML/alg/SigningMethodTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\alg; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\alg\{AbstractAlgElement, SigningMethod}; +use SimpleSAML\SAML2\XML\alg\AbstractAlgElement; +use SimpleSAML\SAML2\XML\alg\SigningMethod; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; diff --git a/tests/SAML2/XML/ecp/RelayStateTest.php b/tests/SAML2/XML/ecp/RelayStateTest.php index 0c75be5eb8..8ef12e4a28 100644 --- a/tests/SAML2/XML/ecp/RelayStateTest.php +++ b/tests/SAML2/XML/ecp/RelayStateTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, RelayState}; +use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; +use SimpleSAML\SAML2\XML\ecp\RelayState; use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; diff --git a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php index f0b09f80e3..720b3c4494 100644 --- a/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php +++ b/tests/SAML2/XML/ecp/RequestAuthenticatedTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, RequestAuthenticated}; +use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; +use SimpleSAML\SAML2\XML\ecp\RequestAuthenticated; use SimpleSAML\SOAP11\Constants as C; use SimpleSAML\SOAP11\Type\MustUnderstandValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; diff --git a/tests/SAML2/XML/ecp/RequestTest.php b/tests/SAML2/XML/ecp/RequestTest.php index c360e07497..f88ba0f4f4 100644 --- a/tests/SAML2/XML/ecp/RequestTest.php +++ b/tests/SAML2/XML/ecp/RequestTest.php @@ -4,15 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, Request}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; +use SimpleSAML\SAML2\XML\ecp\Request; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{GetComplete, IDPEntry, IDPList}; +use SimpleSAML\SAML2\XML\samlp\GetComplete; +use SimpleSAML\SAML2\XML\samlp\IDPEntry; +use SimpleSAML\SAML2\XML\samlp\IDPList; use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\BooleanValue; diff --git a/tests/SAML2/XML/ecp/ResponseTest.php b/tests/SAML2/XML/ecp/ResponseTest.php index bf38531664..d02db909d1 100644 --- a/tests/SAML2/XML/ecp/ResponseTest.php +++ b/tests/SAML2/XML/ecp/ResponseTest.php @@ -5,14 +5,17 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, Response}; +use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; +use SimpleSAML\SAML2\XML\ecp\Response; use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; diff --git a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php index ddd56ec3be..7b6fd9fd1a 100644 --- a/tests/SAML2/XML/ecp/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/ecp/SubjectConfirmationTest.php @@ -4,19 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\ecp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\ecp\{AbstractEcpElement, SubjectConfirmation}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\ecp\AbstractEcpElement; +use SimpleSAML\SAML2\XML\ecp\SubjectConfirmation; use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; use SimpleSAML\SOAP11\Constants as SOAP; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue, StringValue}; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/emd/RepublishRequestTest.php b/tests/SAML2/XML/emd/RepublishRequestTest.php index ce01db64b0..0f0a945672 100644 --- a/tests/SAML2/XML/emd/RepublishRequestTest.php +++ b/tests/SAML2/XML/emd/RepublishRequestTest.php @@ -4,12 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\emd; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\emd\{AbstractEmdElement, RepublishRequest, RepublishTarget}; +use SimpleSAML\SAML2\XML\emd\AbstractEmdElement; +use SimpleSAML\SAML2\XML\emd\RepublishRequest; +use SimpleSAML\SAML2\XML\emd\RepublishTarget; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/emd/RepublishTargetTest.php b/tests/SAML2/XML/emd/RepublishTargetTest.php index 71e3893daa..0ac09b067c 100644 --- a/tests/SAML2/XML/emd/RepublishTargetTest.php +++ b/tests/SAML2/XML/emd/RepublishTargetTest.php @@ -4,11 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\emd; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\emd\{AbstractEmdElement, RepublishTarget}; +use SimpleSAML\SAML2\XML\emd\AbstractEmdElement; +use SimpleSAML\SAML2\XML\emd\RepublishTarget; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; diff --git a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php index 47f12eed7e..8ca9bdd697 100644 --- a/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php +++ b/tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php @@ -4,17 +4,24 @@ namespace SimpleSAML\Test\SAML2\XML\idpdisc; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; -use SimpleSAML\SAML2\XML\md\{AbstractIndexedEndpointType, AbstractMdElement}; +use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, UnsignedShortValue}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/init/RequestInitiatorTest.php b/tests/SAML2/XML/init/RequestInitiatorTest.php index 7ebf1d40f6..94985f8d7b 100644 --- a/tests/SAML2/XML/init/RequestInitiatorTest.php +++ b/tests/SAML2/XML/init/RequestInitiatorTest.php @@ -4,16 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\init; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\init\RequestInitiator; use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php index 8c5a5104f0..0fe2181d06 100644 --- a/tests/SAML2/XML/md/AbstractLocalizedNameTest.php +++ b/tests/SAML2/XML/md/AbstractLocalizedNameTest.php @@ -5,13 +5,17 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceDescription}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\ServiceDescription; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, SchemaViolationException}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use function dirname; diff --git a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php index bc5d72c18b..0fa4cf06c0 100644 --- a/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php +++ b/tests/SAML2/XML/md/AdditionalMetadataLocationTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, AdditionalMetadataLocation}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AdditionalMetadataLocation; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; diff --git a/tests/SAML2/XML/md/AffiliateMemberTest.php b/tests/SAML2/XML/md/AffiliateMemberTest.php index 24f45b4ab7..9edf811ab1 100644 --- a/tests/SAML2/XML/md/AffiliateMemberTest.php +++ b/tests/SAML2/XML/md/AffiliateMemberTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, AffiliateMember}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AffiliateMember; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AffiliationDescriptorTest.php b/tests/SAML2/XML/md/AffiliationDescriptorTest.php index ec7e87dfb8..6d889a28ec 100644 --- a/tests/SAML2/XML/md/AffiliationDescriptorTest.php +++ b/tests/SAML2/XML/md/AffiliationDescriptorTest.php @@ -5,26 +5,31 @@ namespace SimpleSAML\Test\SAML2\XML\md; use Exception; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue, KeyTypesValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractSignedMdElement, - AffiliateMember, - AffiliationDescriptor, - KeyDescriptor, - KeyTypesEnum, -}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\KeyTypesValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\AffiliateMember; +use SimpleSAML\SAML2\XML\md\AffiliationDescriptor; +use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\XML\md\KeyTypesEnum; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue}; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php index 549c83324d..e0d5e2038f 100644 --- a/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php +++ b/tests/SAML2/XML/md/ArtifactResolutionServiceTest.php @@ -4,16 +4,24 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractIndexedEndpointType, AbstractMdElement, ArtifactResolutionService}; +use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, StringValue, UnsignedShortValue}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function array_merge; use function dirname; diff --git a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php index b35fcd7cd7..271350de00 100644 --- a/tests/SAML2/XML/md/AssertionConsumerServiceTest.php +++ b/tests/SAML2/XML/md/AssertionConsumerServiceTest.php @@ -4,15 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractIndexedEndpointType, AbstractMdElement, AssertionConsumerService}; +use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AssertionConsumerService; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, StringValue, UnsignedShortValue}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php index 7069598af3..14802714c4 100644 --- a/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php @@ -4,26 +4,29 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractRoleDescriptor, - AbstractRoleDescriptorType, - AbstractSignedMdElement, - AssertionIDRequestService, - AttributeAuthorityDescriptor, - AttributeProfile, - AttributeService, - NameIDFormat, -}; -use SimpleSAML\SAML2\XML\saml\{Attribute, AttributeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; +use SimpleSAML\SAML2\XML\md\AttributeAuthorityDescriptor; +use SimpleSAML\SAML2\XML\md\AttributeProfile; +use SimpleSAML\SAML2\XML\md\AttributeService; +use SimpleSAML\SAML2\XML\md\NameIDFormat; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingElementException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; diff --git a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php index fbd7ce3199..729ba25ad2 100644 --- a/tests/SAML2/XML/md/AttributeConsumingServiceTest.php +++ b/tests/SAML2/XML/md/AttributeConsumingServiceTest.php @@ -4,22 +4,26 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AttributeConsumingService, - RequestedAttribute, - ServiceDescription, - ServiceName, -}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AttributeConsumingService; +use SimpleSAML\SAML2\XML\md\RequestedAttribute; +use SimpleSAML\SAML2\XML\md\ServiceDescription; +use SimpleSAML\SAML2\XML\md\ServiceName; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, MissingElementException}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, LanguageValue, UnsignedShortValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AttributeProfileTest.php b/tests/SAML2/XML/md/AttributeProfileTest.php index 1731584075..4c61a1b17d 100644 --- a/tests/SAML2/XML/md/AttributeProfileTest.php +++ b/tests/SAML2/XML/md/AttributeProfileTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, AttributeProfile}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AttributeProfile; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php index f298f70a93..6f44198fe2 100644 --- a/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php +++ b/tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php @@ -10,21 +10,21 @@ use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractRoleDescriptor, - AbstractRoleDescriptorType, - AbstractSignedMdElement, - AssertionIDRequestService, - AuthnAuthorityDescriptor, - AuthnQueryService, - NameIDFormat, -}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; +use SimpleSAML\SAML2\XML\md\AuthnAuthorityDescriptor; +use SimpleSAML\SAML2\XML\md\AuthnQueryService; +use SimpleSAML\SAML2\XML\md\NameIDFormat; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; @@ -150,6 +150,7 @@ public function testMarshallingWithWrongAuthnQueryService(): void { $this->expectException(AssertionFailedException::class); $this->expectExceptionMessage('AuthnQueryService must be an instance of EndpointType'); + new AuthnAuthorityDescriptor( [self::$aqs, ''], AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), @@ -173,6 +174,7 @@ public function testMarshallingWithWrongAssertionIDRequestService(): void { $this->expectException(AssertionFailedException::class); $this->expectExceptionMessage('AssertionIDRequestServices must be an instance of EndpointType'); + new AuthnAuthorityDescriptor( [self::$aqs], AnyURIListValue::fromArray([C::NS_SAMLP, C::PROTOCOL]), diff --git a/tests/SAML2/XML/md/CompanyTest.php b/tests/SAML2/XML/md/CompanyTest.php index a33e88937e..f3847d82d6 100644 --- a/tests/SAML2/XML/md/CompanyTest.php +++ b/tests/SAML2/XML/md/CompanyTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, Company}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\Company; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/ContactPersonTest.php b/tests/SAML2/XML/md/ContactPersonTest.php index 05e994c0a2..b6f5de8d43 100644 --- a/tests/SAML2/XML/md/ContactPersonTest.php +++ b/tests/SAML2/XML/md/ContactPersonTest.php @@ -5,11 +5,13 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{EmailAddressValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\EmailAddressValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\SAML2\XML\md\Company; use SimpleSAML\SAML2\XML\md\ContactPerson; @@ -19,8 +21,11 @@ use SimpleSAML\SAML2\XML\md\SurName; use SimpleSAML\SAML2\XML\md\TelephoneNumber; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\StringValue; diff --git a/tests/SAML2/XML/md/EmailAddressTest.php b/tests/SAML2/XML/md/EmailAddressTest.php index 2ada3c9031..bfe3d40091 100644 --- a/tests/SAML2/XML/md/EmailAddressTest.php +++ b/tests/SAML2/XML/md/EmailAddressTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EmailAddress}; use SimpleSAML\SAML2\Type\EmailAddressValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\EmailAddress; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; /** * Tests for EmailAddress. diff --git a/tests/SAML2/XML/md/EncryptionMethodTest.php b/tests/SAML2/XML/md/EncryptionMethodTest.php index 2e803c7965..70558c3e43 100644 --- a/tests/SAML2/XML/md/EncryptionMethodTest.php +++ b/tests/SAML2/XML/md/EncryptionMethodTest.php @@ -4,18 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EncryptionMethod}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\EncryptionMethod; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use SimpleSAML\XMLSecurity\Type\KeySizeValue; -use SimpleSAML\XMLSecurity\XML\xenc\{KeySize, OAEPparams}; +use SimpleSAML\XMLSecurity\XML\xenc\KeySize; +use SimpleSAML\XMLSecurity\XML\xenc\OAEPparams; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/EndpointTypeTest.php b/tests/SAML2/XML/md/EndpointTypeTest.php index ec70d8ad15..81053ebc40 100644 --- a/tests/SAML2/XML/md/EndpointTypeTest.php +++ b/tests/SAML2/XML/md/EndpointTypeTest.php @@ -5,21 +5,24 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{ - AbstractEndpointType, - AbstractMdElement, - AssertionIDRequestService, - AttributeService, -}; +use SimpleSAML\SAML2\XML\md\AbstractEndpointType; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; +use SimpleSAML\SAML2\XML\md\AttributeService; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; diff --git a/tests/SAML2/XML/md/EntitiesDescriptorTest.php b/tests/SAML2/XML/md/EntitiesDescriptorTest.php index 22408db5ab..e4342c92b8 100644 --- a/tests/SAML2/XML/md/EntitiesDescriptorTest.php +++ b/tests/SAML2/XML/md/EntitiesDescriptorTest.php @@ -4,23 +4,27 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractSignedMdElement, - EntitiesDescriptor, - EntityDescriptor, - Extensions, -}; -use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, UsagePolicy}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\EntitiesDescriptor; +use SimpleSAML\SAML2\XML\md\EntityDescriptor; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{IDValue, LanguageValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/md/EntityDescriptorTest.php b/tests/SAML2/XML/md/EntityDescriptorTest.php index 27529b0896..de1d121637 100644 --- a/tests/SAML2/XML/md/EntityDescriptorTest.php +++ b/tests/SAML2/XML/md/EntityDescriptorTest.php @@ -5,50 +5,53 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMText; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{ - AnyURIListValue, - EmailAddressValue, - EntityIDValue, - SAMLAnyURIValue, - SAMLDateTimeValue, - SAMLStringValue, -}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractSignedMdElement, - AdditionalMetadataLocation, - AffiliateMember, - AffiliationDescriptor, - AttributeAuthorityDescriptor, - AttributeService, - AuthnAuthorityDescriptor, - AuthnQueryService, - AuthzService, - ContactPerson, - EmailAddress, - EntityDescriptor, - Extensions, - IDPSSODescriptor, - Organization, - OrganizationDisplayName, - OrganizationName, - OrganizationURL, - PDPDescriptor, - SingleSignOnService, - UnknownRoleDescriptor, -}; -use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, UsagePolicy}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\EmailAddressValue; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\AdditionalMetadataLocation; +use SimpleSAML\SAML2\XML\md\AffiliateMember; +use SimpleSAML\SAML2\XML\md\AffiliationDescriptor; +use SimpleSAML\SAML2\XML\md\AttributeAuthorityDescriptor; +use SimpleSAML\SAML2\XML\md\AttributeService; +use SimpleSAML\SAML2\XML\md\AuthnAuthorityDescriptor; +use SimpleSAML\SAML2\XML\md\AuthnQueryService; +use SimpleSAML\SAML2\XML\md\AuthzService; +use SimpleSAML\SAML2\XML\md\ContactPerson; +use SimpleSAML\SAML2\XML\md\EmailAddress; +use SimpleSAML\SAML2\XML\md\EntityDescriptor; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\md\IDPSSODescriptor; +use SimpleSAML\SAML2\XML\md\Organization; +use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; +use SimpleSAML\SAML2\XML\md\OrganizationName; +use SimpleSAML\SAML2\XML\md\OrganizationURL; +use SimpleSAML\SAML2\XML\md\PDPDescriptor; +use SimpleSAML\SAML2\XML\md\SingleSignOnService; +use SimpleSAML\SAML2\XML\md\UnknownRoleDescriptor; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; -use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{DurationValue, IDValue, LanguageValue, StringValue}; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\StringValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/md/ExtensionsTest.php b/tests/SAML2/XML/md/ExtensionsTest.php index 177ff1675f..a0fcdc3746 100644 --- a/tests/SAML2/XML/md/ExtensionsTest.php +++ b/tests/SAML2/XML/md/ExtensionsTest.php @@ -4,23 +4,39 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, CIDRValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\alg\{DigestMethod, SigningMethod}; -use SimpleSAML\SAML2\XML\emd\{RepublishRequest, RepublishTarget}; +use SimpleSAML\SAML2\Type\CIDRValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\alg\DigestMethod; +use SimpleSAML\SAML2\XML\alg\SigningMethod; +use SimpleSAML\SAML2\XML\emd\RepublishRequest; +use SimpleSAML\SAML2\XML\emd\RepublishTarget; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, Extensions}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\Extensions; use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; -use SimpleSAML\SAML2\XML\mdrpi\{Publication, PublicationInfo, PublicationPath, RegistrationInfo}; -use SimpleSAML\SAML2\XML\mdui\{DiscoHints, DisplayName, IPHint, UIInfo}; +use SimpleSAML\SAML2\XML\mdrpi\Publication; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; +use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; +use SimpleSAML\SAML2\XML\mdui\DiscoHints; +use SimpleSAML\SAML2\XML\mdui\DisplayName; +use SimpleSAML\SAML2\XML\mdui\IPHint; +use SimpleSAML\SAML2\XML\mdui\UIInfo; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\SAML2\XML\shibmd\Scope; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue, UnsignedShortValue}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/GivenNameTest.php b/tests/SAML2/XML/md/GivenNameTest.php index 724f06b579..b66e2bc03a 100644 --- a/tests/SAML2/XML/md/GivenNameTest.php +++ b/tests/SAML2/XML/md/GivenNameTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, GivenName}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\GivenName; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/IDPSSODescriptorTest.php b/tests/SAML2/XML/md/IDPSSODescriptorTest.php index 229ff81e91..59d8062300 100644 --- a/tests/SAML2/XML/md/IDPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/IDPSSODescriptorTest.php @@ -4,36 +4,43 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue, KeyTypesValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractRoleDescriptor, - AbstractRoleDescriptorType, - AbstractSignedMdElement, - ArtifactResolutionService, - AssertionIDRequestService, - AttributeProfile, - IDPSSODescriptor, - KeyDescriptor, - KeyTypesEnum, - ManageNameIDService, - NameIDFormat, - NameIDMappingService, - SingleLogoutService, - SingleSignOnService, -}; -use SimpleSAML\SAML2\XML\saml\{Attribute, AttributeValue}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\KeyTypesValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; +use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; +use SimpleSAML\SAML2\XML\md\AttributeProfile; +use SimpleSAML\SAML2\XML\md\IDPSSODescriptor; +use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\XML\md\KeyTypesEnum; +use SimpleSAML\SAML2\XML\md\ManageNameIDService; +use SimpleSAML\SAML2\XML\md\NameIDFormat; +use SimpleSAML\SAML2\XML\md\NameIDMappingService; +use SimpleSAML\SAML2\XML\md\SingleLogoutService; +use SimpleSAML\SAML2\XML\md\SingleSignOnService; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, IDValue, UnsignedShortValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/IndexedEndpointTypeTest.php b/tests/SAML2/XML/md/IndexedEndpointTypeTest.php index 939d38572b..52d05a6047 100644 --- a/tests/SAML2/XML/md/IndexedEndpointTypeTest.php +++ b/tests/SAML2/XML/md/IndexedEndpointTypeTest.php @@ -4,19 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\idpdisc\DiscoveryResponse; -use SimpleSAML\SAML2\XML\md\{ - AbstractIndexedEndpointType, - AbstractMdElement, - ArtifactResolutionService, - AssertionConsumerService, -}; +use SimpleSAML\SAML2\XML\md\AbstractIndexedEndpointType; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; +use SimpleSAML\SAML2\XML\md\AssertionConsumerService; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XMLSchema\Exception\{InvalidDOMElementException, MissingAttributeException}; +use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use function dirname; diff --git a/tests/SAML2/XML/md/KeyDescriptorTest.php b/tests/SAML2/XML/md/KeyDescriptorTest.php index 2255abacc0..c52db1efa9 100644 --- a/tests/SAML2/XML/md/KeyDescriptorTest.php +++ b/tests/SAML2/XML/md/KeyDescriptorTest.php @@ -4,15 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, KeyTypesValue}; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, EncryptionMethod, KeyDescriptor, KeyTypesEnum}; +use SimpleSAML\SAML2\Type\KeyTypesValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\EncryptionMethod; +use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\XML\md\KeyTypesEnum; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use SimpleSAML\XMLSchema\Type\StringValue; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/NameIDFormatTest.php b/tests/SAML2/XML/md/NameIDFormatTest.php index 58b60a5b83..ee2cb9e070 100644 --- a/tests/SAML2/XML/md/NameIDFormatTest.php +++ b/tests/SAML2/XML/md/NameIDFormatTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, NameIDFormat}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\NameIDFormat; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/NameIDMappingServiceTest.php b/tests/SAML2/XML/md/NameIDMappingServiceTest.php index eed5b984ef..ea1ecce2db 100644 --- a/tests/SAML2/XML/md/NameIDMappingServiceTest.php +++ b/tests/SAML2/XML/md/NameIDMappingServiceTest.php @@ -4,7 +4,8 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; @@ -12,7 +13,8 @@ use SimpleSAML\SAML2\XML\md\NameIDMappingService; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php index 862a26042b..a933446abf 100644 --- a/tests/SAML2/XML/md/OrganizationDisplayNameTest.php +++ b/tests/SAML2/XML/md/OrganizationDisplayNameTest.php @@ -4,12 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, OrganizationDisplayName}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/md/OrganizationNameTest.php b/tests/SAML2/XML/md/OrganizationNameTest.php index e45c9cbb48..ca3d686e8c 100644 --- a/tests/SAML2/XML/md/OrganizationNameTest.php +++ b/tests/SAML2/XML/md/OrganizationNameTest.php @@ -4,12 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, OrganizationName}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\OrganizationName; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/md/OrganizationTest.php b/tests/SAML2/XML/md/OrganizationTest.php index 766c5611ee..027f72e0c1 100644 --- a/tests/SAML2/XML/md/OrganizationTest.php +++ b/tests/SAML2/XML/md/OrganizationTest.php @@ -5,22 +5,26 @@ namespace SimpleSAML\Test\SAML2\XML\md; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - Extensions, - Organization, - OrganizationDisplayName, - OrganizationName, - OrganizationURL, -}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\md\Organization; +use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; +use SimpleSAML\SAML2\XML\md\OrganizationName; +use SimpleSAML\SAML2\XML\md\OrganizationURL; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{LanguageValue, StringValue}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/OrganizationURLTest.php b/tests/SAML2/XML/md/OrganizationURLTest.php index d7bded754e..7a8fa3ac5e 100644 --- a/tests/SAML2/XML/md/OrganizationURLTest.php +++ b/tests/SAML2/XML/md/OrganizationURLTest.php @@ -4,12 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI, AbstractMdElement, OrganizationURL}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\OrganizationURL; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/md/PDPDescriptorTest.php b/tests/SAML2/XML/md/PDPDescriptorTest.php index aadd29a0f2..e845c16196 100644 --- a/tests/SAML2/XML/md/PDPDescriptorTest.php +++ b/tests/SAML2/XML/md/PDPDescriptorTest.php @@ -4,24 +4,25 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{AnyURIListValue, SAMLAnyURIValue}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractRoleDescriptor, - AbstractRoleDescriptorType, - AbstractSignedMdElement, - AssertionIDRequestService, - AuthzService, - NameIDFormat, - PDPDescriptor, -}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\AssertionIDRequestService; +use SimpleSAML\SAML2\XML\md\AuthzService; +use SimpleSAML\SAML2\XML\md\NameIDFormat; +use SimpleSAML\SAML2\XML\md\PDPDescriptor; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; diff --git a/tests/SAML2/XML/md/RequestedAttributeTest.php b/tests/SAML2/XML/md/RequestedAttributeTest.php index 0f53562a97..fc1446ad37 100644 --- a/tests/SAML2/XML/md/RequestedAttributeTest.php +++ b/tests/SAML2/XML/md/RequestedAttributeTest.php @@ -4,14 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, RequestedAttribute}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\RequestedAttribute; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; diff --git a/tests/SAML2/XML/md/RoleDescriptorTest.php b/tests/SAML2/XML/md/RoleDescriptorTest.php index 0242d9b437..fca7b349b9 100644 --- a/tests/SAML2/XML/md/RoleDescriptorTest.php +++ b/tests/SAML2/XML/md/RoleDescriptorTest.php @@ -4,49 +4,54 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{ - AnyURIListValue, - EmailAddressValue, - KeyTypesValue, - SAMLAnyURIValue, - SAMLDateTimeValue, - SAMLStringValue, -}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractRoleDescriptor, - AbstractRoleDescriptorType, - AbstractSignedMdElement, - Company, - ContactPerson, - EmailAddress, - EncryptionMethod, - Extensions, - GivenName, - KeyDescriptor, - KeyTypesEnum, - Organization, - OrganizationDisplayName, - OrganizationName, - OrganizationURL, - SurName, - TelephoneNumber, - UnknownRoleDescriptor, -}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\EmailAddressValue; +use SimpleSAML\SAML2\Type\KeyTypesValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\Company; +use SimpleSAML\SAML2\XML\md\ContactPerson; +use SimpleSAML\SAML2\XML\md\EmailAddress; +use SimpleSAML\SAML2\XML\md\EncryptionMethod; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\md\GivenName; +use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\XML\md\KeyTypesEnum; +use SimpleSAML\SAML2\XML\md\Organization; +use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; +use SimpleSAML\SAML2\XML\md\OrganizationName; +use SimpleSAML\SAML2\XML\md\OrganizationURL; +use SimpleSAML\SAML2\XML\md\SurName; +use SimpleSAML\SAML2\XML\md\TelephoneNumber; +use SimpleSAML\SAML2\XML\md\UnknownRoleDescriptor; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\Test\SAML2\CustomRoleDescriptor; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; -use SimpleSAML\XMLSchema\Type\{AnyURIValue, DurationValue, IDValue, LanguageValue, StringValue}; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/SPSSODescriptorTest.php b/tests/SAML2/XML/md/SPSSODescriptorTest.php index 5d63698262..24140b0b92 100644 --- a/tests/SAML2/XML/md/SPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/SPSSODescriptorTest.php @@ -4,51 +4,56 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; -use SimpleSAML\SAML2\Type\{ - AnyURIListValue, - SAMLAnyURIValue, - SAMLDateTimeValue, - EmailAddressValue, - KeyTypesValue, - SAMLStringValue, -}; -use SimpleSAML\SAML2\XML\md\{ - AbstractMdElement, - AbstractMetadataDocument, - AbstractRoleDescriptor, - AbstractRoleDescriptorType, - AbstractSignedMdElement, - ArtifactResolutionService, - AssertionConsumerService, - AttributeConsumingService, - ContactPerson, - EmailAddress, - Extensions, - KeyDescriptor, - KeyTypesEnum, - ManageNameIDService, - NameIDFormat, - Organization, - OrganizationDisplayName, - OrganizationName, - OrganizationURL, - RequestedAttribute, - ServiceName, - SingleLogoutService, - SPSSODescriptor, -}; -use SimpleSAML\SAML2\XML\mdrpi\{PublicationInfo, UsagePolicy}; +use SimpleSAML\SAML2\Type\AnyURIListValue; +use SimpleSAML\SAML2\Type\EmailAddressValue; +use SimpleSAML\SAML2\Type\KeyTypesValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\AbstractMetadataDocument; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor; +use SimpleSAML\SAML2\XML\md\AbstractRoleDescriptorType; +use SimpleSAML\SAML2\XML\md\AbstractSignedMdElement; +use SimpleSAML\SAML2\XML\md\ArtifactResolutionService; +use SimpleSAML\SAML2\XML\md\AssertionConsumerService; +use SimpleSAML\SAML2\XML\md\AttributeConsumingService; +use SimpleSAML\SAML2\XML\md\ContactPerson; +use SimpleSAML\SAML2\XML\md\EmailAddress; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\md\KeyDescriptor; +use SimpleSAML\SAML2\XML\md\KeyTypesEnum; +use SimpleSAML\SAML2\XML\md\ManageNameIDService; +use SimpleSAML\SAML2\XML\md\NameIDFormat; +use SimpleSAML\SAML2\XML\md\Organization; +use SimpleSAML\SAML2\XML\md\OrganizationDisplayName; +use SimpleSAML\SAML2\XML\md\OrganizationName; +use SimpleSAML\SAML2\XML\md\OrganizationURL; +use SimpleSAML\SAML2\XML\md\RequestedAttribute; +use SimpleSAML\SAML2\XML\md\ServiceName; +use SimpleSAML\SAML2\XML\md\SingleLogoutService; +use SimpleSAML\SAML2\XML\md\SPSSODescriptor; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; -use SimpleSAML\XMLSchema\Type\{BooleanValue, DurationValue, IDValue, LanguageValue, StringValue, UnsignedShortValue}; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\DurationValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/ServiceDescriptionTest.php b/tests/SAML2/XML/md/ServiceDescriptionTest.php index 4ce83dfcb3..e8c5a54fe2 100644 --- a/tests/SAML2/XML/md/ServiceDescriptionTest.php +++ b/tests/SAML2/XML/md/ServiceDescriptionTest.php @@ -4,12 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceDescription}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\ServiceDescription; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/md/ServiceNameTest.php b/tests/SAML2/XML/md/ServiceNameTest.php index 94067c1c49..f6cbb202d1 100644 --- a/tests/SAML2/XML/md/ServiceNameTest.php +++ b/tests/SAML2/XML/md/ServiceNameTest.php @@ -4,13 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement, ServiceName}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\ServiceName; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\LanguageValue; diff --git a/tests/SAML2/XML/md/SingleSignOnServiceTest.php b/tests/SAML2/XML/md/SingleSignOnServiceTest.php index 3d80a88085..9be2f2d660 100644 --- a/tests/SAML2/XML/md/SingleSignOnServiceTest.php +++ b/tests/SAML2/XML/md/SingleSignOnServiceTest.php @@ -4,14 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, SingleSignOnService}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\SingleSignOnService; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/SurNameTest.php b/tests/SAML2/XML/md/SurNameTest.php index 3d190349af..0d2c99cc26 100644 --- a/tests/SAML2/XML/md/SurNameTest.php +++ b/tests/SAML2/XML/md/SurNameTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, SurName}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\SurName; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/md/TelephoneNumberTest.php b/tests/SAML2/XML/md/TelephoneNumberTest.php index d805ff8b97..f5bb3fe9d7 100644 --- a/tests/SAML2/XML/md/TelephoneNumberTest.php +++ b/tests/SAML2/XML/md/TelephoneNumberTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\md; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractMdElement, TelephoneNumber}; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; +use SimpleSAML\SAML2\XML\md\TelephoneNumber; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; /** * Tests for TelephoneNumber. diff --git a/tests/SAML2/XML/mdattr/EntityAttributesTest.php b/tests/SAML2/XML/mdattr/EntityAttributesTest.php index 523d07623f..3950744700 100644 --- a/tests/SAML2/XML/mdattr/EntityAttributesTest.php +++ b/tests/SAML2/XML/mdattr/EntityAttributesTest.php @@ -4,25 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\mdattr; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\mdattr\{AbstractMdattrElement, EntityAttributes}; -use SimpleSAML\SAML2\XML\saml\{ - Assertion, - Attribute, - AttributeStatement, - AttributeValue, - Audience, - AudienceRestriction, - Conditions, - Issuer, - NameID, - Subject, -}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\mdattr\AbstractMdattrElement; +use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeStatement; +use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\AudienceRestriction; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XML\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php index b4649d1496..c1fbe7ef1f 100644 --- a/tests/SAML2/XML/mdrpi/PublicationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationInfoTest.php @@ -5,14 +5,25 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{AffiliationDescriptor, EntitiesDescriptor, EntityDescriptor, Extensions}; -use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, PublicationInfo, UsagePolicy}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AffiliationDescriptor; +use SimpleSAML\SAML2\XML\md\EntitiesDescriptor; +use SimpleSAML\SAML2\XML\md\EntityDescriptor; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; +use SimpleSAML\SAML2\XML\mdrpi\PublicationInfo; +use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\LanguageValue; @@ -33,6 +44,7 @@ final class PublicationInfoTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMDocument */ private static DOMDocument $affiliationDescriptor; diff --git a/tests/SAML2/XML/mdrpi/PublicationPathTest.php b/tests/SAML2/XML/mdrpi/PublicationPathTest.php index c4e297e570..5fc34bd660 100644 --- a/tests/SAML2/XML/mdrpi/PublicationPathTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationPathTest.php @@ -4,12 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, Publication, PublicationPath}; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; +use SimpleSAML\SAML2\XML\mdrpi\Publication; +use SimpleSAML\SAML2\XML\mdrpi\PublicationPath; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdrpi/PublicationTest.php b/tests/SAML2/XML/mdrpi/PublicationTest.php index 0ef06ce272..a0d07fb9f4 100644 --- a/tests/SAML2/XML/mdrpi/PublicationTest.php +++ b/tests/SAML2/XML/mdrpi/PublicationTest.php @@ -4,13 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, Publication}; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; +use SimpleSAML\SAML2\XML\mdrpi\Publication; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use function dirname; diff --git a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php index 82e6c18cf9..7f667e3af4 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationInfoTest.php @@ -5,14 +5,25 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\md\{AffiliationDescriptor, EntitiesDescriptor, EntityDescriptor, Extensions}; -use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, RegistrationInfo, RegistrationPolicy}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\md\AffiliationDescriptor; +use SimpleSAML\SAML2\XML\md\EntitiesDescriptor; +use SimpleSAML\SAML2\XML\md\EntityDescriptor; +use SimpleSAML\SAML2\XML\md\Extensions; +use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; +use SimpleSAML\SAML2\XML\mdrpi\RegistrationInfo; +use SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\LanguageValue; @@ -33,6 +44,7 @@ final class RegistrationInfoTest extends TestCase use SchemaValidationTestTrait; use SerializableElementTestTrait; + /** @var \DOMDocument */ private static DOMDocument $affiliationDescriptor; diff --git a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php index 0a2bac6101..06ec31c06d 100644 --- a/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php +++ b/tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI}; -use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, RegistrationPolicy}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; +use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; +use SimpleSAML\SAML2\XML\mdrpi\RegistrationPolicy; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php index 6b3656cdc9..2e0f55a530 100644 --- a/tests/SAML2/XML/mdrpi/UsagePolicyTest.php +++ b/tests/SAML2/XML/mdrpi/UsagePolicyTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\mdrpi; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI}; -use SimpleSAML\SAML2\XML\mdrpi\{AbstractMdrpiElement, UsagePolicy}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; +use SimpleSAML\SAML2\XML\mdrpi\AbstractMdrpiElement; +use SimpleSAML\SAML2\XML\mdrpi\UsagePolicy; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdui/DescriptionTest.php b/tests/SAML2/XML/mdui/DescriptionTest.php index 0c7453d6c7..c4789cd57f 100644 --- a/tests/SAML2/XML/mdui/DescriptionTest.php +++ b/tests/SAML2/XML/mdui/DescriptionTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\SAML2\XML\mdui\Description; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdui/DiscoHintsTest.php b/tests/SAML2/XML/mdui/DiscoHintsTest.php index 82557559ff..bf351e17ee 100644 --- a/tests/SAML2/XML/mdui/DiscoHintsTest.php +++ b/tests/SAML2/XML/mdui/DiscoHintsTest.php @@ -4,20 +4,25 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{CIDRValue, DomainValue, GeolocationValue, ListOfStringsValue}; +use SimpleSAML\SAML2\Type\CIDRValue; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\SAML2\Type\GeolocationValue; +use SimpleSAML\SAML2\Type\ListOfStringsValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\mdui\{ - AbstractMduiElement, - DiscoHints, - DomainHint, - GeolocationHint, - IPHint, - Keywords, -}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; +use SimpleSAML\SAML2\XML\mdui\DiscoHints; +use SimpleSAML\SAML2\XML\mdui\DomainHint; +use SimpleSAML\SAML2\XML\mdui\GeolocationHint; +use SimpleSAML\SAML2\XML\mdui\IPHint; +use SimpleSAML\SAML2\XML\mdui\Keywords; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdui/DisplayNameTest.php b/tests/SAML2/XML/mdui/DisplayNameTest.php index b7af0259c1..1da768cac0 100644 --- a/tests/SAML2/XML/mdui/DisplayNameTest.php +++ b/tests/SAML2/XML/mdui/DisplayNameTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractMdElement}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\SAML2\XML\mdui\DisplayName; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdui/DomainHintTest.php b/tests/SAML2/XML/mdui/DomainHintTest.php index 48a7753999..b2442107fc 100644 --- a/tests/SAML2/XML/mdui/DomainHintTest.php +++ b/tests/SAML2/XML/mdui/DomainHintTest.php @@ -4,13 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\DomainValue; use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; use SimpleSAML\SAML2\XML\mdui\DomainHint; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/GeolocationHintTest.php b/tests/SAML2/XML/mdui/GeolocationHintTest.php index e4c8dd0980..6396da36e4 100644 --- a/tests/SAML2/XML/mdui/GeolocationHintTest.php +++ b/tests/SAML2/XML/mdui/GeolocationHintTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\GeolocationValue; -use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, GeolocationHint}; +use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; +use SimpleSAML\SAML2\XML\mdui\GeolocationHint; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/IPHintTest.php b/tests/SAML2/XML/mdui/IPHintTest.php index 0dafa8be24..a952414fe3 100644 --- a/tests/SAML2/XML/mdui/IPHintTest.php +++ b/tests/SAML2/XML/mdui/IPHintTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\CIDRValue; -use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, IPHint}; +use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; +use SimpleSAML\SAML2\XML\mdui\IPHint; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/InformationURLTest.php b/tests/SAML2/XML/mdui/InformationURLTest.php index db25586158..b5064923d5 100644 --- a/tests/SAML2/XML/mdui/InformationURLTest.php +++ b/tests/SAML2/XML/mdui/InformationURLTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI, AbstractMdElement}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\SAML2\XML\mdui\InformationURL; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdui/KeywordsTest.php b/tests/SAML2/XML/mdui/KeywordsTest.php index 0fa9299b64..ab18c68b85 100644 --- a/tests/SAML2/XML/mdui/KeywordsTest.php +++ b/tests/SAML2/XML/mdui/KeywordsTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\ListOfStringsValue; -use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, Keywords}; +use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; +use SimpleSAML\SAML2\XML\mdui\Keywords; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdui/LogoTest.php b/tests/SAML2/XML/mdui/LogoTest.php index b1ed6465ed..6a91b8cbb8 100644 --- a/tests/SAML2/XML/mdui/LogoTest.php +++ b/tests/SAML2/XML/mdui/LogoTest.php @@ -4,16 +4,21 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\mdui\{AbstractMduiElement, Logo}; +use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; +use SimpleSAML\SAML2\XML\mdui\Logo; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; -use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue}; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php index 408e0d245b..d60abcd67c 100644 --- a/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php +++ b/tests/SAML2/XML/mdui/PrivacyStatementURLTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\md\{AbstractLocalizedName, AbstractLocalizedURI, AbstractMdElement}; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedName; +use SimpleSAML\SAML2\XML\md\AbstractLocalizedURI; +use SimpleSAML\SAML2\XML\md\AbstractMdElement; use SimpleSAML\SAML2\XML\mdui\PrivacyStatementURL; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\LanguageValue; use function dirname; diff --git a/tests/SAML2/XML/mdui/UIInfoTest.php b/tests/SAML2/XML/mdui/UIInfoTest.php index e470ba2d8b..d6f7df287e 100644 --- a/tests/SAML2/XML/mdui/UIInfoTest.php +++ b/tests/SAML2/XML/mdui/UIInfoTest.php @@ -4,26 +4,32 @@ namespace SimpleSAML\Test\SAML2\XML\mdui; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, CIDRValue, ListOfStringsValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\CIDRValue; +use SimpleSAML\SAML2\Type\ListOfStringsValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\mdui\{ - AbstractMduiElement, - Description, - DiscoHints, - DisplayName, - InformationURL, - IPHint, - Keywords, - Logo, - PrivacyStatementURL, - UIInfo, -}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{LanguageValue, PositiveIntegerValue}; +use SimpleSAML\SAML2\XML\mdui\AbstractMduiElement; +use SimpleSAML\SAML2\XML\mdui\Description; +use SimpleSAML\SAML2\XML\mdui\DiscoHints; +use SimpleSAML\SAML2\XML\mdui\DisplayName; +use SimpleSAML\SAML2\XML\mdui\InformationURL; +use SimpleSAML\SAML2\XML\mdui\IPHint; +use SimpleSAML\SAML2\XML\mdui\Keywords; +use SimpleSAML\SAML2\XML\mdui\Logo; +use SimpleSAML\SAML2\XML\mdui\PrivacyStatementURL; +use SimpleSAML\SAML2\XML\mdui\UIInfo; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\LanguageValue; +use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/ActionTest.php b/tests/SAML2/XML/saml/ActionTest.php index 993ccd4627..96486a3fc5 100644 --- a/tests/SAML2/XML/saml/ActionTest.php +++ b/tests/SAML2/XML/saml/ActionTest.php @@ -4,10 +4,13 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Action}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Action; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; diff --git a/tests/SAML2/XML/saml/AdviceTest.php b/tests/SAML2/XML/saml/AdviceTest.php index 0b4df5e7a2..5f8c2f4690 100644 --- a/tests/SAML2/XML/saml/AdviceTest.php +++ b/tests/SAML2/XML/saml/AdviceTest.php @@ -5,18 +5,19 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - Advice, - Assertion, - AssertionIDRef, - AssertionURIRef, - EncryptedAssertion, -}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Advice; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\AssertionIDRef; +use SimpleSAML\SAML2\XML\saml\AssertionURIRef; +use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AssertionIDRefTest.php b/tests/SAML2/XML/saml/AssertionIDRefTest.php index ef845ed875..6c455c88e6 100644 --- a/tests/SAML2/XML/saml/AssertionIDRefTest.php +++ b/tests/SAML2/XML/saml/AssertionIDRefTest.php @@ -4,11 +4,14 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AssertionIDRef}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AssertionIDRef; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\NCNameValue; use function dirname; diff --git a/tests/SAML2/XML/saml/AssertionTest.php b/tests/SAML2/XML/saml/AssertionTest.php index 825f536efb..d650b15269 100644 --- a/tests/SAML2/XML/saml/AssertionTest.php +++ b/tests/SAML2/XML/saml/AssertionTest.php @@ -5,47 +5,56 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use Exception; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooLowException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, DomainValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - Assertion, - Attribute, - AttributeStatement, - AttributeValue, - Audience, - AudienceRestriction, - AuthenticatingAuthority, - AuthnContext, - AuthnContextClassRef, - AuthnContextDeclRef, - AuthnStatement, - Conditions, - EncryptedAssertion, - EncryptedID, - Issuer, - NameID, - Subject, - SubjectConfirmation, - SubjectConfirmationData, - SubjectLocality, -}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeStatement; +use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\AudienceRestriction; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\XML\saml\AuthnStatement; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; +use SimpleSAML\SAML2\XML\saml\EncryptedID; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\SAML2\XML\saml\SubjectLocality; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingElementException; -use SimpleSAML\XMLSchema\Type\{Base64BinaryValue, IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\Exception\SignatureVerificationFailedException; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, X509Certificate, X509Data}; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\X509Certificate; +use SimpleSAML\XMLSecurity\XML\ds\X509Data; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AssertionURIRefTest.php b/tests/SAML2/XML/saml/AssertionURIRefTest.php index 802863921e..bd78c12806 100644 --- a/tests/SAML2/XML/saml/AssertionURIRefTest.php +++ b/tests/SAML2/XML/saml/AssertionURIRefTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AssertionURIRef}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AssertionURIRef; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AttributeStatementTest.php b/tests/SAML2/XML/saml/AttributeStatementTest.php index 664c638218..d5c2a5f126 100644 --- a/tests/SAML2/XML/saml/AttributeStatementTest.php +++ b/tests/SAML2/XML/saml/AttributeStatementTest.php @@ -4,7 +4,8 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -13,7 +14,8 @@ use SimpleSAML\SAML2\XML\saml\AttributeStatement; use SimpleSAML\SAML2\XML\saml\AttributeValue; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AttributeTest.php b/tests/SAML2/XML/saml/AttributeTest.php index 9ea6e2e2a1..42b668ea14 100644 --- a/tests/SAML2/XML/saml/AttributeTest.php +++ b/tests/SAML2/XML/saml/AttributeTest.php @@ -5,15 +5,22 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use DateTimeImmutable; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Attribute, AttributeValue, EncryptedAttribute}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\XML\saml\EncryptedAttribute; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingAttributeException; use SimpleSAML\XMLSchema\Type\StringValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; diff --git a/tests/SAML2/XML/saml/AttributeValueTest.php b/tests/SAML2/XML/saml/AttributeValueTest.php index ea0b1730fd..777a7e39ad 100644 --- a/tests/SAML2/XML/saml/AttributeValueTest.php +++ b/tests/SAML2/XML/saml/AttributeValueTest.php @@ -5,12 +5,16 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use DateTimeImmutable; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AttributeValue, NameID}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\XML\saml\NameID; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; diff --git a/tests/SAML2/XML/saml/AudienceRestrictionTest.php b/tests/SAML2/XML/saml/AudienceRestrictionTest.php index 94eac4f014..8b281b9050 100644 --- a/tests/SAML2/XML/saml/AudienceRestrictionTest.php +++ b/tests/SAML2/XML/saml/AudienceRestrictionTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Audience, AudienceRestriction}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\AudienceRestriction; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AudienceTest.php b/tests/SAML2/XML/saml/AudienceTest.php index 27c50eae10..06500997c5 100644 --- a/tests/SAML2/XML/saml/AudienceTest.php +++ b/tests/SAML2/XML/saml/AudienceTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{AbstractConditionType, AbstractSamlElement, Audience}; +use SimpleSAML\SAML2\XML\saml\AbstractConditionType; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Audience; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php b/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php index 4892021c5e..153c418b23 100644 --- a/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php +++ b/tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextClassRefTest.php b/tests/SAML2/XML/saml/AuthnContextClassRefTest.php index 749b6b37e2..9eb5419944 100644 --- a/tests/SAML2/XML/saml/AuthnContextClassRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextClassRefTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthnContextClassRef}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php index 6d37552a01..4c8b454138 100644 --- a/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextDeclRefTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthnContextDeclRef}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextDeclTest.php b/tests/SAML2/XML/saml/AuthnContextDeclTest.php index e13e3bdde6..abc63245e3 100644 --- a/tests/SAML2/XML/saml/AuthnContextDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextDeclTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthnContextDecl}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; diff --git a/tests/SAML2/XML/saml/AuthnContextTest.php b/tests/SAML2/XML/saml/AuthnContextTest.php index 16aa864312..655ad206c1 100644 --- a/tests/SAML2/XML/saml/AuthnContextTest.php +++ b/tests/SAML2/XML/saml/AuthnContextTest.php @@ -5,19 +5,19 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - AuthenticatingAuthority, - AuthnContext, - AuthnContextClassRef, - AuthnContextDecl, - AuthnContextDeclRef, -}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php index afa1476183..a524c47da8 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php @@ -4,19 +4,20 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - AuthenticatingAuthority, - AuthnContext, - AuthnContextClassRef, - AuthnContextDeclRef, -}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php index 145ca50d8f..d1e44cb7e8 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php @@ -4,20 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - AuthenticatingAuthority, - AuthnContext, - AuthnContextClassRef, - AuthnContextDecl, -}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; diff --git a/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php index d164eb0a23..8620433ae1 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php @@ -4,13 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority, AuthnContext, AuthnContextClassRef}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php index 93ed7d43e2..5d8d871433 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php @@ -4,12 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority, AuthnContext, AuthnContextDeclRef}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php index eddf356492..e6e45ea900 100644 --- a/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php +++ b/tests/SAML2/XML/saml/AuthnContextWithDeclTest.php @@ -4,13 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, AuthenticatingAuthority, AuthnContext, AuthnContextDecl}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextDecl; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\StringValue; use function dirname; diff --git a/tests/SAML2/XML/saml/AuthnStatementTest.php b/tests/SAML2/XML/saml/AuthnStatementTest.php index 152975f466..5b1721ee90 100644 --- a/tests/SAML2/XML/saml/AuthnStatementTest.php +++ b/tests/SAML2/XML/saml/AuthnStatementTest.php @@ -4,22 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, DomainValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - AuthenticatingAuthority, - AuthnContext, - AuthnContextClassRef, - AuthnStatement, - SubjectLocality, -}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AuthenticatingAuthority; +use SimpleSAML\SAML2\XML\saml\AuthnContext; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnStatement; +use SimpleSAML\SAML2\XML\saml\SubjectLocality; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php index 64ef65fee7..ea5818381e 100644 --- a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php +++ b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php @@ -5,19 +5,21 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{DecisionTypeValue, SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - AbstractStatement, - Action, - AuthzDecisionStatement, - DecisionTypeEnum, - Evidence, -}; +use SimpleSAML\SAML2\Type\DecisionTypeValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AbstractStatement; +use SimpleSAML\SAML2\XML\saml\Action; +use SimpleSAML\SAML2\XML\saml\AuthzDecisionStatement; +use SimpleSAML\SAML2\XML\saml\DecisionTypeEnum; +use SimpleSAML\SAML2\XML\saml\Evidence; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/BaseIDTest.php b/tests/SAML2/XML/saml/BaseIDTest.php index 7f6b0d96b6..58c81b632b 100644 --- a/tests/SAML2/XML/saml/BaseIDTest.php +++ b/tests/SAML2/XML/saml/BaseIDTest.php @@ -4,20 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{ - AbstractBaseID, - AbstractBaseIDType, - AbstractSamlElement, - Audience, - UnknownID, -}; -use SimpleSAML\Test\SAML2\{Constants as C, CustomBaseID}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractBaseID; +use SimpleSAML\SAML2\XML\saml\AbstractBaseIDType; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\UnknownID; +use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\Test\SAML2\CustomBaseID; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; diff --git a/tests/SAML2/XML/saml/ConditionTest.php b/tests/SAML2/XML/saml/ConditionTest.php index a309a0235b..125a8be585 100644 --- a/tests/SAML2/XML/saml/ConditionTest.php +++ b/tests/SAML2/XML/saml/ConditionTest.php @@ -4,20 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{ - AbstractCondition, - AbstractConditionType, - AbstractSamlElement, - Audience, - UnknownCondition, -}; -use SimpleSAML\Test\SAML2\{Constants as C, CustomCondition}; +use SimpleSAML\SAML2\XML\saml\AbstractCondition; +use SimpleSAML\SAML2\XML\saml\AbstractConditionType; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\UnknownCondition; +use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\Test\SAML2\CustomCondition; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; diff --git a/tests/SAML2/XML/saml/ConditionsTest.php b/tests/SAML2/XML/saml/ConditionsTest.php index f304d50ead..b4eb78638c 100644 --- a/tests/SAML2/XML/saml/ConditionsTest.php +++ b/tests/SAML2/XML/saml/ConditionsTest.php @@ -4,20 +4,21 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue}; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - Audience, - AudienceRestriction, - Conditions, - OneTimeUse, - ProxyRestriction, -}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\AudienceRestriction; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\OneTimeUse; +use SimpleSAML\SAML2\XML\saml\ProxyRestriction; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function dirname; diff --git a/tests/SAML2/XML/saml/EncryptedAssertionTest.php b/tests/SAML2/XML/saml/EncryptedAssertionTest.php index cbd79c1aa0..ab55542e31 100644 --- a/tests/SAML2/XML/saml/EncryptedAssertionTest.php +++ b/tests/SAML2/XML/saml/EncryptedAssertionTest.php @@ -4,40 +4,42 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - Assertion, - EncryptedAssertion, - Issuer, - NameID, - Subject, -}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XPath\Constants as C_XPATH; -use SimpleSAML\XMLSchema\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\StringValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; -use SimpleSAML\XMLSecurity\XML\ds\{ - KeyInfo, - RetrievalMethod, - Transform, - Transforms, - XPath, -}; -use SimpleSAML\XMLSecurity\XML\xenc\{ - CipherData, - CipherValue, - EncryptedData, - EncryptedKey, - EncryptionMethod, -}; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\RetrievalMethod; +use SimpleSAML\XMLSecurity\XML\ds\Transform; +use SimpleSAML\XMLSecurity\XML\ds\Transforms; +use SimpleSAML\XMLSecurity\XML\ds\XPath; +use SimpleSAML\XMLSecurity\XML\xenc\CipherData; +use SimpleSAML\XMLSecurity\XML\xenc\CipherValue; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptedData; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod; +use SimpleSAML\XPath\Constants as C_XPATH; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/EncryptedAttributeTest.php b/tests/SAML2/XML/saml/EncryptedAttributeTest.php index 40093fd661..4c95097f4b 100644 --- a/tests/SAML2/XML/saml/EncryptedAttributeTest.php +++ b/tests/SAML2/XML/saml/EncryptedAttributeTest.php @@ -4,13 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Attribute, AttributeValue, EncryptedAttribute}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\XML\saml\EncryptedAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\Constants as C; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/SAML2/XML/saml/EncryptedIDTest.php b/tests/SAML2/XML/saml/EncryptedIDTest.php index d4bf324058..311d68bbec 100644 --- a/tests/SAML2/XML/saml/EncryptedIDTest.php +++ b/tests/SAML2/XML/saml/EncryptedIDTest.php @@ -5,37 +5,40 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use InvalidArgumentException; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - Attribute, - Audience, - EncryptedID, - NameID, - UnknownID, -}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\EncryptedID; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\UnknownID; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\Test\SAML2\CustomBaseID; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{AnyURIValue, Base64BinaryValue, IDValue, StringValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\StringValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; -use SimpleSAML\XMLSecurity\XML\xenc\{ - CarriedKeyName, - CipherData, - CipherValue, - DataReference, - EncryptedData, - EncryptedKey, - EncryptionMethod, - ReferenceList, -}; +use SimpleSAML\XMLSecurity\XML\xenc\CarriedKeyName; +use SimpleSAML\XMLSecurity\XML\xenc\CipherData; +use SimpleSAML\XMLSecurity\XML\xenc\CipherValue; +use SimpleSAML\XMLSecurity\XML\xenc\DataReference; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptedData; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod; +use SimpleSAML\XMLSecurity\XML\xenc\ReferenceList; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/EvidenceTest.php b/tests/SAML2/XML/saml/EvidenceTest.php index 8e341783fa..d862460232 100644 --- a/tests/SAML2/XML/saml/EvidenceTest.php +++ b/tests/SAML2/XML/saml/EvidenceTest.php @@ -5,18 +5,18 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - Assertion, - AssertionIDRef, - AssertionURIRef, - EncryptedAssertion, - Evidence, -}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\AssertionIDRef; +use SimpleSAML\SAML2\XML\saml\AssertionURIRef; +use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; +use SimpleSAML\SAML2\XML\saml\Evidence; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/IssuerTest.php b/tests/SAML2/XML/saml/IssuerTest.php index 2d2432eb8a..4604950323 100644 --- a/tests/SAML2/XML/saml/IssuerTest.php +++ b/tests/SAML2/XML/saml/IssuerTest.php @@ -4,14 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Issuer, NameIDType}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameIDType; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/NameIDTest.php b/tests/SAML2/XML/saml/NameIDTest.php index 239fa2bd4f..c80e83d879 100644 --- a/tests/SAML2/XML/saml/NameIDTest.php +++ b/tests/SAML2/XML/saml/NameIDTest.php @@ -4,12 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, NameID, NameIDType}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\NameIDType; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/OneTimeUseTest.php b/tests/SAML2/XML/saml/OneTimeUseTest.php index 1493a4a62b..da53a6b27c 100644 --- a/tests/SAML2/XML/saml/OneTimeUseTest.php +++ b/tests/SAML2/XML/saml/OneTimeUseTest.php @@ -4,11 +4,15 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\saml\{AbstractConditionType, AbstractSamlElement, OneTimeUse}; +use SimpleSAML\SAML2\XML\saml\AbstractConditionType; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\OneTimeUse; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/ProxyRestrictionTest.php b/tests/SAML2/XML/saml/ProxyRestrictionTest.php index 50f2ebc682..11b10cd93e 100644 --- a/tests/SAML2/XML/saml/ProxyRestrictionTest.php +++ b/tests/SAML2/XML/saml/ProxyRestrictionTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, Audience, ProxyRestriction}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\ProxyRestriction; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function dirname; diff --git a/tests/SAML2/XML/saml/StatementTest.php b/tests/SAML2/XML/saml/StatementTest.php index 48ae467ca0..bd2429a9f8 100644 --- a/tests/SAML2/XML/saml/StatementTest.php +++ b/tests/SAML2/XML/saml/StatementTest.php @@ -4,20 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Compat\{AbstractContainer, ContainerSingleton}; +use SimpleSAML\SAML2\Compat\AbstractContainer; +use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\saml\{ - AbstractSamlElement, - AbstractStatement, - AbstractStatementType, - Audience, - UnknownStatement, -}; -use SimpleSAML\Test\SAML2\{Constants as C, CustomStatement}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\AbstractStatement; +use SimpleSAML\SAML2\XML\saml\AbstractStatementType; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\UnknownStatement; +use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\Test\SAML2\CustomStatement; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; use function dirname; diff --git a/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php index a37f247930..3084efd731 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationDataTest.php @@ -4,15 +4,24 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, SubjectConfirmationData}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; use SimpleSAML\Test\SAML2\Constants as C; -use SimpleSAML\XML\{Attribute as XMLAttribute, Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{NCNameValue, StringValue}; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XML\Attribute as XMLAttribute; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/SubjectConfirmationTest.php b/tests/SAML2/XML/saml/SubjectConfirmationTest.php index 29ccac03c0..50d09a7f3e 100644 --- a/tests/SAML2/XML/saml/SubjectConfirmationTest.php +++ b/tests/SAML2/XML/saml/SubjectConfirmationTest.php @@ -4,20 +4,32 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, NameID, SubjectConfirmation, SubjectConfirmationData}; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\Attribute as XMLAttribute; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{NCNameValue, StringValue}; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/SubjectLocalityTest.php b/tests/SAML2/XML/saml/SubjectLocalityTest.php index 35f6a961cc..8021d84f50 100644 --- a/tests/SAML2/XML/saml/SubjectLocalityTest.php +++ b/tests/SAML2/XML/saml/SubjectLocalityTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\saml; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{DomainValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AbstractSamlElement, SubjectLocality}; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\SubjectLocality; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/saml/SubjectTest.php b/tests/SAML2/XML/saml/SubjectTest.php index 54f76f6e66..cf780ccccd 100644 --- a/tests/SAML2/XML/saml/SubjectTest.php +++ b/tests/SAML2/XML/saml/SubjectTest.php @@ -5,26 +5,34 @@ namespace SimpleSAML\Test\SAML2\XML\saml; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{ - AbstractBaseID, - AbstractSamlElement, - Audience, - NameID, - Subject, - SubjectConfirmation, - SubjectConfirmationData, -}; -use SimpleSAML\Test\SAML2\{Constants as C, CustomBaseID}; -use SimpleSAML\XML\{Attribute as XMLAttribute, Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\SAML2\XML\saml\AbstractBaseID; +use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmation; +use SimpleSAML\SAML2\XML\saml\SubjectConfirmationData; +use SimpleSAML\Test\SAML2\Constants as C; +use SimpleSAML\Test\SAML2\CustomBaseID; +use SimpleSAML\XML\Attribute as XMLAttribute; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Constants as C_XSI; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; -use SimpleSAML\XMLSchema\Type\{NCNameValue, StringValue}; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, KeyName}; +use SimpleSAML\XMLSchema\Type\NCNameValue; +use SimpleSAML\XMLSchema\Type\StringValue; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\KeyName; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/AbstractMessageTest.php b/tests/SAML2/XML/samlp/AbstractMessageTest.php index 19048dc80c..c588d80ec9 100644 --- a/tests/SAML2/XML/samlp/AbstractMessageTest.php +++ b/tests/SAML2/XML/samlp/AbstractMessageTest.php @@ -6,25 +6,27 @@ use DOMElement; use Exception; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\Protocol\RequestVersionTooHighException; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractSamlpElement, - Extensions, - MessageFactory, - Response, - Status, - StatusCode, -}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\Extensions; +use SimpleSAML\SAML2\XML\samlp\MessageFactory; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XMLSchema\Exception\MissingElementException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; diff --git a/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php b/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php index b6308d7e9e..d841db061f 100644 --- a/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php +++ b/tests/SAML2/XML/samlp/AbstractStatusResponseTest.php @@ -4,26 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, DomainValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\DomainValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractSamlpElement, - AbstractStatusResponse, - Extensions, - Response, - Status, - StatusCode, - StatusMessage, -}; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; +use SimpleSAML\SAML2\XML\samlp\Extensions; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\StatusMessage; use SimpleSAML\SAML2\XML\shibmd\Scope; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; +use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XMLSchema\Exception\MissingElementException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; diff --git a/tests/SAML2/XML/samlp/ArtifactResolveTest.php b/tests/SAML2/XML/samlp/ArtifactResolveTest.php index 5514ba356e..9006bb3105 100644 --- a/tests/SAML2/XML/samlp/ArtifactResolveTest.php +++ b/tests/SAML2/XML/samlp/ArtifactResolveTest.php @@ -4,20 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractRequest, - AbstractSamlpElement, - Artifact, - ArtifactResolve, -}; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractRequest; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\Artifact; +use SimpleSAML\SAML2\XML\samlp\ArtifactResolve; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{Base64BinaryValue, IDValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/ArtifactResponseTest.php b/tests/SAML2/XML/samlp/ArtifactResponseTest.php index 6239265b68..4109d10470 100644 --- a/tests/SAML2/XML/samlp/ArtifactResponseTest.php +++ b/tests/SAML2/XML/samlp/ArtifactResponseTest.php @@ -4,24 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractSamlpElement, - AbstractStatusResponse, - ArtifactResponse, - AuthnRequest, - NameIDPolicy, - Status, - StatusCode, -}; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; +use SimpleSAML\SAML2\XML\samlp\ArtifactResponse; +use SimpleSAML\SAML2\XML\samlp\AuthnRequest; +use SimpleSAML\SAML2\XML\samlp\NameIDPolicy; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, IDValue, NCNameValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/ArtifactTest.php b/tests/SAML2/XML/samlp/ArtifactTest.php index 9429ae2d30..89fff7a7b3 100644 --- a/tests/SAML2/XML/samlp/ArtifactTest.php +++ b/tests/SAML2/XML/samlp/ArtifactTest.php @@ -4,11 +4,14 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, Artifact}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\Artifact; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\Base64BinaryValue; use function dirname; diff --git a/tests/SAML2/XML/samlp/AssertionIDRequestTest.php b/tests/SAML2/XML/samlp/AssertionIDRequestTest.php index 90f4cec4e8..895a70bc70 100644 --- a/tests/SAML2/XML/samlp/AssertionIDRequestTest.php +++ b/tests/SAML2/XML/samlp/AssertionIDRequestTest.php @@ -4,14 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AssertionIDRef, Issuer}; -use SimpleSAML\SAML2\XML\samlp\{AbstractMessage, AbstractRequest, AbstractSamlpElement, AssertionIDRequest}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AssertionIDRef; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractRequest; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AssertionIDRequest; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/AttributeQueryTest.php b/tests/SAML2/XML/samlp/AttributeQueryTest.php index ed573381ec..0c7afdf96e 100644 --- a/tests/SAML2/XML/samlp/AttributeQueryTest.php +++ b/tests/SAML2/XML/samlp/AttributeQueryTest.php @@ -4,24 +4,32 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{Attribute, AttributeValue, Issuer, NameID, Subject}; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractRequest, - AbstractSamlpElement, - AbstractSubjectQuery, - AttributeQuery, -}; +use SimpleSAML\SAML2\XML\saml\Attribute; +use SimpleSAML\SAML2\XML\saml\AttributeValue; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractRequest; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AbstractSubjectQuery; +use SimpleSAML\SAML2\XML\samlp\AttributeQuery; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; diff --git a/tests/SAML2/XML/samlp/AuthnQueryTest.php b/tests/SAML2/XML/samlp/AuthnQueryTest.php index b5cf280566..a8cfc46d6c 100644 --- a/tests/SAML2/XML/samlp/AuthnQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthnQueryTest.php @@ -4,22 +4,28 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{AuthnContextComparisonTypeValue, SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{AuthnContextDeclRef, Issuer, NameID, Subject}; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractRequest, - AbstractSamlpElement, - AbstractSubjectQuery, - AuthnContextComparisonTypeEnum, - AuthnQuery, - RequestedAuthnContext, -}; +use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractRequest; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AbstractSubjectQuery; +use SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum; +use SimpleSAML\SAML2\XML\samlp\AuthnQuery; +use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; diff --git a/tests/SAML2/XML/samlp/AuthnRequestTest.php b/tests/SAML2/XML/samlp/AuthnRequestTest.php index 83b11aa560..e2121d518b 100644 --- a/tests/SAML2/XML/samlp/AuthnRequestTest.php +++ b/tests/SAML2/XML/samlp/AuthnRequestTest.php @@ -4,52 +4,53 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{ - AuthnContextComparisonTypeValue, - SAMLAnyURIValue, - SAMLDateTimeValue, - EntityIDValue, - SAMLStringValue, -}; +use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{ - Audience, - AudienceRestriction, - AuthnContextClassRef, - Conditions, - EncryptedID, - Issuer, - NameID, - OneTimeUse, - ProxyRestriction, - Subject, -}; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractSamlpElement, - AuthnContextComparisonTypeEnum, - AuthnRequest, - GetComplete, - IDPEntry, - IDPList, - NameIDPolicy, - RequestedAuthnContext, - RequesterID, - Scoping, -}; +use SimpleSAML\SAML2\XML\saml\Audience; +use SimpleSAML\SAML2\XML\saml\AudienceRestriction; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\Conditions; +use SimpleSAML\SAML2\XML\saml\EncryptedID; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\OneTimeUse; +use SimpleSAML\SAML2\XML\saml\ProxyRestriction; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum; +use SimpleSAML\SAML2\XML\samlp\AuthnRequest; +use SimpleSAML\SAML2\XML\samlp\GetComplete; +use SimpleSAML\SAML2\XML\samlp\IDPEntry; +use SimpleSAML\SAML2\XML\samlp\IDPList; +use SimpleSAML\SAML2\XML\samlp\NameIDPolicy; +use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; +use SimpleSAML\SAML2\XML\samlp\RequesterID; +use SimpleSAML\SAML2\XML\samlp\Scoping; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Exception\{MissingAttributeException, TooManyElementsException}; -use SimpleSAML\XMLSchema\Type\{BooleanValue, IDValue, NonNegativeIntegerValue, UnsignedShortValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Exception\MissingAttributeException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; +use SimpleSAML\XMLSchema\Type\BooleanValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; +use SimpleSAML\XMLSchema\Type\UnsignedShortValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; -use SimpleSAML\XMLSecurity\TestUtils\{PEMCertificatesMock, SignedElementTestTrait}; +use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; +use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php index 4afdda8f0d..c45d2e66be 100644 --- a/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php +++ b/tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php @@ -5,20 +5,27 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{Action, Assertion, Evidence, Issuer, NameID, Subject}; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractRequest, - AbstractSamlpElement, - AbstractSubjectQuery, - AuthzDecisionQuery, -}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\Action; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\Evidence; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\saml\Subject; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractRequest; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AbstractSubjectQuery; +use SimpleSAML\SAML2\XML\samlp\AuthzDecisionQuery; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; diff --git a/tests/SAML2/XML/samlp/ExtensionsTest.php b/tests/SAML2/XML/samlp/ExtensionsTest.php index e4080cc763..0cf475d6bb 100644 --- a/tests/SAML2/XML/samlp/ExtensionsTest.php +++ b/tests/SAML2/XML/samlp/ExtensionsTest.php @@ -4,13 +4,17 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\XML\saml\AttributeValue; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, Extensions}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\Extensions; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/GetCompleteTest.php b/tests/SAML2/XML/samlp/GetCompleteTest.php index ef815bea77..29a059df22 100644 --- a/tests/SAML2/XML/samlp/GetCompleteTest.php +++ b/tests/SAML2/XML/samlp/GetCompleteTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, GetComplete}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\GetComplete; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/IDPEntryTest.php b/tests/SAML2/XML/samlp/IDPEntryTest.php index 577850c1e6..f396b4c057 100644 --- a/tests/SAML2/XML/samlp/IDPEntryTest.php +++ b/tests/SAML2/XML/samlp/IDPEntryTest.php @@ -4,12 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, IDPEntry}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\IDPEntry; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/IDPListTest.php b/tests/SAML2/XML/samlp/IDPListTest.php index 6cdf420894..6ce56a9a5b 100644 --- a/tests/SAML2/XML/samlp/IDPListTest.php +++ b/tests/SAML2/XML/samlp/IDPListTest.php @@ -4,13 +4,21 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, GetComplete, IDPEntry, IDPList}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\GetComplete; +use SimpleSAML\SAML2\XML\samlp\IDPEntry; +use SimpleSAML\SAML2\XML\samlp\IDPList; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\MissingElementException; use function dirname; diff --git a/tests/SAML2/XML/samlp/LogoutRequestTest.php b/tests/SAML2/XML/samlp/LogoutRequestTest.php index 4cdc3cba11..e149668994 100644 --- a/tests/SAML2/XML/samlp/LogoutRequestTest.php +++ b/tests/SAML2/XML/samlp/LogoutRequestTest.php @@ -4,28 +4,33 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use Psr\Clock\ClockInterface; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\saml\{EncryptedID, Issuer, NameID}; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractRequest, - AbstractSamlpElement, - LogoutRequest, - SessionIndex, -}; +use SimpleSAML\SAML2\XML\saml\EncryptedID; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\saml\NameID; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractRequest; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\LogoutRequest; +use SimpleSAML\SAML2\XML\samlp\SessionIndex; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Exception\{MissingElementException, TooManyElementsException}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Exception\MissingElementException; +use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; -use SimpleSAML\XMLSecurity\TestUtils\{PEMCertificatesMock, SignedElementTestTrait}; +use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; +use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/LogoutResponseTest.php b/tests/SAML2/XML/samlp/LogoutResponseTest.php index 15caf867a4..8905e0adcd 100644 --- a/tests/SAML2/XML/samlp/LogoutResponseTest.php +++ b/tests/SAML2/XML/samlp/LogoutResponseTest.php @@ -4,22 +4,25 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Issuer; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractSamlpElement, - AbstractStatusResponse, - LogoutResponse, - Status, - StatusCode, -}; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; +use SimpleSAML\SAML2\XML\samlp\LogoutResponse; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/MessageFactoryTest.php b/tests/SAML2/XML/samlp/MessageFactoryTest.php index 73db60eab4..3c835100a9 100644 --- a/tests/SAML2/XML/samlp/MessageFactoryTest.php +++ b/tests/SAML2/XML/samlp/MessageFactoryTest.php @@ -4,19 +4,19 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, DataProvider, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\XML\saml\Attribute; -use SimpleSAML\SAML2\XML\samlp\{ - ArtifactResolve, - ArtifactResponse, - AttributeQuery, - AuthnRequest, - LogoutRequest, - LogoutResponse, - MessageFactory, - Response, -}; +use SimpleSAML\SAML2\XML\samlp\ArtifactResolve; +use SimpleSAML\SAML2\XML\samlp\ArtifactResponse; +use SimpleSAML\SAML2\XML\samlp\AttributeQuery; +use SimpleSAML\SAML2\XML\samlp\AuthnRequest; +use SimpleSAML\SAML2\XML\samlp\LogoutRequest; +use SimpleSAML\SAML2\XML\samlp\LogoutResponse; +use SimpleSAML\SAML2\XML\samlp\MessageFactory; +use SimpleSAML\SAML2\XML\samlp\Response; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; diff --git a/tests/SAML2/XML/samlp/NameIDPolicyTest.php b/tests/SAML2/XML/samlp/NameIDPolicyTest.php index b2acbc5368..5c3150c5d5 100644 --- a/tests/SAML2/XML/samlp/NameIDPolicyTest.php +++ b/tests/SAML2/XML/samlp/NameIDPolicyTest.php @@ -4,13 +4,18 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, NameIDPolicy}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\NameIDPolicy; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; diff --git a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php index 7250c63f54..c4ead4dff3 100644 --- a/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php +++ b/tests/SAML2/XML/samlp/RequestedAuthnContextTest.php @@ -4,15 +4,21 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Exception\ProtocolViolationException; -use SimpleSAML\SAML2\Type\{AuthnContextComparisonTypeValue, SAMLAnyURIValue}; -use SimpleSAML\SAML2\XML\saml\{AuthnContextClassRef, AuthnContextDeclRef}; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, AuthnContextComparisonTypeEnum, RequestedAuthnContext}; +use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; +use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AuthnContextComparisonTypeEnum; +use SimpleSAML\SAML2\XML\samlp\RequestedAuthnContext; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use function dirname; @@ -100,6 +106,7 @@ public function testMarshallingWithInvalidContentFails(): void ); new RequestedAuthnContext( + /** @phpstan-ignore argument.type */ [ DOMDocumentFactory::fromString(''), $authnContextDeclRef, diff --git a/tests/SAML2/XML/samlp/RequesterIDTest.php b/tests/SAML2/XML/samlp/RequesterIDTest.php index a06dfa098e..c3a3f442de 100644 --- a/tests/SAML2/XML/samlp/RequesterIDTest.php +++ b/tests/SAML2/XML/samlp/RequesterIDTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\EntityIDValue; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, RequesterID}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\RequesterID; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{ArrayizableElementTestTrait, SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\ArrayizableElementTestTrait; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/ResponseTest.php b/tests/SAML2/XML/samlp/ResponseTest.php index c9d771c4b7..240a74d9da 100644 --- a/tests/SAML2/XML/samlp/ResponseTest.php +++ b/tests/SAML2/XML/samlp/ResponseTest.php @@ -4,22 +4,26 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; -use SimpleSAML\SAML2\XML\saml\{Assertion, Issuer}; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractMessage, - AbstractSamlpElement, - AbstractStatusResponse, - Response, - Status, - StatusCode, -}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\Issuer; +use SimpleSAML\SAML2\XML\samlp\AbstractMessage; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\AbstractStatusResponse; +use SimpleSAML\SAML2\XML\samlp\Response; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\TestUtils\SignedElementTestTrait; use function dirname; diff --git a/tests/SAML2/XML/samlp/ScopingTest.php b/tests/SAML2/XML/samlp/ScopingTest.php index 0e0bc71d8c..4021a2180d 100644 --- a/tests/SAML2/XML/samlp/ScopingTest.php +++ b/tests/SAML2/XML/samlp/ScopingTest.php @@ -4,21 +4,23 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, EntityIDValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\EntityIDValue; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\samlp\{ - AbstractSamlpElement, - GetComplete, - IDPEntry, - IDPList, - RequesterID, - Scoping, -}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\GetComplete; +use SimpleSAML\SAML2\XML\samlp\IDPEntry; +use SimpleSAML\SAML2\XML\samlp\IDPList; +use SimpleSAML\SAML2\XML\samlp\RequesterID; +use SimpleSAML\SAML2\XML\samlp\Scoping; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\NonNegativeIntegerValue; use function dirname; diff --git a/tests/SAML2/XML/samlp/SessionIndexTest.php b/tests/SAML2/XML/samlp/SessionIndexTest.php index 88681ac709..ac68b49488 100644 --- a/tests/SAML2/XML/samlp/SessionIndexTest.php +++ b/tests/SAML2/XML/samlp/SessionIndexTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, SessionIndex}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\SessionIndex; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/StatusCodeTest.php b/tests/SAML2/XML/samlp/StatusCodeTest.php index b869fb727a..34bf3c8d4a 100644 --- a/tests/SAML2/XML/samlp/StatusCodeTest.php +++ b/tests/SAML2/XML/samlp/StatusCodeTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, StatusCode}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/StatusDetailTest.php b/tests/SAML2/XML/samlp/StatusDetailTest.php index bf711661a9..db0aa86147 100644 --- a/tests/SAML2/XML/samlp/StatusDetailTest.php +++ b/tests/SAML2/XML/samlp/StatusDetailTest.php @@ -4,12 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, StatusDetail}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\StatusDetail; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/StatusMessageTest.php b/tests/SAML2/XML/samlp/StatusMessageTest.php index 537162e39f..3cbea9b06c 100644 --- a/tests/SAML2/XML/samlp/StatusMessageTest.php +++ b/tests/SAML2/XML/samlp/StatusMessageTest.php @@ -4,12 +4,15 @@ namespace SimpleSAML\SAML2\Test\SAML2\XML\samlp; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, StatusMessage}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\StatusMessage; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/samlp/StatusTest.php b/tests/SAML2/XML/samlp/StatusTest.php index 8eb2b54025..d57a99ab6e 100644 --- a/tests/SAML2/XML/samlp/StatusTest.php +++ b/tests/SAML2/XML/samlp/StatusTest.php @@ -5,14 +5,22 @@ namespace SimpleSAML\Test\SAML2\XML\samlp; use DOMDocument; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\Utils\XPath; -use SimpleSAML\SAML2\XML\samlp\{AbstractSamlpElement, Status, StatusCode, StatusDetail, StatusMessage}; -use SimpleSAML\XML\{Chunk, DOMDocumentFactory}; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement; +use SimpleSAML\SAML2\XML\samlp\Status; +use SimpleSAML\SAML2\XML\samlp\StatusCode; +use SimpleSAML\SAML2\XML\samlp\StatusDetail; +use SimpleSAML\SAML2\XML\samlp\StatusMessage; +use SimpleSAML\XML\Chunk; +use SimpleSAML\XML\DOMDocumentFactory; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use function dirname; use function strval; diff --git a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php index 59593704a7..b927360891 100644 --- a/tests/SAML2/XML/shibmd/KeyAuthorityTest.php +++ b/tests/SAML2/XML/shibmd/KeyAuthorityTest.php @@ -4,15 +4,22 @@ namespace SimpleSAML\Test\SAML2\XML\shibmd; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\shibmd\{AbstractShibmdElement, KeyAuthority}; +use SimpleSAML\SAML2\XML\shibmd\AbstractShibmdElement; +use SimpleSAML\SAML2\XML\shibmd\KeyAuthority; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; -use SimpleSAML\XMLSchema\Type\{Base64BinaryValue, IDValue, UnsignedByteValue}; -use SimpleSAML\XMLSecurity\XML\ds\{KeyInfo, X509Certificate, X509Data}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\UnsignedByteValue; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\ds\X509Certificate; +use SimpleSAML\XMLSecurity\XML\ds\X509Data; use function dirname; use function strval; diff --git a/tests/SAML2/XML/shibmd/ScopeTest.php b/tests/SAML2/XML/shibmd/ScopeTest.php index 798218123b..e85f34a4f4 100644 --- a/tests/SAML2/XML/shibmd/ScopeTest.php +++ b/tests/SAML2/XML/shibmd/ScopeTest.php @@ -4,13 +4,16 @@ namespace SimpleSAML\Test\SAML2\XML\shibmd; -use PHPUnit\Framework\Attributes\{CoversClass, Group}; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Utils\XPath; use SimpleSAML\SAML2\Type\SAMLStringValue; -use SimpleSAML\SAML2\XML\shibmd\{AbstractShibmdElement, Scope}; +use SimpleSAML\SAML2\Utils\XPath; +use SimpleSAML\SAML2\XML\shibmd\AbstractShibmdElement; +use SimpleSAML\SAML2\XML\shibmd\Scope; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XML\TestUtils\{SchemaValidationTestTrait, SerializableElementTestTrait}; +use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; +use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\BooleanValue; use function dirname; diff --git a/tests/bin/authnrequest.php b/tests/bin/authnrequest.php index a22a07fdd7..9ed20cc059 100644 --- a/tests/bin/authnrequest.php +++ b/tests/bin/authnrequest.php @@ -7,7 +7,9 @@ use DateTimeZone; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Compat\MockContainer; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\EncryptedID; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\saml\NameID; diff --git a/tests/bin/entityattributes.php b/tests/bin/entityattributes.php index 6f098897ff..af76400794 100644 --- a/tests/bin/entityattributes.php +++ b/tests/bin/entityattributes.php @@ -6,7 +6,9 @@ use DateTimeImmutable; use DateTimeZone; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\mdattr\EntityAttributes; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Attribute; diff --git a/tests/bin/logoutrequest.php b/tests/bin/logoutrequest.php index 303ea833a0..8823ec8d3f 100644 --- a/tests/bin/logoutrequest.php +++ b/tests/bin/logoutrequest.php @@ -7,7 +7,8 @@ use DateTimeZone; use SimpleSAML\SAML2\Compat\ContainerSingleton; use SimpleSAML\SAML2\Compat\MockContainer; -use SimpleSAML\SAML2\Type\{SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\EncryptedID; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\saml\NameID; diff --git a/tests/bin/signedresponse_with_signedassertion.php b/tests/bin/signedresponse_with_signedassertion.php index 37ccbcbc78..51e5bacbac 100644 --- a/tests/bin/signedresponse_with_signedassertion.php +++ b/tests/bin/signedresponse_with_signedassertion.php @@ -3,7 +3,9 @@ require_once(dirname(__FILE__, 3) . '/vendor/autoload.php'); -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\Response; @@ -11,7 +13,8 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/bin/signedresponse_with_unsignedassertion.php b/tests/bin/signedresponse_with_unsignedassertion.php index 6972cb95dc..d183eb0396 100644 --- a/tests/bin/signedresponse_with_unsignedassertion.php +++ b/tests/bin/signedresponse_with_unsignedassertion.php @@ -3,7 +3,9 @@ require_once(dirname(__FILE__, 3) . '/vendor/autoload.php'); -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\Response; @@ -11,7 +13,8 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; diff --git a/tests/bin/unsignedresponse_with_signedassertion.php b/tests/bin/unsignedresponse_with_signedassertion.php index d5b82ac349..eacbc51c1e 100644 --- a/tests/bin/unsignedresponse_with_signedassertion.php +++ b/tests/bin/unsignedresponse_with_signedassertion.php @@ -3,7 +3,9 @@ require_once(dirname(__FILE__, 3) . '/vendor/autoload.php'); -use SimpleSAML\SAML2\Type\{SAMLAnyURIValue, SAMLDateTimeValue, SAMLStringValue}; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; +use SimpleSAML\SAML2\Type\SAMLDateTimeValue; +use SimpleSAML\SAML2\Type\SAMLStringValue; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\Issuer; use SimpleSAML\SAML2\XML\samlp\Response; @@ -11,7 +13,8 @@ use SimpleSAML\SAML2\XML\samlp\StatusCode; use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; -use SimpleSAML\XMLSchema\Type\{IDValue, NCNameValue}; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSchema\Type\NCNameValue; use SimpleSAML\XMLSecurity\Alg\Signature\SignatureAlgorithmFactory; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; From b2cf16d887ddace2006e48193ce451dca431550a Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Sat, 27 Sep 2025 15:47:48 +0200 Subject: [PATCH 14/34] Bump dependencies --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index fae3bf27fb..21c504ad74 100644 --- a/composer.json +++ b/composer.json @@ -31,9 +31,9 @@ "psr/http-message": "~2.0", "psr/log": "~2.3.1 || ~3.0.0", "simplesamlphp/assert": "~1.9.0", - "simplesamlphp/xml-common": "~2.0.2", - "simplesamlphp/xml-security": "~2.0.1", - "simplesamlphp/xml-soap": "~2.0.2" + "simplesamlphp/xml-common": "~2.0.3", + "simplesamlphp/xml-security": "~2.0.2", + "simplesamlphp/xml-soap": "~2.0.3" }, "require-dev": { "ext-intl": "*", From db83eb52d02705aa4da8f0b293a71d18794cfcf4 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Sat, 27 Sep 2025 15:57:29 +0200 Subject: [PATCH 15/34] Revert unjust const>enum convertion --- phpstan-baseline.neon | 102 ---------------------- src/XML/alg/DigestMethod.php | 4 +- src/XML/alg/SigningMethod.php | 4 +- src/XML/md/AbstractEndpointType.php | 6 +- src/XML/md/AbstractRoleDescriptorType.php | 4 +- src/XML/md/AffiliationDescriptor.php | 4 +- src/XML/md/ContactPerson.php | 4 +- src/XML/md/EntityDescriptor.php | 4 +- src/XML/md/Organization.php | 4 +- src/XML/mdui/DiscoHints.php | 4 +- src/XML/mdui/UIInfo.php | 4 +- src/XML/saml/Advice.php | 4 +- src/XML/saml/Attribute.php | 4 +- src/XML/saml/AuthnContextDecl.php | 6 +- src/XML/saml/SubjectConfirmationData.php | 6 +- src/XML/samlp/StatusDetail.php | 4 +- src/XML/shibmd/KeyAuthority.php | 4 +- tests/SAML2/CustomRoleDescriptor.php | 4 +- 18 files changed, 37 insertions(+), 139 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6930ce98fc..d5b3371b7e 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -258,24 +258,6 @@ parameters: count: 2 path: src/SOAPClient.php - - - message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/alg/DigestMethod.php - - - - message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/alg/SigningMethod.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 2 - path: src/XML/md/AbstractEndpointType.php - - message: '#^Unsafe usage of new static\(\)\.$#' identifier: new.static @@ -294,30 +276,12 @@ parameters: count: 2 path: src/XML/md/AbstractLocalizedName.php - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/md/AbstractRoleDescriptorType.php - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\XML\\md\\AbstractSignedMdElement\:\:getXsiTypeNamespaceURI\(\)\.$#' identifier: staticMethod.notFound count: 1 path: src/XML/md/AbstractSignedMdElement.php - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/md/AffiliationDescriptor.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/md/ContactPerson.php - - message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' identifier: method.notFound @@ -330,66 +294,24 @@ parameters: count: 1 path: src/XML/md/EntitiesDescriptor.php - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/md/EntityDescriptor.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/md/Organization.php - - message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' identifier: method.notFound count: 1 path: src/XML/md/Organization.php - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/mdui/DiscoHints.php - - message: '#^Call to an undefined method SimpleSAML\\XMLSchema\\Type\\Interface\\ValueTypeInterface\:\:toArray\(\)\.$#' identifier: method.notFound count: 1 path: src/XML/mdui/Keywords.php - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/mdui/UIInfo.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/saml/Advice.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/saml/Attribute.php - - message: '#^Unsafe usage of new static\(\)\.$#' identifier: new.static count: 1 path: src/XML/saml/Attribute.php - - - message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 2 - path: src/XML/saml/AuthnContextDecl.php - - message: '#^Unsafe usage of new static\(\)\.$#' identifier: new.static @@ -407,27 +329,3 @@ parameters: identifier: new.static count: 1 path: src/XML/saml/NameIDType.php - - - - message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/saml/SubjectConfirmationData.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/saml/SubjectConfirmationData.php - - - - message: '#^Access to constant Any on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/samlp/StatusDetail.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: src/XML/shibmd/KeyAuthority.php diff --git a/src/XML/alg/DigestMethod.php b/src/XML/alg/DigestMethod.php index 1b7994129f..9b49c262a5 100644 --- a/src/XML/alg/DigestMethod.php +++ b/src/XML/alg/DigestMethod.php @@ -11,7 +11,7 @@ use SimpleSAML\XML\SchemaValidatableElementInterface; use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class for handling the alg:DigestMethod element. @@ -26,7 +26,7 @@ final class DigestMethod extends AbstractAlgElement implements SchemaValidatable /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; + public const XS_ANY_ELT_NAMESPACE = NS::ANY; /** diff --git a/src/XML/alg/SigningMethod.php b/src/XML/alg/SigningMethod.php index 09cd28a230..84fa126ca0 100644 --- a/src/XML/alg/SigningMethod.php +++ b/src/XML/alg/SigningMethod.php @@ -12,7 +12,7 @@ use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\PositiveIntegerValue; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class for handling the alg:SigningMethod element. @@ -27,7 +27,7 @@ final class SigningMethod extends AbstractAlgElement implements SchemaValidatabl /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; + public const XS_ANY_ELT_NAMESPACE = NS::ANY; /** diff --git a/src/XML/md/AbstractEndpointType.php b/src/XML/md/AbstractEndpointType.php index a2975299f0..25fe5d4775 100644 --- a/src/XML/md/AbstractEndpointType.php +++ b/src/XML/md/AbstractEndpointType.php @@ -14,7 +14,7 @@ use SimpleSAML\XML\ExtendableElementTrait; use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_change_key_case; use function array_key_exists; @@ -43,10 +43,10 @@ abstract class AbstractEndpointType extends AbstractMdElement implements Arrayiz /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ELT_NAMESPACE = NS::OTHER; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index 12da032ce3..5a3b1845fe 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -14,7 +14,7 @@ use SimpleSAML\XML\ExtendableAttributesTrait; use SimpleSAML\XMLSchema\Type\DurationValue; use SimpleSAML\XMLSchema\Type\IDValue; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function strval; @@ -29,7 +29,7 @@ abstract class AbstractRoleDescriptorType extends AbstractMetadataDocument /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/md/AffiliationDescriptor.php b/src/XML/md/AffiliationDescriptor.php index 318b063650..9ab7f5eb12 100644 --- a/src/XML/md/AffiliationDescriptor.php +++ b/src/XML/md/AffiliationDescriptor.php @@ -16,7 +16,7 @@ use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\DurationValue; use SimpleSAML\XMLSchema\Type\IDValue; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use SimpleSAML\XMLSecurity\XML\ds\Signature; /** @@ -31,7 +31,7 @@ final class AffiliationDescriptor extends AbstractMetadataDocument implements Sc /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/md/ContactPerson.php b/src/XML/md/ContactPerson.php index 7854831074..94abc5ba45 100644 --- a/src/XML/md/ContactPerson.php +++ b/src/XML/md/ContactPerson.php @@ -17,7 +17,7 @@ use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_change_key_case; use function array_filter; @@ -42,7 +42,7 @@ final class ContactPerson extends AbstractMdElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** * The several different contact types as defined per specification diff --git a/src/XML/md/EntityDescriptor.php b/src/XML/md/EntityDescriptor.php index 837e65fdda..5f9a982c18 100644 --- a/src/XML/md/EntityDescriptor.php +++ b/src/XML/md/EntityDescriptor.php @@ -17,7 +17,7 @@ use SimpleSAML\XMLSchema\Exception\TooManyElementsException; use SimpleSAML\XMLSchema\Type\DurationValue; use SimpleSAML\XMLSchema\Type\IDValue; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use SimpleSAML\XMLSecurity\XML\ds\Signature; use function is_null; @@ -34,7 +34,7 @@ final class EntityDescriptor extends AbstractMetadataDocument implements SchemaV /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/md/Organization.php b/src/XML/md/Organization.php index 4791049e6d..a72195e953 100644 --- a/src/XML/md/Organization.php +++ b/src/XML/md/Organization.php @@ -18,7 +18,7 @@ use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Exception\MissingElementException; use SimpleSAML\XMLSchema\Exception\TooManyElementsException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_change_key_case; use function array_filter; @@ -41,7 +41,7 @@ final class Organization extends AbstractMdElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/mdui/DiscoHints.php b/src/XML/mdui/DiscoHints.php index 60cfbd5d6f..f644bc8b19 100644 --- a/src/XML/mdui/DiscoHints.php +++ b/src/XML/mdui/DiscoHints.php @@ -18,7 +18,7 @@ use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_filter; use function array_key_exists; @@ -39,7 +39,7 @@ final class DiscoHints extends AbstractMduiElement implements /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ELT_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/mdui/UIInfo.php b/src/XML/mdui/UIInfo.php index 95c0624b65..0f2e7002f6 100644 --- a/src/XML/mdui/UIInfo.php +++ b/src/XML/mdui/UIInfo.php @@ -16,7 +16,7 @@ use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XML\SerializableElementInterface; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function array_filter; use function array_key_exists; @@ -40,7 +40,7 @@ final class UIInfo extends AbstractMduiElement implements /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ELT_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/saml/Advice.php b/src/XML/saml/Advice.php index f125ecb3f2..192176337d 100644 --- a/src/XML/saml/Advice.php +++ b/src/XML/saml/Advice.php @@ -12,7 +12,7 @@ use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing a saml:Advice element. @@ -26,7 +26,7 @@ final class Advice extends AbstractSamlElement implements SchemaValidatableEleme /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ELT_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/saml/Attribute.php b/src/XML/saml/Attribute.php index e94674ea8c..a0900bc7d6 100644 --- a/src/XML/saml/Attribute.php +++ b/src/XML/saml/Attribute.php @@ -14,7 +14,7 @@ use SimpleSAML\XML\SchemaValidatableElementInterface; use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use SimpleSAML\XMLSecurity\Backend\EncryptionBackend; use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface; @@ -35,7 +35,7 @@ class Attribute extends AbstractSamlElement implements /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/saml/AuthnContextDecl.php b/src/XML/saml/AuthnContextDecl.php index 12ccd0a5b5..5dc0a1654f 100644 --- a/src/XML/saml/AuthnContextDecl.php +++ b/src/XML/saml/AuthnContextDecl.php @@ -11,7 +11,7 @@ use SimpleSAML\XML\SchemaValidatableElementInterface; use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Class representing SAML2 AuthnContextDecl @@ -26,10 +26,10 @@ final class AuthnContextDecl extends AbstractSamlElement implements SchemaValida /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; + public const XS_ANY_ELT_NAMESPACE = NS::ANY; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Any; + public const XS_ANY_ATTR_NAMESPACE = NS::ANY; /** diff --git a/src/XML/saml/SubjectConfirmationData.php b/src/XML/saml/SubjectConfirmationData.php index 9de3506757..591aef707e 100644 --- a/src/XML/saml/SubjectConfirmationData.php +++ b/src/XML/saml/SubjectConfirmationData.php @@ -17,7 +17,7 @@ use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\NCNameValue; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use function strval; @@ -34,10 +34,10 @@ final class SubjectConfirmationData extends AbstractSamlElement implements Schem /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; + public const XS_ANY_ELT_NAMESPACE = NS::ANY; /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/src/XML/samlp/StatusDetail.php b/src/XML/samlp/StatusDetail.php index d765f8b453..fc88ac2089 100644 --- a/src/XML/samlp/StatusDetail.php +++ b/src/XML/samlp/StatusDetail.php @@ -10,7 +10,7 @@ use SimpleSAML\XML\SchemaValidatableElementInterface; use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * SAML StatusDetail data type. @@ -24,7 +24,7 @@ final class StatusDetail extends AbstractSamlpElement implements SchemaValidatab /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Any; + public const XS_ANY_ELT_NAMESPACE = NS::ANY; /** diff --git a/src/XML/shibmd/KeyAuthority.php b/src/XML/shibmd/KeyAuthority.php index 19ca74fa0f..fd39bfb52e 100644 --- a/src/XML/shibmd/KeyAuthority.php +++ b/src/XML/shibmd/KeyAuthority.php @@ -12,7 +12,7 @@ use SimpleSAML\XML\SchemaValidatableElementTrait; use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; use SimpleSAML\XMLSchema\Type\UnsignedByteValue; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; use function strval; @@ -30,7 +30,7 @@ final class KeyAuthority extends AbstractShibmdElement implements SchemaValidata /** The namespace-attribute for the xs:anyAttribute element */ - public const XS_ANY_ATTR_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ATTR_NAMESPACE = NS::OTHER; /** diff --git a/tests/SAML2/CustomRoleDescriptor.php b/tests/SAML2/CustomRoleDescriptor.php index 46bae11f7f..0acd92d2f0 100644 --- a/tests/SAML2/CustomRoleDescriptor.php +++ b/tests/SAML2/CustomRoleDescriptor.php @@ -25,7 +25,7 @@ use SimpleSAML\XMLSchema\Type\DurationValue; use SimpleSAML\XMLSchema\Type\IDValue; use SimpleSAML\XMLSchema\Type\QNameValue; -use SimpleSAML\XMLSchema\XML\Enumeration\NamespaceEnum; +use SimpleSAML\XMLSchema\XML\Constants\NS; /** * Example class to demonstrate how RoleDescriptor can be extended. @@ -47,7 +47,7 @@ final class CustomRoleDescriptor extends AbstractRoleDescriptor protected const XSI_TYPE_PREFIX = 'ssp'; /** The namespace-attribute for the xs:any element */ - public const XS_ANY_ELT_NAMESPACE = NamespaceEnum::Other; + public const XS_ANY_ELT_NAMESPACE = NS::OTHER; /** From 469be42f088b7a3f2b2931a71f22fbd6782a92a2 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 29 Sep 2025 21:17:01 +0200 Subject: [PATCH 16/34] Remove problematic assertion; this should be handled by the idp/sp and not by the XML-library --- src/XML/md/AbstractRoleDescriptorType.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/XML/md/AbstractRoleDescriptorType.php b/src/XML/md/AbstractRoleDescriptorType.php index 5a3b1845fe..a72b87dcaf 100644 --- a/src/XML/md/AbstractRoleDescriptorType.php +++ b/src/XML/md/AbstractRoleDescriptorType.php @@ -7,7 +7,6 @@ use DOMElement; use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; -use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\AnyURIListValue; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLDateTimeValue; @@ -65,18 +64,6 @@ public function __construct( protected array $contact = [], array $namespacedAttributes = [], ) { - /** - * A whitespace-delimited set of URIs that identify the set of protocol specifications supported by the - * role element. For SAML V2.0 entities, this set MUST include the SAML protocol namespace URI, - * urn:oasis:names:tc:SAML:2.0:protocol. - */ - Assert::contains( - strval($protocolSupportEnumeration), - C::NS_SAMLP, - 'SAML v2.0 entities MUST include the SAML protocol namespace URI in their' - . ' protocolSupportEnumeration attribute', - ProtocolViolationException::class, - ); Assert::maxCount($contact, C::UNBOUNDED_LIMIT); Assert::allIsInstanceOf( $contact, From 063d6a628bb310bf5a6d4310088ccb2797b314e3 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 29 Sep 2025 22:04:09 +0200 Subject: [PATCH 17/34] trim CIDR-values before validating them & increase coverage --- src/Type/CIDRValue.php | 13 ++++++ tests/SAML2/Type/CIDRValueTest.php | 65 ++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 tests/SAML2/Type/CIDRValueTest.php diff --git a/src/Type/CIDRValue.php b/src/Type/CIDRValue.php index 1e726b03bc..687462ce7d 100644 --- a/src/Type/CIDRValue.php +++ b/src/Type/CIDRValue.php @@ -11,6 +11,19 @@ */ class CIDRValue extends SAMLStringValue { + /** + * Sanitize the content of the element. + * + * @param string $value The unsanitized value + * @throws \Exception on failure + * @return string + */ + protected function sanitizeValue(string $value): string + { + return static::collapseWhitespace(static::normalizeWhitespace($value)); + } + + /** * Validate the content of the element. * diff --git a/tests/SAML2/Type/CIDRValueTest.php b/tests/SAML2/Type/CIDRValueTest.php new file mode 100644 index 0000000000..5e9466745c --- /dev/null +++ b/tests/SAML2/Type/CIDRValueTest.php @@ -0,0 +1,65 @@ +assertTrue($shouldPass); + } catch (AssertionFailedException | ProtocolViolationException | SchemaViolationException $e) { + $this->assertFalse($shouldPass); + } + } + + + /** + * @return array + */ + public static function provideCIDR(): array + { + return [ + 'ipv4' => [true, '192.168.0.1/32'], + 'ipv6' => [true, '2001:0000:130F:0000:0000:09C0:876A:130B/128'], + 'ipv4 too long' => [false, '192.168.0.1.5/32'], + 'whitespace suffix' => [true, '192.168.1.5/32 '], + 'whitespace prefix' => [true, ' 192.168.1.5/32'], + 'whitespace center' => [false, '192.168. 1.5/32'], + 'ipv6 too long' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B:130F:805B/128'], + 'ipv6 mixed notation' => [false, '805B:2D9D:DC28::FC57:212.200.31.255'], + 'ipv6 shortened notation' => [false, '::ffff:192.1.56.10/96'], + 'ipv6 compressed notation' => [false, '::212.200.31.255'], + 'ipv4 without length' => [false, '192.168.0.1'], + 'ipv6 wihtout length' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B'], + 'ipv4 out of bounds length' => [false, '192.168.0.1/33'], + 'ipv6 out of bounds length' => [false, '2001:0000:130F:0000:0000:09C0:876A:130B/129'], + 'ipv4 out of bounds address' => [false, '256.168.0.1/32'], + 'ipv6 out of bounds address' => [false, '2001:0000:130G:0000:0000:09C0:876A:130B/128'], + ]; + } +} From 18a7ed0b0874c1995957e8c1c1bccceeaf391cd5 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Mon, 29 Sep 2025 23:53:28 +0200 Subject: [PATCH 18/34] Fix rebase --- phpstan-baseline-dev.neon | 4678 +------------------------------------ 1 file changed, 14 insertions(+), 4664 deletions(-) diff --git a/phpstan-baseline-dev.neon b/phpstan-baseline-dev.neon index 903d22304c..6b92118ee0 100644 --- a/phpstan-baseline-dev.neon +++ b/phpstan-baseline-dev.neon @@ -1,64 +1,10 @@ parameters: ignoreErrors: - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assert/EntityIDTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assert/SAMLAnyURITest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assert/SAMLDateTimeTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assert/SAMLStringTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor + message: '#^Dead catch \- SimpleSAML\\Assert\\AssertionFailedException is never thrown in the try block\.$#' + identifier: catch.neverThrown count: 1 - path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php + path: tests/InterOperability/EntityDescriptorTest.php - message: '#^PHPDoc tag @var for property SimpleSAML\\Test\\SAML2\\Assertion\\Transformer\\NameIdDecryptionTransformerTest\:\:\$validator with type SimpleSAML\\SAML2\\Response\\Validation\\Validator is incompatible with native type SimpleSAML\\SAML2\\Signature\\Validator\.$#' @@ -72,24 +18,6 @@ parameters: count: 2 path: tests/SAML2/Assertion/Transformer/NameIdDecryptionTransformerTest.php - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php - - message: '#^PHPDoc tag @var for property SimpleSAML\\Test\\SAML2\\Assertion\\Validation\\AssertionValidatorTest\:\:\$validator with type SimpleSAML\\SAML2\\Response\\Validation\\Validator is incompatible with native type SimpleSAML\\SAML2\\Signature\\Validator\.$#' identifier: property.phpDocType @@ -108,324 +36,24 @@ parameters: count: 1 path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 7 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotBeforeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 7 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/NotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 9 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SessionNotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php - - message: '#^Parameter \#1 \$serviceProvider of method SimpleSAML\\SAML2\\Assertion\\Validation\\ConstraintValidator\\SpIsValidAudience\:\:setServiceProvider\(\) expects SimpleSAML\\SAML2\\Configuration\\ServiceProvider, Mockery\\MockInterface given\.$#' identifier: argument.type count: 3 path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationMethodTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotBeforeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationNotOnOrAfterTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationRecipientMatchesTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php - - message: '#^Parameter \#1 \$response of class SimpleSAML\\SAML2\\Assertion\\Validation\\ConstraintValidator\\SubjectConfirmationResponseToMatches constructor expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' identifier: argument.type count: 5 path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php - - - message: '#^Access to constant NS_XS on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php - - message: '#^PHPDoc tag @var for property SimpleSAML\\Test\\SAML2\\XML\\saml\\SubjectConfirmationValidatorTest\:\:\$validator with type SimpleSAML\\SAML2\\Response\\Validation\\Validator is incompatible with native type SimpleSAML\\SAML2\\Signature\\Validator\.$#' identifier: property.phpDocType count: 1 path: tests/SAML2/Assertion/Validation/SubjectConfirmationValidatorTest.php - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/Binding/HTTPPostTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Binding/HTTPPostTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/Binding/HTTPPostTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Binding/HTTPPostTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/Binding/HTTPPostTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/Binding/HTTPRedirectTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/Binding/HTTPRedirectTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/Binding/HTTPRedirectTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Binding/HTTPRedirectTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/Binding/HTTPRedirectTest.php - - - - message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/Binding/SOAPTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/Binding/SOAPTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\Artifact\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/Binding/SOAPTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Binding/SOAPTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\SOAP11\\Type\\MustUnderstandValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Binding/SOAPTest.php - - message: '#^Parameter \#1 \$element of method SimpleSAML\\SAML2\\Certificate\\KeyCollection\:\:add\(\) expects SimpleSAML\\SAML2\\Certificate\\Key, string given\.$#' identifier: argument.type @@ -445,4309 +73,31 @@ parameters: path: tests/SAML2/Certificate/KeyLoaderTest.php - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/CustomBaseID.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomBaseID.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/CustomBaseID.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomBaseID.php - - - - message: '#^Parameter \#2 \$NameQualifier of class SimpleSAML\\Test\\SAML2\\CustomBaseID constructor expects SimpleSAML\\SAML2\\Type\\SAMLStringValue\|null, string given\.$#' + message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\DestinationMatches\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' identifier: argument.type - count: 1 - path: tests/SAML2/CustomBaseID.php + count: 2 + path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php - - message: '#^Parameter \#3 \$SPNameQualifier of class SimpleSAML\\Test\\SAML2\\CustomBaseID constructor expects SimpleSAML\\SAML2\\Type\\SAMLStringValue\|null, string given\.$#' + message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\IsSuccessful\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' identifier: argument.type - count: 1 - path: tests/SAML2/CustomBaseID.php - - - - message: '#^Static method SimpleSAML\\XML\\AbstractElement\:\:getOptionalAttribute\(\) invoked with 4 parameters, 2\-3 required\.$#' - identifier: arguments.count count: 2 - path: tests/SAML2/CustomBaseID.php + path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound + message: '#^Parameter \#1 \$xml of static method SimpleSAML\\SAML2\\XML\\saml\\Assertion\:\:fromXML\(\) expects DOMElement, DOMNode\|null given\.$#' + identifier: argument.type count: 2 - path: tests/SAML2/CustomCondition.php + path: tests/SAML2/Response/XmlSignatureWrappingTest.php - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' + message: '#^Class SimpleSAML\\Test\\SAML2\\XML\\md\\AssertionFailedException not found\.$#' identifier: class.notFound count: 1 - path: tests/SAML2/CustomCondition.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/CustomCondition.php - - - - message: '#^PHPDoc tag @throws with type SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException is not subtype of Throwable$#' - identifier: throws.notThrowable - count: 1 - path: tests/SAML2/CustomCondition.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Access to constant Other on an unknown class SimpleSAML\\XMLSchema\\XML\\Enumeration\\NamespaceEnum\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Call to method getNamespacePrefix\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Call to method getNamespaceURI\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Type\\DurationValue not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Type\\IDValue not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^PHPDoc tag @throws with type SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException is not subtype of Throwable$#' - identifier: throws.notThrowable - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \#2 \$protocolSupportEnumeration of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\SAML2\\Type\\AnyURIListValue, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \#3 \$ID of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XMLSchema\\Type\\IDValue\|null, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \#4 \$attrValue of class SimpleSAML\\XML\\Attribute constructor expects string, SimpleSAML\\XMLSchema\\Type\\QNameValue given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \#4 \$validUntil of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\|null, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \#5 \$cacheDuration of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\XMLSchema\\Type\\DurationValue\|null, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \#7 \$errorURL of class SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor constructor expects SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\|null, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \$ID of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Parameter \$cacheDuration of method SimpleSAML\\Test\\SAML2\\CustomRoleDescriptor\:\:__construct\(\) has invalid type SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Static method SimpleSAML\\XML\\AbstractElement\:\:getOptionalAttribute\(\) invoked with 4 parameters, 2\-3 required\.$#' - identifier: arguments.count - count: 4 - path: tests/SAML2/CustomRoleDescriptor.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/CustomStatement.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/CustomStatement.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/CustomStatement.php - - - - message: '#^PHPDoc tag @throws with type SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException is not subtype of Throwable$#' - identifier: throws.notThrowable - count: 1 - path: tests/SAML2/CustomStatement.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php - - - - message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\DestinationMatches\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php - - - - message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\IsSuccessful\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php - - - - message: '#^Parameter \#1 \$xml of static method SimpleSAML\\SAML2\\XML\\saml\\Assertion\:\:fromXML\(\) expects DOMElement, DOMNode\|null given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/Response/XmlSignatureWrappingTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Signature/ValidatorChainTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Signature/ValidatorChainTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Signature/ValidatorChainTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Type/AnyURIListValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/AnyURIListValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AuthnContextComparisonTypeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/AuthnContextComparisonTypeValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DecisionTypeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Type/DecisionTypeValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/DecisionTypeValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Type/EntityIDValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/EntityIDValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/Type/ListOfStringsValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/ListOfStringsValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Type/SAMLAnyURIValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/SAMLAnyURIValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Type/SAMLDateTimeValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/SAMLDateTimeValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/Type/SAMLStringValueTest.php - - - - message: '#^Caught class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/Type/SAMLStringValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/UtilsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/UtilsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/UtilsTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/UtilsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/alg/DigestMethodTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/alg/DigestMethodTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/alg/DigestMethodTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/alg/SigningMethodTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/alg/SigningMethodTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/alg/SigningMethodTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/alg/SigningMethodTest.php - - - - message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/ecp/RelayStateTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/ecp/RelayStateTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\ecp\\RelayState does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/ecp/RelayStateTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/ecp/RelayStateTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/ecp/RelayStateTest.php - - - - message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\SOAP11\\Type\\MustUnderstandValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/ecp/RequestAuthenticatedTest.php - - - - message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 7 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/ecp/RequestTest.php - - - - message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/ecp/ResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/ecp/ResponseTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/ecp/ResponseTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 3 - path: tests/SAML2/XML/ecp/ResponseTest.php - - - - message: '#^Access to constant NS_SOAP_ENV on an unknown class SimpleSAML\\SOAP11\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 3 - path: tests/SAML2/XML/ecp/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/emd/RepublishRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/emd/RepublishTargetTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/init/RequestInitiatorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/init/RequestInitiatorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AbstractLocalizedNameTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AbstractLocalizedNameTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/md/AbstractLocalizedNameTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/AdditionalMetadataLocationTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AdditionalMetadataLocationTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/AdditionalMetadataLocationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/AffiliateMemberTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AffiliateMember does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/AffiliateMemberTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AffiliateMember does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/AffiliationDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/ArtifactResolutionServiceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AssertionConsumerServiceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 11 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AttributeProfile does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 3 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 8 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 5 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 5 - path: tests/SAML2/XML/md/AttributeConsumingServiceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/AttributeProfileTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AttributeProfile does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/AttributeProfileTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 12 - path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 8 - path: tests/SAML2/XML/md/AuthnAuthorityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/CompanyTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\Company does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/CompanyTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 6 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\Company does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\GivenName does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\SurName does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\TelephoneNumber does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/ContactPersonTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/EmailAddressTest.php - - - - message: '#^Cannot call abstract static method SimpleSAML\\XML\\SerializableElementInterface\:\:fromXML\(\)\.$#' - identifier: staticMethod.callToAbstract - count: 2 - path: tests/SAML2/XML/md/EmailAddressTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/EmailAddressTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/md/EncryptionMethodTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSecurity\\Type\\KeySizeValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EncryptionMethodTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EncryptionMethodTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EncryptionMethodTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/EncryptionMethodTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/EndpointTypeTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EndpointTypeTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EndpointTypeTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EndpointTypeTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 3 - path: tests/SAML2/XML/md/EndpointTypeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/EntitiesDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/EntitiesDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/EntitiesDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EntitiesDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EntitiesDescriptorTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 6 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 6 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 20 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 12 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 8 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AffiliateMember does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 6 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 3 - path: tests/SAML2/XML/md/EntityDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/ExtensionsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/ExtensionsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/ExtensionsTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/ExtensionsTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/ExtensionsTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/ExtensionsTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/ExtensionsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/GivenNameTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\GivenName does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/GivenNameTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 34 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\AttributeProfile does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 3 - path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/md/IndexedEndpointTypeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/KeyDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/KeyDescriptorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/KeyDescriptorTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/KeyDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/NameIDFormatTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/NameIDFormatTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/NameIDMappingServiceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationDisplayNameTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationDisplayNameTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationNameTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationNameTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/OrganizationTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/md/OrganizationTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationURLTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/OrganizationURLTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/md/PDPDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 7 - path: tests/SAML2/XML/md/PDPDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/PDPDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 3 - path: tests/SAML2/XML/md/PDPDescriptorTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/md/RequestedAttributeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/RequestedAttributeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/md/RequestedAttributeTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/RequestedAttributeTest.php - - - - message: '#^Class SimpleSAML\\Test\\SAML2\\XML\\md\\AssertionFailedException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/RequestedAttributeTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/RequestedAttributeTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 9 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\AnyURIValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\Company does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\GivenName does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\SurName does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\TelephoneNumber does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/RoleDescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\AnyURIListValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EmailAddressValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 20 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 8 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\DurationValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\EmailAddress does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\NameIDFormat does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/md/SPSSODescriptorTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/ServiceDescriptionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/ServiceDescriptionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/ServiceNameTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/ServiceNameTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/md/ServiceNameTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/md/ServiceNameTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/md/SingleSignOnServiceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/SurNameTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\SurName does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/SurNameTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/md/TelephoneNumberTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\md\\TelephoneNumber does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/md/TelephoneNumberTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:FromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdattr/EntityAttributesTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 8 - path: tests/SAML2/XML/mdattr/EntityAttributesTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdattr/EntityAttributesTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 8 - path: tests/SAML2/XML/mdattr/EntityAttributesTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdattr/EntityAttributesTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/mdattr/EntityAttributesTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/mdrpi/PublicationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/mdrpi/PublicationPathTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/mdrpi/PublicationPathTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/PublicationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/mdrpi/PublicationTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/PublicationTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/mdrpi/PublicationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/mdrpi/RegistrationInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/RegistrationPolicyTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/UsagePolicyTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdrpi/UsagePolicyTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/DescriptionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdui/DescriptionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\mdui\\GeolocationHint\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\GeolocationValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\DomainHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\GeolocationHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/mdui/DiscoHintsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/DisplayNameTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdui/DisplayNameTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/DomainHintTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\DomainHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/mdui/DomainHintTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\GeolocationValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/GeolocationHintTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\GeolocationHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/mdui/GeolocationHintTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/IPHintTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/mdui/IPHintTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/InformationURLTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdui/InformationURLTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/KeywordsTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/mdui/KeywordsTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\mdui\\Logo\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 3 - path: tests/SAML2/XML/mdui/LogoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/LogoTest.php - - - - message: '#^Call to method toInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/XML/mdui/LogoTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/mdui/LogoTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdui/LogoTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/mdui/LogoTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/mdui/LogoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/mdui/PrivacyStatementURLTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/mdui/PrivacyStatementURLTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\CIDRValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/mdui/UIInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\ListOfStringsValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/mdui/UIInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 7 - path: tests/SAML2/XML/mdui/UIInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/mdui/UIInfoTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\PositiveIntegerValue\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/XML/mdui/UIInfoTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\LanguageValue\.$#' - identifier: class.notFound - count: 16 - path: tests/SAML2/XML/mdui/UIInfoTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\mdui\\IPHint does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/mdui/UIInfoTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/ActionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/ActionTest.php - - - - message: '#^Cannot call abstract static method SimpleSAML\\XML\\SerializableElementInterface\:\:fromXML\(\)\.$#' - identifier: staticMethod.callToAbstract - count: 2 - path: tests/SAML2/XML/saml/AdviceTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionIDRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AssertionIDRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AssertionIDRefTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\DomainValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 4 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 5 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 4 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAssertion\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 6 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 18 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 10 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 22 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Cannot call method getValue\(\) on string\.$#' - identifier: method.nonObject - count: 4 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 7 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 4 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/saml/AssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AssertionURIRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AssertionURIRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AssertionURIRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/saml/AttributeStatementTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAttribute\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AttributeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AttributeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AttributeTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/saml/AttributeTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AttributeTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/saml/AttributeTest.php - - - - message: '#^Access to constant NS_XS on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/saml/AttributeValueTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/saml/AttributeValueTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/AttributeValueTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AudienceRestrictionTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/saml/AudienceRestrictionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AudienceTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AudienceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthenticatingAuthorityTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextClassRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextClassRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextDeclRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextDeclRefTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextDeclTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AuthnContextTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/saml/AuthnContextTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 3 - path: tests/SAML2/XML/saml/AuthnContextTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefAndDeclTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithClassRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithDeclRefTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/AuthnContextWithDeclTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthenticatingAuthority does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 4 - path: tests/SAML2/XML/saml/AuthnStatementTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/saml/AuthzDecisionStatementTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/AuthzDecisionStatementTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/BaseIDTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/BaseIDTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/BaseIDTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/BaseIDTest.php - - - - message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/BaseIDTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/BaseIDTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/ConditionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/ConditionTest.php - - - - message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/ConditionTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/ConditionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/ConditionsTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/ConditionsTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/ConditionsTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/saml/ConditionsTest.php - - - - message: '#^Access to constant XPATH10_URI on an unknown class SimpleSAML\\XPath\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAssertion\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\AnyURIValue\.$#' - identifier: class.notFound - count: 5 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAssertionTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedAttribute\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAttributeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedAttributeTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 3 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\AnyURIValue\.$#' - identifier: class.notFound - count: 10 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/EncryptedIDTest.php - - - - message: '#^Cannot call abstract static method SimpleSAML\\XML\\SerializableElementInterface\:\:fromXML\(\)\.$#' - identifier: staticMethod.callToAbstract - count: 2 - path: tests/SAML2/XML/saml/EvidenceTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/IssuerTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 12 - path: tests/SAML2/XML/saml/IssuerTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/NameIDTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/saml/NameIDTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/ProxyRestrictionTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/ProxyRestrictionTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/saml/ProxyRestrictionTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/StatementTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Audience\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/StatementTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/StatementTest.php - - - - message: '#^Call to method getRawValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\QNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/StatementTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/StatementTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 6 - path: tests/SAML2/XML/saml/SubjectConfirmationDataTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 4 - path: tests/SAML2/XML/saml/SubjectConfirmationTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectLocalityTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectLocalityTest.php - - - - message: '#^Access to constant NS_XSI on an unknown class SimpleSAML\\XMLSchema\\Constants\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 8 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 6 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 15 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\StringValue\.$#' - identifier: class.notFound - count: 9 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 3 - path: tests/SAML2/XML/saml/SubjectTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 5 - path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/samlp/AbstractMessageTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\DomainValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/samlp/AbstractStatusResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/ArtifactResolveTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/ArtifactResolveTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/ArtifactResolveTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/ArtifactResolveTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\Artifact does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/ArtifactResolveTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/ArtifactResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/ArtifactTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\Artifact does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/ArtifactTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AssertionIDRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/AssertionIDRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 10 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 5 - path: tests/SAML2/XML/samlp/AttributeQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/samlp/AuthnQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/samlp/AuthnQueryTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnQueryTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/AuthnQueryTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 3 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 12 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromstring\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 8 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedShortValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 4 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\RequesterID does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingAttributeException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 3 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 4 - path: tests/SAML2/XML/samlp/AuthnRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/AuthzDecisionQueryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/GetCompleteTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/GetCompleteTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/samlp/IDPEntryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/IDPEntryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/IDPEntryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/IDPEntryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/samlp/IDPListTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 7 - path: tests/SAML2/XML/samlp/IDPListTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 5 - path: tests/SAML2/XML/samlp/IDPListTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/IDPListTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/IDPListTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 1 - path: tests/SAML2/XML/samlp/IDPListTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:getValue\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\EncryptedID\:\:getEncryptedKeys\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\Issuer\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\saml\\NameID\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 4 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 9 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 13 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 7 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 6 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\MissingElementException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\TooManyElementsException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/samlp/LogoutRequestTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/LogoutResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/LogoutResponseTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\InvalidDOMElementException not found\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/MessageFactoryTest.php - - - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type - count: 2 - path: tests/SAML2/XML/samlp/MessageFactoryTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/NameIDPolicyTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/NameIDPolicyTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/NameIDPolicyTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextClassRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\AuthnContextDeclRef does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 3 - path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php - - - - message: '#^Class SimpleSAML\\XMLSchema\\Exception\\SchemaViolationException not found\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php + path: tests/SAML2/XML/md/RequestedAttributeTest.php - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' identifier: argument.type count: 1 - path: tests/SAML2/XML/samlp/RequestedAuthnContextTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/RequesterIDTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\RequesterID does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/RequesterIDTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/SAML2/XML/samlp/ResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/ResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/ResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/ResponseTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/samlp/ResponseTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\EntityIDValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 6 - path: tests/SAML2/XML/samlp/ScopingTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/ScopingTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/ScopingTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NonNegativeIntegerValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/samlp/ScopingTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\GetComplete does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/ScopingTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\RequesterID does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/ScopingTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/SessionIndexTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/SessionIndexTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/StatusCodeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/samlp/StatusMessageTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 1 - path: tests/SAML2/XML/samlp/StatusMessageTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/SAML2/XML/samlp/StatusTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/samlp/StatusTest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\StatusMessage does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/SAML2/XML/samlp/StatusTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php - - - - message: '#^Call to static method fromInteger\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\UnsignedByteValue\.$#' - identifier: class.notFound - count: 1 - path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\Base64BinaryValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/shibmd/KeyAuthorityTest.php - - - - message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\shibmd\\Scope\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 2 - path: tests/SAML2/XML/shibmd/ScopeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/SAML2/XML/shibmd/ScopeTest.php - - - - message: '#^Call to method toBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/shibmd/ScopeTest.php - - - - message: '#^Call to static method fromBoolean\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\BooleanValue\.$#' - identifier: class.notFound - count: 2 - path: tests/SAML2/XML/shibmd/ScopeTest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/authnrequest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/authnrequest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/bin/authnrequest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/authnrequest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 2 - path: tests/bin/encryptedattribute.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/encryptedid.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 9 - path: tests/bin/entityattributes.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/entityattributes.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 21 - path: tests/bin/entityattributes.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/entityattributes.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\saml\\Audience does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/bin/entityattributes.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/logoutrequest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 4 - path: tests/bin/logoutrequest.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XML\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/logoutrequest.php - - - - message: '#^Class SimpleSAML\\SAML2\\XML\\samlp\\SessionIndex does not have a constructor and must be instantiated without any parameters\.$#' - identifier: new.noConstructor - count: 2 - path: tests/bin/logoutrequest.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/bin/signedresponse_with_signedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/signedresponse_with_signedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/signedresponse_with_signedassertion.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/signedresponse_with_signedassertion.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/signedresponse_with_signedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/bin/signedresponse_with_unsignedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/signedresponse_with_unsignedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/signedresponse_with_unsignedassertion.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/signedresponse_with_unsignedassertion.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/signedresponse_with_unsignedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLAnyURIValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 3 - path: tests/bin/unsignedresponse_with_signedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLDateTimeValue\:\:fromDateTime\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/unsignedresponse_with_signedassertion.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\Type\\SAMLStringValue\:\:fromString\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: tests/bin/unsignedresponse_with_signedassertion.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\IDValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/unsignedresponse_with_signedassertion.php - - - - message: '#^Call to static method fromString\(\) on an unknown class SimpleSAML\\XMLSchema\\Type\\NCNameValue\.$#' - identifier: class.notFound - count: 1 - path: tests/bin/unsignedresponse_with_signedassertion.php + path: tests/SAML2/XML/md/RequestedAttributeTest.php From a225715734d0b7b94b9ef17d13bf6d3a3ef049cc Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 2 Oct 2025 21:02:31 +0200 Subject: [PATCH 19/34] Fix codesniffer issues --- phpstan-dev.neon | 4 ++-- phpstan.neon | 4 ++-- src/Binding/HTTPRedirect.php | 2 +- src/XML/EncryptedElementTrait.php | 2 +- src/XML/mdui/Keywords.php | 6 ++++-- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/phpstan-dev.neon b/phpstan-dev.neon index c839b6e78b..378f1ae63a 100644 --- a/phpstan-dev.neon +++ b/phpstan-dev.neon @@ -2,5 +2,5 @@ parameters: level: 5 paths: - tests -includes: - - phpstan-baseline-dev.neon +#includes: +# - phpstan-baseline-dev.neon diff --git a/phpstan.neon b/phpstan.neon index de03d2c724..e15be8aaf8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,5 +2,5 @@ parameters: level: 2 paths: - src -includes: - - phpstan-baseline.neon +#includes: +# - phpstan-baseline.neon diff --git a/src/Binding/HTTPRedirect.php b/src/Binding/HTTPRedirect.php index cb07d4483d..998315784e 100644 --- a/src/Binding/HTTPRedirect.php +++ b/src/Binding/HTTPRedirect.php @@ -90,7 +90,7 @@ public function getRedirectURL(AbstractMessage $message): string $signatureValue = $signature->getSignatureValue(); $msg .= '&SigAlg=' . urlencode($signatureMethod->getAlgorithm()->getValue()); - $msg .= '&Signature=' . urlencode($signatureValue->getContent()->getValue()); + $msg .= '&Signature=' . urlencode($signatureValue->getValue()->getValue()); } if (str_contains($destination, '?')) { diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index 95cadcc8e2..2a22a56d4b 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -33,7 +33,7 @@ trait EncryptedElementTrait * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedData $encryptedData The EncryptedData object. * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey[] $decryptionKeys The EncryptedKey objects. */ - public function __construct( + final public function __construct( protected EncryptedData $encryptedData, protected array $decryptionKeys = [], ) { diff --git a/src/XML/mdui/Keywords.php b/src/XML/mdui/Keywords.php index b0eb2596d1..0e94f3a7ee 100644 --- a/src/XML/mdui/Keywords.php +++ b/src/XML/mdui/Keywords.php @@ -36,7 +36,6 @@ final class Keywords extends AbstractMduiElement implements public const TEXTCONTENT_TYPE = ListOfStringsValue::class; - /** * Initialize a Keywords. * @@ -130,6 +129,9 @@ public static function fromArray(array $data): static */ public function toArray(): array { - return [$this->getLanguage()->getValue() => $this->getContent()->toArray()]; + /** @var \SimpleSAML\SAML2\Type\ListOfStringsValue $content */ + $content = $this->getContent(); + + return [$this->getLanguage()->getValue() => $content->toArray()]; } } From 7ca1f038f44ac004d58ef7e2675e13c42a6e6ddc Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 2 Oct 2025 21:56:52 +0200 Subject: [PATCH 20/34] Remove unused code --- src/XML/saml/EncryptedAssertion.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/XML/saml/EncryptedAssertion.php b/src/XML/saml/EncryptedAssertion.php index 93f310b226..604beb7655 100644 --- a/src/XML/saml/EncryptedAssertion.php +++ b/src/XML/saml/EncryptedAssertion.php @@ -24,10 +24,6 @@ final class EncryptedAssertion extends AbstractSamlElement implements use SchemaValidatableElementTrait; - /** @var bool */ - protected bool $wasSignedAtConstruction = false; - - /** * @inheritDoc * @@ -40,13 +36,4 @@ public function decrypt(EncryptionAlgorithmInterface $decryptor): Assertion DOMDocumentFactory::fromString($this->decryptData($decryptor))->documentElement, ); } - - - /** - * @return bool - */ - public function wasSignedAtConstruction(): bool - { - return $this->wasSignedAtConstruction; - } } From 3fa79ebeb7d18b979a91972ddd1cf1ff8c534960 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 10 Oct 2025 17:22:02 +0200 Subject: [PATCH 21/34] Simplify unit tests for now --- tests/SAML2/XML/saml/AdviceTest.php | 9 +--- .../XML/saml/AuthzDecisionStatementTest.php | 33 +++++++++++-- tests/SAML2/XML/saml/EvidenceTest.php | 47 +++++++++++++++++-- tests/resources/xml/saml_Advice.xml | 29 ------------ .../xml/saml_AuthzDecisionStatement.xml | 29 ------------ tests/resources/xml/saml_Evidence.xml | 7 --- 6 files changed, 71 insertions(+), 83 deletions(-) diff --git a/tests/SAML2/XML/saml/AdviceTest.php b/tests/SAML2/XML/saml/AdviceTest.php index 5f8c2f4690..f1262e13ac 100644 --- a/tests/SAML2/XML/saml/AdviceTest.php +++ b/tests/SAML2/XML/saml/AdviceTest.php @@ -45,9 +45,6 @@ final class AdviceTest extends TestCase /** @var \DOMDocument $assertion */ private static DOMDocument $assertion; - /** @var \DOMDocument $encryptedAssertion */ - private static DOMDocument $encryptedAssertion; - /** */ @@ -70,10 +67,6 @@ public static function setUpBeforeClass(): void self::$assertion = DOMDocumentFactory::fromFile( dirname(__FILE__, 4) . '/resources/xml/saml_Assertion.xml', ); - - self::$encryptedAssertion = DOMDocumentFactory::fromFile( - dirname(__FILE__, 4) . '/resources/xml/saml_EncryptedAssertion.xml', - ); } @@ -90,7 +83,7 @@ public function testMarshalling(): void [AssertionIDRef::fromXML(self::$assertionIDRef->documentElement)], [AssertionURIRef::fromXML(self::$assertionURIRef->documentElement)], [Assertion::fromXML(self::$assertion->documentElement)], - [EncryptedAssertion::fromXML(self::$encryptedAssertion->documentElement)], + [], [$chunk], ); diff --git a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php index ea5818381e..3a5441820e 100644 --- a/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php +++ b/tests/SAML2/XML/saml/AuthzDecisionStatementTest.php @@ -14,6 +14,9 @@ use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; use SimpleSAML\SAML2\XML\saml\AbstractStatement; use SimpleSAML\SAML2\XML\saml\Action; +use SimpleSAML\SAML2\XML\saml\Assertion; +use SimpleSAML\SAML2\XML\saml\AssertionIDRef; +use SimpleSAML\SAML2\XML\saml\AssertionURIRef; use SimpleSAML\SAML2\XML\saml\AuthzDecisionStatement; use SimpleSAML\SAML2\XML\saml\DecisionTypeEnum; use SimpleSAML\SAML2\XML\saml\Evidence; @@ -39,8 +42,14 @@ final class AuthzDecisionStatementTest extends TestCase use SerializableElementTestTrait; - /** @var \DOMDocument $evidence */ - private static DOMDocument $evidence; + /** @var \DOMDocument $assertionIDRef */ + private static DOMDocument $assertionIDRef; + + /** @var \DOMDocument $assertionURIRef */ + private static DOMDocument $assertionURIRef; + + /** @var \DOMDocument $assertion */ + private static DOMDocument $assertion; /** @@ -53,8 +62,16 @@ public static function setUpBeforeClass(): void dirname(__FILE__, 4) . '/resources/xml/saml_AuthzDecisionStatement.xml', ); - self::$evidence = DOMDocumentFactory::fromFile( - dirname(__FILE__, 4) . '/resources/xml/saml_Evidence.xml', + self::$assertionIDRef = DOMDocumentFactory::fromFile( + dirname(__FILE__, 4) . '/resources/xml/saml_AssertionIDRef.xml', + ); + + self::$assertionURIRef = DOMDocumentFactory::fromFile( + dirname(__FILE__, 4) . '/resources/xml/saml_AssertionURIRef.xml', + ); + + self::$assertion = DOMDocumentFactory::fromFile( + dirname(__FILE__, 4) . '/resources/xml/saml_Assertion.xml', ); } @@ -63,6 +80,12 @@ public static function setUpBeforeClass(): void */ public function testMarshalling(): void { + $evidence = new Evidence( + [AssertionIDRef::fromXML(self::$assertionIDRef->documentElement)], + [AssertionURIRef::fromXML(self::$assertionURIRef->documentElement)], + [Assertion::fromXML(self::$assertion->documentElement)], + ); + $authzDecisionStatement = new AuthzDecisionStatement( SAMLAnyURIValue::fromString('urn:x-simplesamlphp:resource'), DecisionTypeValue::fromEnum(DecisionTypeEnum::Permit), @@ -76,7 +99,7 @@ public function testMarshalling(): void SAMLStringValue::fromString('OtherAction'), ), ], - Evidence::fromXML(self::$evidence->documentElement), + $evidence, ); $this->assertEquals( diff --git a/tests/SAML2/XML/saml/EvidenceTest.php b/tests/SAML2/XML/saml/EvidenceTest.php index d862460232..1df5a82cff 100644 --- a/tests/SAML2/XML/saml/EvidenceTest.php +++ b/tests/SAML2/XML/saml/EvidenceTest.php @@ -8,15 +8,28 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; +use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\AssertionIDRef; use SimpleSAML\SAML2\XML\saml\AssertionURIRef; use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; use SimpleSAML\SAML2\XML\saml\Evidence; +use SimpleSAML\Test\SAML2\Constants as C; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; +use SimpleSAML\XMLSchema\Type\AnyURIValue; +use SimpleSAML\XMLSchema\Type\Base64BinaryValue; +use SimpleSAML\XMLSchema\Type\IDValue; +use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; +use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; +use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; +use SimpleSAML\XMLSecurity\XML\xenc\CipherData; +use SimpleSAML\XMLSecurity\XML\xenc\CipherValue; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptedData; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey; +use SimpleSAML\XMLSecurity\XML\xenc\EncryptionMethod; use function dirname; use function strval; @@ -44,8 +57,8 @@ final class EvidenceTest extends TestCase /** @var \DOMDocument $assertion */ private static DOMDocument $assertion; - /** @var \DOMDocument $encryptedAssertion */ - private static DOMDocument $encryptedAssertion; + /** @var \SimpleSAML\SAML2\XML\saml\EncryptedAssertion $encryptedAssertion */ + private static EncryptedAssertion $encryptedAssertion; /** @@ -70,9 +83,33 @@ protected function setUp(): void dirname(__FILE__, 4) . '/resources/xml/saml_Assertion.xml', ); - self::$encryptedAssertion = DOMDocumentFactory::fromFile( - dirname(__FILE__, 4) . '/resources/xml/saml_EncryptedAssertion.xml', + $ek = new EncryptedKey( + cipherData: new CipherData( + new CipherValue( + Base64BinaryValue::fromString('sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU='), + ), + ), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString(C::KEY_TRANSPORT_OAEP_MGF1P), + ), ); + + $ed = new EncryptedData( + cipherData: new CipherData( + new CipherValue( + Base64BinaryValue::fromString('mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5'), + ), + ), + type: AnyURIValue::fromString(C::XMLENC_ELEMENT), + encryptionMethod: new EncryptionMethod( + AnyURIValue::fromString(C::BLOCK_ENC_AES256_GCM), + ), + keyInfo: new KeyInfo([ + $ek, + ]), + ); + + self::$encryptedAssertion = new EncryptedAssertion($ed, [$ek]); } @@ -84,7 +121,7 @@ public function testMarshalling(): void [AssertionIDRef::fromXML(self::$assertionIDRef->documentElement)], [AssertionURIRef::fromXML(self::$assertionURIRef->documentElement)], [Assertion::fromXML(self::$assertion->documentElement)], - [EncryptedAssertion::fromXML(self::$encryptedAssertion->documentElement)], + [self::$encryptedAssertion], ); $this->assertFalse($evidence->isEmptyElement()); diff --git a/tests/resources/xml/saml_Advice.xml b/tests/resources/xml/saml_Advice.xml index 8985f7ad29..5e555e616c 100644 --- a/tests/resources/xml/saml_Advice.xml +++ b/tests/resources/xml/saml_Advice.xml @@ -33,34 +33,5 @@ - - - - - - - - self::xenc:CipherValue[@Id="example1"] - - - - - - - sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU= - - - - - mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5 - - - - - - sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU= - - - Value diff --git a/tests/resources/xml/saml_AuthzDecisionStatement.xml b/tests/resources/xml/saml_AuthzDecisionStatement.xml index 452810e2d5..677567f885 100644 --- a/tests/resources/xml/saml_AuthzDecisionStatement.xml +++ b/tests/resources/xml/saml_AuthzDecisionStatement.xml @@ -36,34 +36,5 @@ - - - - - - - - self::xenc:CipherValue[@Id="example1"] - - - - - - - sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU= - - - - - mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5 - - - - - - sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU= - - - diff --git a/tests/resources/xml/saml_Evidence.xml b/tests/resources/xml/saml_Evidence.xml index 60c25c4c9f..dbe9c38070 100644 --- a/tests/resources/xml/saml_Evidence.xml +++ b/tests/resources/xml/saml_Evidence.xml @@ -37,13 +37,6 @@ - - - - self::xenc:CipherValue[@Id="example1"] - - - From 732d6facfd443f727e00d45d84520259e36a2e2b Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 10 Oct 2025 17:22:53 +0200 Subject: [PATCH 22/34] Properly deal with null-values during arrayization --- src/XML/samlp/NameIDPolicy.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/XML/samlp/NameIDPolicy.php b/src/XML/samlp/NameIDPolicy.php index e2dbdc4cfa..e386ccc35a 100644 --- a/src/XML/samlp/NameIDPolicy.php +++ b/src/XML/samlp/NameIDPolicy.php @@ -124,11 +124,11 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - if ($this->getFormat()) { + if ($this->getFormat() !== null) { $e->setAttribute('Format', $this->getFormat()->getValue()); } - if ($this->getSPNameQualifier()) { + if ($this->getSPNameQualifier() !== null) { $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue()); } @@ -206,9 +206,9 @@ private static function processArrayContents(array $data): array public function toArray(): array { $data = [ - 'Format' => $this->getFormat()->getValue(), - 'SPNameQualifier' => $this->getSPNameQualifier()->getValue(), - 'AllowCreate' => $this->getAllowCreate()->toBoolean(), + 'Format' => $this->getFormat()?->getValue(), + 'SPNameQualifier' => $this->getSPNameQualifier()?->getValue(), + 'AllowCreate' => $this->getAllowCreate()?->toBoolean(), ]; return array_filter($data); From 8cca70ee9a4eed1d0fed0cd4487d9b41e7807a58 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 10 Oct 2025 21:31:53 +0200 Subject: [PATCH 23/34] Remove unnecessary unit-test --- tests/SAML2/XML/md/RequestedAttributeTest.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/tests/SAML2/XML/md/RequestedAttributeTest.php b/tests/SAML2/XML/md/RequestedAttributeTest.php index fc1446ad37..8f1e44057e 100644 --- a/tests/SAML2/XML/md/RequestedAttributeTest.php +++ b/tests/SAML2/XML/md/RequestedAttributeTest.php @@ -7,6 +7,7 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; +use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLStringValue; @@ -86,22 +87,4 @@ public function testMarshallingWithoutOptionalArguments(): void $this->assertNull($ra->getFriendlyName()); $this->assertEquals([], $ra->getAttributeValues()); } - - - // test unmarshalling - - - /** - * Test that creating a RequestedAttribute object from XML fails when isRequired is not boolean. - */ - public function testUnmarshallingWithWrongIsRequired(): void - { - $xmlRepresentation = clone self::$xmlRepresentation; - $xmlRepresentation->documentElement->setAttribute('isRequired', 'wrong'); - - $this->expectException(AssertionFailedException::class); - $this->expectExceptionMessage('The \'isRequired\' attribute of md:RequestedAttribute must be a boolean.'); - - RequestedAttribute::fromXML($xmlRepresentation->documentElement); - } } From 6f79cbc80a355aac369c4045d2eabbc4ff53a502 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 10 Oct 2025 21:53:19 +0200 Subject: [PATCH 24/34] Fix several issues --- src/Type/AnyURIListValue.php | 5 ++++- src/XML/EncryptedElementTrait.php | 13 +++++++------ tests/SAML2/Type/AnyURIListValueTest.php | 5 +++-- tests/SAML2/XML/md/IDPSSODescriptorTest.php | 4 ---- tests/resources/xml/saml_EncryptedID.xml | 4 ---- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/Type/AnyURIListValue.php b/src/Type/AnyURIListValue.php index 8b624d4156..4c92c2e6be 100644 --- a/src/Type/AnyURIListValue.php +++ b/src/Type/AnyURIListValue.php @@ -6,6 +6,7 @@ use SimpleSAML\SAML2\Assert\Assert; use SimpleSAML\SAML2\Constants as C; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; use SimpleSAML\XMLSchema\Type\Interface\ListTypeInterface; @@ -33,8 +34,10 @@ class AnyURIListValue extends SAMLAnyURIValue implements ListTypeInterface */ protected function validateValue(string $value): void { - $uris = preg_split('/[\s]+/', $this->sanitizeValue($value), C::UNBOUNDED_LIMIT); + $sanitized = $this->sanitizeValue($value); + Assert::stringNotEmpty($sanitized, ProtocolViolationException::class); + $uris = preg_split('/[\s]+/', $sanitized, C::UNBOUNDED_LIMIT); Assert::allValidAnyURI($uris, SchemaViolationException::class); } diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index 2a22a56d4b..ed42985bda 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -31,13 +31,14 @@ trait EncryptedElementTrait * Constructor for encrypted elements. * * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedData $encryptedData The EncryptedData object. - * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey[] $decryptionKeys The EncryptedKey objects. + * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey[] $encryptedKey The EncryptedKey objects. */ final public function __construct( protected EncryptedData $encryptedData, - protected array $decryptionKeys = [], + array $encryptedKey = [], ) { - Assert::allIsInstanceOf($decryptionKeys, EncryptedKey::class, ProtocolViolationException::class); + Assert::allIsInstanceOf($encryptedKey, EncryptedKey::class, ProtocolViolationException::class); + $this->encryptedKey = $encryptedKey; /** * 6.2: The element's Type attribute SHOULD be used and, if it is @@ -74,9 +75,9 @@ public function getEncryptionBackend(): ?EncryptionBackend } - public function getDecryptionKeys(): array + public function getEncryptedKeys(): array { - return $this->decryptionKeys; + return $this->encryptedKey; } @@ -118,7 +119,7 @@ public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); $this->encryptedData->toXML($e); - foreach ($this->getDecryptionKeys() as $key) { + foreach ($this->getEncryptedKeys() as $key) { $key->toXML($e); } return $e; diff --git a/tests/SAML2/Type/AnyURIListValueTest.php b/tests/SAML2/Type/AnyURIListValueTest.php index 3e2e0131cb..96a6dd6fec 100644 --- a/tests/SAML2/Type/AnyURIListValueTest.php +++ b/tests/SAML2/Type/AnyURIListValueTest.php @@ -8,6 +8,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; +use SimpleSAML\SAML2\Exception\ProtocolViolationException; use SimpleSAML\SAML2\Type\AnyURIListValue; use SimpleSAML\XMLSchema\Exception\SchemaViolationException; @@ -30,7 +31,7 @@ public function testAnyURIList(bool $shouldPass, string $anyURIList): void try { AnyURIListValue::fromString($anyURIList); $this->assertTrue($shouldPass); - } catch (SchemaViolationException $e) { + } catch (ProtocolViolationException|SchemaViolationException $e) { $this->assertFalse($shouldPass); } } @@ -55,7 +56,7 @@ public static function provideAnyURIList(): array 'single' => [true, "urn:x-simplesamlphp:namespace"], 'multiple' => [true, 'urn:x-simplesamlphp:namespace urn:x-ssp:ns'], 'normalization' => [true, "urn:x-simplesamlphp:namespace \n urn:x-ssp:ns"], - 'empty' => [true, ''], + 'empty' => [false, ''], ]; } } diff --git a/tests/SAML2/XML/md/IDPSSODescriptorTest.php b/tests/SAML2/XML/md/IDPSSODescriptorTest.php index 59d8062300..598e98f89b 100644 --- a/tests/SAML2/XML/md/IDPSSODescriptorTest.php +++ b/tests/SAML2/XML/md/IDPSSODescriptorTest.php @@ -217,10 +217,6 @@ public function testMarshallingWithEmptySingleSignOnService(): void public function testMarshallingWithoutProtocolSupportThrowsException(): void { $this->expectException(ProtocolViolationException::class); - $this->expectExceptionMessage( - 'SAML v2.0 entities MUST include the SAML protocol namespace URI ' - . 'in their protocolSupportEnumeration attribute', - ); new IDPSSODescriptor( [ diff --git a/tests/resources/xml/saml_EncryptedID.xml b/tests/resources/xml/saml_EncryptedID.xml index 5dba50768f..bbd8a0c824 100644 --- a/tests/resources/xml/saml_EncryptedID.xml +++ b/tests/resources/xml/saml_EncryptedID.xml @@ -18,9 +18,5 @@ he5ZBjtfp/1/Y3PgE/CWspDPADig9vuZ7yZyYXDQ1wA/HBTPCldtL/p6UT5RCAFYUwN6kp3jnHkhK1yMjrI1SMw0n5NEc2wO9N5inQIeQOZ8XD9yD9M5fHvWz2ByNMGlB35RWMnBRHzDi1PRV7Irwcs9WoiODh3i6j2vYXP7cAo= - - - - Name of the key From 7fef41cf1251003dfd32a43826f1c08ec8e3400a Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Sat, 11 Oct 2025 12:44:41 +0200 Subject: [PATCH 25/34] bugfix: deal with null value --- src/XML/md/AbstractIndexedEndpointType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/XML/md/AbstractIndexedEndpointType.php b/src/XML/md/AbstractIndexedEndpointType.php index e498912986..8a55c2b887 100644 --- a/src/XML/md/AbstractIndexedEndpointType.php +++ b/src/XML/md/AbstractIndexedEndpointType.php @@ -228,7 +228,7 @@ public function toArray(): array { $data = parent::toArray(); $data['index'] = $this->getIndex()->toInteger(); - $data['isDefault'] = $this->getIsDefault()->toBoolean(); + $data['isDefault'] = $this->getIsDefault()?->toBoolean(); return array_filter($data); } From 6e3c2fed39884212e88c445a959fd12b12fc2c1e Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 17 Oct 2025 15:51:34 +0200 Subject: [PATCH 26/34] Remove unused class --- src/Configuration/SimpleSAMLConverter.php | 157 ---------------------- 1 file changed, 157 deletions(-) delete mode 100644 src/Configuration/SimpleSAMLConverter.php diff --git a/src/Configuration/SimpleSAMLConverter.php b/src/Configuration/SimpleSAMLConverter.php deleted file mode 100644 index bf19e68579..0000000000 --- a/src/Configuration/SimpleSAMLConverter.php +++ /dev/null @@ -1,157 +0,0 @@ -hasValue($prefix . 'keys')) { - $extracted['keys'] = $configuration->getArray($prefix . 'keys'); - } - - // ported from - // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1108 - if ($configuration->hasValue($prefix . 'certData')) { - $extracted['certificateData'] = $configuration->getString($prefix . 'certData'); - } - - // ported from - // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1119 - if ($configuration->hasValue($prefix . 'certificate')) { - $extracted['certificateData'] = $configuration->getString($prefix . 'certificate'); - } - - $extracted['assertionEncryptionEnabled'] = $configuration->getBoolean('assertion.encryption', false); - - if ($configuration->hasValue('sharedKey')) { - $extracted['sharedKey'] = $configuration->getString('sharedKey'); - } - - return $extracted; - } - - - /** - * @param \SimpleSAML\Configuration $configuration - * @param array $baseConfiguration - * - * - * @psalm-suppress UndefinedClass - */ - protected static function enrichForIdentityProvider(Configuration $configuration, array &$baseConfiguration): void - { - $baseConfiguration['entityId'] = $configuration->getString('entityid'); - } - - - /** - * @param \SimpleSAML\Configuration $configuration - * @param array $baseConfiguration - * - * - * @psalm-suppress UndefinedClass - */ - protected static function enrichForServiceProvider(Configuration $configuration, array &$baseConfiguration): void - { - $baseConfiguration['entityId'] = $configuration->getString('entityid'); - } - - - /** - * @param \SimpleSAML\Configuration $configuration - * @param array $baseConfiguration - * - * - * @psalm-suppress UndefinedClass - */ - protected static function enrichForDecryptionProvider( - Configuration $configuration, - array &$baseConfiguration, - ): void { - if ($configuration->hasValue('sharedKey')) { - $baseConfiguration['sharedKey'] = $configuration->getString('sharedKey', null); - } - - if ($configuration->hasValue('new_privatekey')) { - $baseConfiguration['privateKeys'][] = new PrivateKey( - $configuration->getString('new_privatekey'), - PrivateKey::NAME_NEW, - $configuration->getString('new_privatekey_pass', null), - ); - } - - if ($configuration->getBoolean('assertion.encryption', false)) { - $baseConfiguration['privateKeys'][] = new PrivateKey( - $configuration->getString('privatekey'), - PrivateKey::NAME_DEFAULT, - $configuration->getString('privatekey_pass', null), - ); - - if ($configuration->hasValue('encryption.blacklisted-algorithms')) { - $baseConfiguration['blacklistedEncryptionAlgorithms'] = $configuration->getValue( - 'encryption.blacklisted-algorithms', - ); - } - } - } -} From 98a42a6e14d446dc9908f2c328569190626cd881 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 17 Oct 2025 18:38:33 +0200 Subject: [PATCH 27/34] Replace PrivateKey class with the one from xml-security --- src/Certificate/PrivateKey.php | 42 ----------------- src/Certificate/PrivateKeyLoader.php | 45 +++++-------------- src/Configuration/IdentityProvider.php | 3 +- .../Certificate/PrivateKeyLoaderTest.php | 21 +++------ tests/SAML2/Certificate/PrivateKeyTest.php | 33 -------------- 5 files changed, 17 insertions(+), 127 deletions(-) delete mode 100644 src/Certificate/PrivateKey.php delete mode 100644 tests/SAML2/Certificate/PrivateKeyTest.php diff --git a/src/Certificate/PrivateKey.php b/src/Certificate/PrivateKey.php deleted file mode 100644 index d775bf184d..0000000000 --- a/src/Certificate/PrivateKey.php +++ /dev/null @@ -1,42 +0,0 @@ - $keyContents, self::USAGE_ENCRYPTION => true]; - if ($passphrase) { - $keyData['passphrase'] = $passphrase; - } - - return new self($keyData); - } - - - /** - * @return string - */ - public function getKeyAsString(): string - { - return $this->keyData['PEM']; - } - - - /** - * @return string|null - */ - public function getPassphrase(): ?string - { - return isset($this->keyData['passphrase']) ? $this->keyData['passphrase'] : null; - } -} diff --git a/src/Certificate/PrivateKeyLoader.php b/src/Certificate/PrivateKeyLoader.php index 16af413f0e..a1b1d53783 100644 --- a/src/Certificate/PrivateKeyLoader.php +++ b/src/Certificate/PrivateKeyLoader.php @@ -4,13 +4,11 @@ namespace SimpleSAML\SAML2\Certificate; -use SimpleSAML\SAML2\Certificate\PrivateKey; use SimpleSAML\SAML2\Configuration\DecryptionProvider; use SimpleSAML\SAML2\Configuration\PrivateKey as PrivateKeyConfiguration; -use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Utilities\ArrayCollection; -use SimpleSAML\SAML2\Utilities\File; -use SimpleSAML\XMLSecurity\XMLSecurityKey; +use SimpleSAML\XMLSecurity\Key\PrivateKey; +use SimpleSAML\XMLSecurity\Key\SymmetricKey; class PrivateKeyLoader { @@ -18,17 +16,14 @@ class PrivateKeyLoader * Loads a private key based on the configuration given. * * @param \SimpleSAML\SAML2\Configuration\PrivateKey $key - * @return \SimpleSAML\SAML2\Certificate\PrivateKey + * @return \SimpleSAML\XMLSecurity\Key\PrivateKey */ public function loadPrivateKey(PrivateKeyConfiguration $key): PrivateKey { - if ($key->isFile()) { - $privateKey = File::getFileContents($key->getFilePath()); - } else { - $privateKey = $key->getContents(); - } - - return PrivateKey::create($privateKey, $key->getPassPhrase()); + return PrivateKey::fromFile( + $key->isFile() ? $key->getFilePath() : $key->getContents(), + $key->getPassPhrase(), + ); } @@ -46,8 +41,7 @@ public function loadDecryptionKeys( $senderSharedKey = $identityProvider->getSharedKey(); if ($senderSharedKey !== null) { - $key = new XMLSecurityKey(C::BLOCK_ENC_AES128); - $key->loadKey($senderSharedKey); + $key = new SymmetricKey($senderSharedKey); $decryptionKeys->add($key); return $decryptionKeys; @@ -56,32 +50,13 @@ public function loadDecryptionKeys( $newPrivateKey = $serviceProvider->getPrivateKey(PrivateKeyConfiguration::NAME_NEW); if ($newPrivateKey instanceof PrivateKeyConfiguration) { $loadedKey = $this->loadPrivateKey($newPrivateKey); - $decryptionKeys->add($this->convertPrivateKeyToRsaKey($loadedKey)); + $decryptionKeys->add($loadedKey); } $privateKey = $serviceProvider->getPrivateKey(PrivateKeyConfiguration::NAME_DEFAULT, true); $loadedKey = $this->loadPrivateKey($privateKey); - $decryptionKeys->add($this->convertPrivateKeyToRsaKey($loadedKey)); + $decryptionKeys->add($loadedKey); return $decryptionKeys; } - - - /** - * @param \SimpleSAML\SAML2\Certificate\PrivateKey $privateKey - * @throws \Exception - * @return \SimpleSAML\XMLSecurity\XMLSecurityKey - */ - private function convertPrivateKeyToRsaKey(PrivateKey $privateKey): XMLSecurityKey - { - $key = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, ['type' => 'private']); - $passphrase = $privateKey->getPassphrase(); - if ($passphrase) { - $key->passphrase = $passphrase; - } - - $key->loadKey($privateKey->getKeyAsString()); - - return $key; - } } diff --git a/src/Configuration/IdentityProvider.php b/src/Configuration/IdentityProvider.php index 9081b1ddce..2918995f05 100644 --- a/src/Configuration/IdentityProvider.php +++ b/src/Configuration/IdentityProvider.php @@ -5,6 +5,7 @@ namespace SimpleSAML\SAML2\Configuration; use RuntimeException; +use SimpleSAML\XMLSecurity\Constants as C; use function array_filter; use function array_pop; @@ -108,7 +109,7 @@ public function getPrivateKey(string $name, ?bool $required = null) */ public function getBlacklistedAlgorithms(): ?array { - return $this->get('blacklistedEncryptionAlgorithms'); + return $this->get('blacklistedEncryptionAlgorithms', [C::KEY_TRANSPORT_RSA_1_5]); } diff --git a/tests/SAML2/Certificate/PrivateKeyLoaderTest.php b/tests/SAML2/Certificate/PrivateKeyLoaderTest.php index eb6c584752..95f3107b7d 100644 --- a/tests/SAML2/Certificate/PrivateKeyLoaderTest.php +++ b/tests/SAML2/Certificate/PrivateKeyLoaderTest.php @@ -8,9 +8,9 @@ use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Certificate\PrivateKey; use SimpleSAML\SAML2\Certificate\PrivateKeyLoader; use SimpleSAML\SAML2\Configuration\PrivateKey as ConfPrivateKey; +use SimpleSAML\XMLSecurity\Key\PrivateKey; use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; /** @@ -42,11 +42,6 @@ public function testLoadingAConfiguredPrivateKeyReturnsACertificatePrivateKey( $resultingKey = self::$privateKeyLoader->loadPrivateKey($configuredKey); $this->assertInstanceOf(PrivateKey::class, $resultingKey); - $this->assertEquals( - trim($resultingKey->getKeyAsString()), - PEMCertificatesMock::loadPlainKeyFile(PEMCertificatesMock::BROKEN_PRIVATE_KEY), - ); - $this->assertEquals($resultingKey->getPassphrase(), $configuredKey->getPassPhrase()); } @@ -58,24 +53,18 @@ public function testLoadingAConfiguredPrivateKeyReturnsACertificatePrivateKey( public static function privateKeyTestProvider(): array { return [ - 'no passphrase' => [ - new ConfPrivateKey( - PEMCertificatesMock::buildKeysPath(PEMCertificatesMock::BROKEN_PRIVATE_KEY), - ConfPrivateKey::NAME_DEFAULT, - ), - ], 'with passphrase' => [ new ConfPrivateKey( - PEMCertificatesMock::buildKeysPath(PEMCertificatesMock::BROKEN_PRIVATE_KEY), + PEMCertificatesMock::buildKeysPath(PEMCertificatesMock::PRIVATE_KEY), ConfPrivateKey::NAME_DEFAULT, - 'foo bar baz', + '1234', ), ], 'private key as contents' => [ new ConfPrivateKey( - PEMCertificatesMock::loadPlainKeyFile(PEMCertificatesMock::BROKEN_PRIVATE_KEY), + PEMCertificatesMock::loadPlainKeyFile(PEMCertificatesMock::PRIVATE_KEY), ConfPrivateKey::NAME_DEFAULT, - '', + '1234', false, ), ], diff --git a/tests/SAML2/Certificate/PrivateKeyTest.php b/tests/SAML2/Certificate/PrivateKeyTest.php deleted file mode 100644 index 11451ff427..0000000000 --- a/tests/SAML2/Certificate/PrivateKeyTest.php +++ /dev/null @@ -1,33 +0,0 @@ -assertEquals($key, $pk_nopass->getKeyAsString()); - - $pk_withpass = PrivateKey::create($key, "s3cr1t"); - $this->assertEquals($key, $pk_withpass->getKeyAsString()); - $this->assertEquals("s3cr1t", $pk_withpass->getPassphrase()); - } -} From ddf3f2ccbbbf57e0e0f4ca6d87ef7b3f91015e29 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 12 Nov 2025 23:02:21 +0100 Subject: [PATCH 28/34] Bump xml-common --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 21c504ad74..29567c9eda 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "psr/http-message": "~2.0", "psr/log": "~2.3.1 || ~3.0.0", "simplesamlphp/assert": "~1.9.0", - "simplesamlphp/xml-common": "~2.0.3", + "simplesamlphp/xml-common": "~2.1.2", "simplesamlphp/xml-security": "~2.0.2", "simplesamlphp/xml-soap": "~2.0.3" }, @@ -40,7 +40,6 @@ "beste/clock": "~3.0.0", "mockery/mockery": "~1.6.12", - "simplesamlphp/composer-xmlprovider-installer": "~1.0.2", "simplesamlphp/simplesamlphp-test-framework": "~1.10.2" }, "suggest": { From 62a017c6e579c741a13ed0f8ebb2e09a3997109c Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Fri, 14 Nov 2025 00:35:20 +0100 Subject: [PATCH 29/34] Fix version constraint --- composer.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.json b/composer.json index 29567c9eda..f5ff05e924 100644 --- a/composer.json +++ b/composer.json @@ -26,14 +26,14 @@ "ext-pcre": "*", "ext-zlib": "*", - "nyholm/psr7": "~1.8.2", - "psr/clock": "~1.0.0", + "nyholm/psr7": "~1.8", + "psr/clock": "~1.0", "psr/http-message": "~2.0", - "psr/log": "~2.3.1 || ~3.0.0", - "simplesamlphp/assert": "~1.9.0", - "simplesamlphp/xml-common": "~2.1.2", - "simplesamlphp/xml-security": "~2.0.2", - "simplesamlphp/xml-soap": "~2.0.3" + "psr/log": "~2.3 || ~3.0", + "simplesamlphp/assert": "~1.9", + "simplesamlphp/xml-common": "~2.2", + "simplesamlphp/xml-security": "~2.0", + "simplesamlphp/xml-soap": "~2.0" }, "require-dev": { "ext-intl": "*", From 4a66f07546928b0b3cdf629d18177492c83da29a Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 18 Nov 2025 00:23:13 +0100 Subject: [PATCH 30/34] Properly normalize documents --- src/XML/EncryptedElementTrait.php | 15 +++++++++------ tests/SAML2/XML/saml/SubjectTest.php | 5 +++-- tests/resources/xml/saml_EncryptedID.xml | 12 ++++++++---- tests/resources/xml/saml_Evidence.xml | 14 +++++++------- tests/resources/xml/saml_Subject.xml | 6 +++--- .../resources/xml/saml_SubjectConfirmation.xml | 4 ++-- .../xml/saml_SubjectConfirmationData.xml | 4 ++-- tests/resources/xml/samlp_ArtifactResolve.xml | 4 ++-- tests/resources/xml/samlp_ArtifactResponse.xml | 6 +++--- .../resources/xml/samlp_AssertionIDRequest.xml | 8 ++++---- tests/resources/xml/samlp_AttributeQuery.xml | 18 +++++++++--------- tests/resources/xml/samlp_AuthnQuery.xml | 8 ++++---- tests/resources/xml/samlp_AuthnRequest.xml | 6 +++--- .../resources/xml/samlp_AuthzDecisionQuery.xml | 18 +++++++++--------- tests/resources/xml/samlp_Extensions.xml | 6 +++--- tests/resources/xml/samlp_LogoutRequest.xml | 12 ++++++------ tests/resources/xml/samlp_LogoutResponse.xml | 4 ++-- .../xml/samlp_RequestedAuthnContext.xml | 4 ++-- tests/resources/xml/samlp_Response.xml | 12 ++++++------ tests/resources/xml/samlp_Status.xml | 4 ++-- tests/resources/xml/samlp_StatusDetail.xml | 4 ++-- tests/resources/xml/shibmd_KeyAuthority.xml | 6 +++--- 22 files changed, 94 insertions(+), 86 deletions(-) diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index ed42985bda..a25d105873 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -35,14 +35,14 @@ trait EncryptedElementTrait */ final public function __construct( protected EncryptedData $encryptedData, - array $encryptedKey = [], + protected array $decryptionKeys = [], ) { - Assert::allIsInstanceOf($encryptedKey, EncryptedKey::class, ProtocolViolationException::class); - $this->encryptedKey = $encryptedKey; + Assert::allIsInstanceOf($decryptionKeys, EncryptedKey::class, ProtocolViolationException::class); /** * 6.2: The element's Type attribute SHOULD be used and, if it is * present, MUST have the value http://www.w3.org/2001/04/xmlenc#Element. + * */ Assert::nullOrSame($encryptedData->getType()->getValue(), C::XMLENC_ELEMENT); @@ -75,9 +75,9 @@ public function getEncryptionBackend(): ?EncryptionBackend } - public function getEncryptedKeys(): array + public function getDecryptionKeys(): array { - return $this->encryptedKey; + return $this->decryptionKeys; } @@ -118,10 +118,13 @@ public static function fromXML(DOMElement $xml): static public function toXML(?DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); + $this->encryptedData->toXML($e); - foreach ($this->getEncryptedKeys() as $key) { + + foreach ($this->getDecryptionKeys() as $key) { $key->toXML($e); } + return $e; } } diff --git a/tests/SAML2/XML/saml/SubjectTest.php b/tests/SAML2/XML/saml/SubjectTest.php index cf780ccccd..315afe5b74 100644 --- a/tests/SAML2/XML/saml/SubjectTest.php +++ b/tests/SAML2/XML/saml/SubjectTest.php @@ -330,13 +330,14 @@ public function testManyNameIDThrowsException(): void */ public function testMultipleIdentifiers(): void { + $dsNamespace = KeyInfo::NS; $samlNamespace = Subject::NS; $xsiNamespace = C_XSI::NS_XSI; $document = DOMDocumentFactory::fromString( << - + + urn:some:audience - + + - + @@ -13,10 +13,14 @@ 720FAxwOXcv8ast9YvQutUoue+YA2FgLLNaD/FZrWiNexTkPyZ8CWrcf2zZj2zrOwTjQ9KJvzvCuzq4fM51sU1boOakLpz05NonDdMgeWW/eWcOJJfOZs0tYvYc5qZ/R+BzRnJsGG6w2ZmipEi88X/8uA85c - + he5ZBjtfp/1/Y3PgE/CWspDPADig9vuZ7yZyYXDQ1wA/HBTPCldtL/p6UT5RCAFYUwN6kp3jnHkhK1yMjrI1SMw0n5NEc2wO9N5inQIeQOZ8XD9yD9M5fHvWz2ByNMGlB35RWMnBRHzDi1PRV7Irwcs9WoiODh3i6j2vYXP7cAo= + + + + Name of the key diff --git a/tests/resources/xml/saml_Evidence.xml b/tests/resources/xml/saml_Evidence.xml index dbe9c38070..0b87c4fd4c 100644 --- a/tests/resources/xml/saml_Evidence.xml +++ b/tests/resources/xml/saml_Evidence.xml @@ -1,4 +1,4 @@ - + _Test urn:x-simplesamlphp:reference @@ -23,20 +23,20 @@ - 1 + 1 - 1 + 1 - 1 + 1 - + - + @@ -48,7 +48,7 @@ mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5 - + sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU= diff --git a/tests/resources/xml/saml_Subject.xml b/tests/resources/xml/saml_Subject.xml index 531c549915..afde1cb410 100644 --- a/tests/resources/xml/saml_Subject.xml +++ b/tests/resources/xml/saml_Subject.xml @@ -1,9 +1,9 @@ - + SomeNameIDValue SomeOtherNameIDValue - - + + SomeKey Arbitrary Element diff --git a/tests/resources/xml/saml_SubjectConfirmation.xml b/tests/resources/xml/saml_SubjectConfirmation.xml index 0e1c7c8aea..4851272cba 100644 --- a/tests/resources/xml/saml_SubjectConfirmation.xml +++ b/tests/resources/xml/saml_SubjectConfirmation.xml @@ -1,7 +1,7 @@ - + SomeNameIDValue - + SomeKey Arbitrary Element diff --git a/tests/resources/xml/saml_SubjectConfirmationData.xml b/tests/resources/xml/saml_SubjectConfirmationData.xml index 198fb2b26e..c8e7400da2 100644 --- a/tests/resources/xml/saml_SubjectConfirmationData.xml +++ b/tests/resources/xml/saml_SubjectConfirmationData.xml @@ -1,5 +1,5 @@ - - + + SomeKey Arbitrary Element diff --git a/tests/resources/xml/samlp_ArtifactResolve.xml b/tests/resources/xml/samlp_ArtifactResolve.xml index cab08e88c1..0356c29528 100644 --- a/tests/resources/xml/samlp_ArtifactResolve.xml +++ b/tests/resources/xml/samlp_ArtifactResolve.xml @@ -1,4 +1,4 @@ - - https://ServiceProvider.com/SAML + + https://ServiceProvider.com/SAML AAQAADWNEw5VT47wcO4zX/iEzMmFQvGknDfws2ZtqSGdkNSbsW1cmVR0bzU= diff --git a/tests/resources/xml/samlp_ArtifactResponse.xml b/tests/resources/xml/samlp_ArtifactResponse.xml index 4fd5c3baa9..b998066147 100644 --- a/tests/resources/xml/samlp_ArtifactResponse.xml +++ b/tests/resources/xml/samlp_ArtifactResponse.xml @@ -1,10 +1,10 @@ - - https://sp.example.com/SAML2 + + https://sp.example.com/SAML2 - urn:example:other + urn:example:other diff --git a/tests/resources/xml/samlp_AssertionIDRequest.xml b/tests/resources/xml/samlp_AssertionIDRequest.xml index f1b7f0556e..36c7f85f36 100644 --- a/tests/resources/xml/samlp_AssertionIDRequest.xml +++ b/tests/resources/xml/samlp_AssertionIDRequest.xml @@ -1,5 +1,5 @@ - - https://gateway.stepup.org/saml20/sp/metadata - _abc123 - _def456 + + https://gateway.stepup.org/saml20/sp/metadata + _abc123 + _def456 diff --git a/tests/resources/xml/samlp_AttributeQuery.xml b/tests/resources/xml/samlp_AttributeQuery.xml index c3f97ececc..724a74db81 100644 --- a/tests/resources/xml/samlp_AttributeQuery.xml +++ b/tests/resources/xml/samlp_AttributeQuery.xml @@ -1,20 +1,20 @@ - - https://example.org/ - + + https://example.org/ + urn:example:subject - + test1_attrv1 test1_attrv2 - + test2_attrv1 test2_attrv2 test2_attrv3 - - - 4 - 23 + + + 4 + 23 diff --git a/tests/resources/xml/samlp_AuthnQuery.xml b/tests/resources/xml/samlp_AuthnQuery.xml index 7db034df10..c4f9850187 100644 --- a/tests/resources/xml/samlp_AuthnQuery.xml +++ b/tests/resources/xml/samlp_AuthnQuery.xml @@ -1,9 +1,9 @@ - - https://example.org/ - + + https://example.org/ + urn:example:subject - https://example.org/relative/path/to/document.xml + https://example.org/relative/path/to/document.xml diff --git a/tests/resources/xml/samlp_AuthnRequest.xml b/tests/resources/xml/samlp_AuthnRequest.xml index 147ace7c52..ece73dcc1d 100644 --- a/tests/resources/xml/samlp_AuthnRequest.xml +++ b/tests/resources/xml/samlp_AuthnRequest.xml @@ -1,6 +1,6 @@ - - https://gateway.stepup.org/saml20/sp/metadata - + + https://gateway.stepup.org/saml20/sp/metadata + user@example.org diff --git a/tests/resources/xml/samlp_AuthzDecisionQuery.xml b/tests/resources/xml/samlp_AuthzDecisionQuery.xml index ded7f4c060..1be1cd0bd0 100644 --- a/tests/resources/xml/samlp_AuthzDecisionQuery.xml +++ b/tests/resources/xml/samlp_AuthzDecisionQuery.xml @@ -1,11 +1,11 @@ - - https://example.org/ - + + https://example.org/ + urn:example:subject - SomeAction - SomeOtherAction - + SomeAction + SomeOtherAction + urn:x-simplesamlphp:issuer @@ -28,13 +28,13 @@ - 1 + 1 - 1 + 1 - 1 + 1 diff --git a/tests/resources/xml/samlp_Extensions.xml b/tests/resources/xml/samlp_Extensions.xml index 17fd9c9d57..e47a70f446 100644 --- a/tests/resources/xml/samlp_Extensions.xml +++ b/tests/resources/xml/samlp_Extensions.xml @@ -1,6 +1,6 @@ - - + + - + diff --git a/tests/resources/xml/samlp_LogoutRequest.xml b/tests/resources/xml/samlp_LogoutRequest.xml index 5e00e9116b..cba9fe6add 100644 --- a/tests/resources/xml/samlp_LogoutRequest.xml +++ b/tests/resources/xml/samlp_LogoutRequest.xml @@ -1,9 +1,9 @@ - - urn:x-simplesamlphp:issuer - - + + urn:x-simplesamlphp:issuer + + - + @@ -15,7 +15,7 @@ MN9qX/dEA1oXIS9Dowjhax2cWTZ88ADKpnZ7zI/okqlqpu7okUf/HACkh+hwo5r+BZSyE06RITOAhFBczwjJsZVBwbf/cUb7JjD0pMvywWkEhNoak4OTA5RVXo96bqoRL6co6Bz3GOJBmTUEnXUZATyWcazf - + grf3DVcVDV8EVCbfl9+jf6XX6gNjGSTenPqCAQhztFP6YJ3o6BS3XVbilA08CEBx0ci9PDfAsQKDl6fyBMgVSoL17zvJhNpyC7XCniIyCskUv0WmT9xCuIDNzEMZy5InunKf3KRtCRJGQzdjkoxRY3Q8Qczm2x2UoEVfzlpj2n8= diff --git a/tests/resources/xml/samlp_LogoutResponse.xml b/tests/resources/xml/samlp_LogoutResponse.xml index 252fe39aae..20b24d5dd7 100644 --- a/tests/resources/xml/samlp_LogoutResponse.xml +++ b/tests/resources/xml/samlp_LogoutResponse.xml @@ -1,5 +1,5 @@ - - urn:x-simplesamlphp:issuer + + urn:x-simplesamlphp:issuer diff --git a/tests/resources/xml/samlp_RequestedAuthnContext.xml b/tests/resources/xml/samlp_RequestedAuthnContext.xml index 8f0640f44c..254a54c2a9 100644 --- a/tests/resources/xml/samlp_RequestedAuthnContext.xml +++ b/tests/resources/xml/samlp_RequestedAuthnContext.xml @@ -1,3 +1,3 @@ - - https://example.org/relative/path/to/document.xml + + https://example.org/relative/path/to/document.xml diff --git a/tests/resources/xml/samlp_Response.xml b/tests/resources/xml/samlp_Response.xml index dbf0d43942..5e9ee89685 100644 --- a/tests/resources/xml/samlp_Response.xml +++ b/tests/resources/xml/samlp_Response.xml @@ -1,9 +1,9 @@ - - https://IdentityProvider.com + + https://IdentityProvider.com - + urn:x-simplesamlphp:issuer SomeNameIDValue @@ -25,13 +25,13 @@ - 1 + 1 - 1 + 1 - 1 + 1 diff --git a/tests/resources/xml/samlp_Status.xml b/tests/resources/xml/samlp_Status.xml index 0ac60c75d2..67cbdb82e6 100644 --- a/tests/resources/xml/samlp_Status.xml +++ b/tests/resources/xml/samlp_Status.xml @@ -1,9 +1,9 @@ - + Something went wrong - org.sourceid.websso.profiles.idp.FailedAuthnSsoException + org.sourceid.websso.profiles.idp.FailedAuthnSsoException diff --git a/tests/resources/xml/samlp_StatusDetail.xml b/tests/resources/xml/samlp_StatusDetail.xml index 5654a34543..5ed94b7acc 100644 --- a/tests/resources/xml/samlp_StatusDetail.xml +++ b/tests/resources/xml/samlp_StatusDetail.xml @@ -1,3 +1,3 @@ - - org.sourceid.websso.profiles.idp.FailedAuthnSsoException + + org.sourceid.websso.profiles.idp.FailedAuthnSsoException diff --git a/tests/resources/xml/shibmd_KeyAuthority.xml b/tests/resources/xml/shibmd_KeyAuthority.xml index 941a29696b..52efbfa3f2 100644 --- a/tests/resources/xml/shibmd_KeyAuthority.xml +++ b/tests/resources/xml/shibmd_KeyAuthority.xml @@ -1,10 +1,10 @@ - - + + MIIG/DCCBOSgAwIBAgIIU2w5U7TnvlwwDQYJKoZIhvcNAQELBQAwZjELMAkGA1UEBhMCTkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjE3MDUGA1UEAwwuU3RhYXQgZGVyIE5lZGVybGFuZGVuIFByaXZhdGUgU2VydmljZXMgQ0EgLSBHMTAeFw0xNjExMDMxMDM2MTFaFw0yODExMTIwMDAwMDBaMIGAMQswCQYDVQQGEwJOTDEgMB4GA1UECgwXUXVvVmFkaXMgVHJ1c3RsaW5rIEIuVi4xFzAVBgNVBGEMDk5UUk5MLTMwMjM3NDU5MTYwNAYDVQQDDC1RdW9WYWRpcyBQS0lvdmVyaGVpZCBQcml2YXRlIFNlcnZpY2VzIENBIC0gRzEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCo9ep1FEPp6FQIgMT8wD5UoTDQoqkE43vWFx2ur6cxYQFpWXefd0dpdaugwOJ5igIilAoIrd+FdYxbJxQOkrbmkFX1mdW2mAf10+9BW5rn1HvwHG/nvZ8kyaeZuEyEUmVZ+EEFw+7hOru7YPkxA5U7N3IY409xAjiYS3Cti388bLPfE3Ci0Rt2WQlL3jbnSlAty2ZdJ5aCRkL3Cm8wERlwZ0lsLsTIQo1TCw6WfrDgEk+41MvP3eh+0wL3lWPnSPzwvI13Dd5PjT7Pte73oVpqRwgWl+2ZjGD7vwNf14rma3Khuwv74lWWJIr9EHu4miseqVlhk4mFpPC4zsKM6AeXfhZwKLmGAwM54yHw7hjvSPoBilpGiKdIdELMfFzWToSOjMXPQZyHSF5F13sj/hD+YLRBx95QsDa+1xWJq4hv+/t/WPuw1E+s8JYQ/5HKArYfGNMou20skdJyvYW5H+NcZ0guCaF6zdrUDkFv+uI+MkWQMxGw/mwqZX/cW4EC4PPG1j3NEK6/gfU7LT4W/M/GIBC6kJ+L5AJtDIvW8719oIp0UBmhF1nZyQSX6WdaplsM6CNYZ7SSq+kUC4k6Oalzsnv4kNy7ru6yzHoI33V6VXQcs2BevJjbf09YIHoh2cPKPB0nIvRNq9Lvpek0mi5lGzmDj+/DxRySLdPJbzzdCQIDAQABo4IBkTCCAY0wUgYIKwYBBQUHAQEERjBEMEIGCCsGAQUFBzAChjZodHRwOi8vY2VydC5wa2lvdmVyaGVpZC5ubC9Eb21Qcml2YXRlU2VydmljZXNDQS1HMS5jZXIwHQYDVR0OBBYEFLlsphO6uy80Y4MxLvl+SR3fAPVjMBIGA1UdEwEB/wQIMAYBAf8CAQAwHwYDVR0jBBgwFoAUPq+oD4eiLEF7FGwb89to05KnRKgwJQYIKwYBBQUHAQMEGTAXMBUGCCsGAQUFBwsCMAkGBwQAi+xJAQIwXQYDVR0gBFYwVDAMBgpghBABh2sBAggEMAwGCmCEEAGHawECCAUwNgYKYIQQAYdrAQIIBjAoMCYGCCsGAQUFBwIBFhpodHRwczovL2Nwcy5wa2lvdmVyaGVpZC5ubDBNBgNVHR8ERjBEMEKgQKA+hjxodHRwOi8vY3JsLnBraW92ZXJoZWlkLm5sL0RvbVByaXZhdGVTZXJ2aWNlc0xhdGVzdENSTC1HMS5jcmwwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQCM9aEWB9EutS4/TKJ0hSrJljJSt0sAFxkoi6upCv7+C9Pjp+R5woGAwiBctbM5PyT+KpOKlDZKL3mrXSUc/71qNxsPlZR703c+HhlkvDCHbk9afrAXWtXz0sKVs8KaNS2W4k7O8xGNZVMjMwpanQdBcsTnFPu12OTj8BCv4aOFxIYnPqPHkl8VTAi2pTArCtTQk9vi6QaXPzSmfi/rDINCJUAOnA3BEeZZI+BD8yCzE2x9M1N0AIn3UZRfVMfLJdI68a67lt3fLh2ZbLcjE0Pi4arBqxzFyKa1LyVsnA1Yg5UCZQh8U9l+5DS5dNS9lDVSBcd9iUio+lg8LvAQ7biz+FFiLSqxVcWDuUg079d8JjPakm4JllmORlnSfWlcTHmgKmQOR0TgtXUL/7EDW2qbmRb5hUttT6ixBKnjtllnXmpOkx8hZn0F0hqjnIUsw8E0SdpYlrvIKszmowoKtZpszL/REVZybhfki5zj22GBMNBBP5MWTkltAZ8x2qu8iUw7MAUkBJy14cWmbqxue95JtT3a2/BnSMofYQNALQM4Ay9iZZyCUJIF/EYxg1OXmv65UthXpc4DdApICObyxY+/OABPJWHtxuG27SmMBx/MT3ZEs6vswVqGIsbPZydVSqerDskkP1AOl4iFEwmGOtfLB+VGn3werrg7IVfbCWEqdA== - + MIIFhDCCA2ygAwIBAgIEAJimITANBgkqhkiG9w0BAQsFADBiMQswCQYDVQQGEwJOTDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTMwMQYDVQQDDCpTdGFhdCBkZXIgTmVkZXJsYW5kZW4gUHJpdmF0ZSBSb290IENBIC0gRzEwHhcNMTMxMTE0MTM0ODU1WhcNMjgxMTEzMjMwMDAwWjBiMQswCQYDVQQGEwJOTDEeMBwGA1UECgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMTMwMQYDVQQDDCpTdGFhdCBkZXIgTmVkZXJsYW5kZW4gUHJpdmF0ZSBSb290IENBIC0gRzEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDaIMh56ynwnEhE7Ey54KpX5j1XDoxbHDCgXctute55RjmG2hy6fuq++q/dCSsj38Pi/KYn/PN13EF05k39IRvakb0AQNVyHifNKXfta6Tzi5QcM4BK09DB4Ckb6TdZTNUtWyEcAtRblYaVSQ4Xr5QODNqu2FGQucraVXqCIx81azlOE2JbZli9AZKn94pP57A11dUYhxMsh70YosJEKVB8Ue4ROksHhb/nnOISG+2y9FD5M8u8jYhp00TGZGVu5z0IFgtqX0i8GmrH0ub9AWjf/iU4MWjGVRSq0cwUHEeKRj/UD9a8xIEn9TxIfYj+6+s4tn9dW/4PV5jc6iGJx6ExTPfOR7VHpxS4XujrZb5Ba/+oj/ONdOfR0JSm2itCytbtjQBBL0oocIIqaqOna1cufHkcn9VleF7Zvz/8njQIpAU4J4nJ4pE5pQ3k4ORAGNnq5R9hAqqUQGDlo3Uj8PBou0nPzQ7JNgGkN+my/lGr4rceUNK/8CoGnYFUH+UyFtJkvlLlEkb688/IdNdGgY+vuXCAB6xfKlJjAGChFUBb6swbNeNctVEdUj7Weg4Jt5gXu78C2mjs9x5lcHOgMO4ZmvYJ3Ejp4k3nNa45HOIVkYrfQrrBHzBhR0BuReAagurcbtUjJFd7BtufGVLfU3CUn1l6u3/9eG4DGH6pq+dSKQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUKv25Kx76w4SHBtuB/4aXdQ3rAYswDQYJKoZIhvcNAQELBQADggIBAEvpmXMOOKdQwUPysrsdIkGJUFF+dvmsJDiOuAqV0A1nNTooL3esvDLEZAWZwKTOwRomnHzeCfS/QxRKTkVX21pfrHf9ufDKykpzjl9uAILTS76FJ6//R0RTIPMrzknQpG2fCLR5DFEbHWU/jWAxGmncfx6HQYl/azHaWbv0dhZOUjPdkGAQ6EPvHcyNU9yMkETdw0X6ioxqzMwkGM893oBrMmtduiqIf3/H6HTXoRKAc+/DXZIq/pAc6eVMa6x43kokluaam9L78yDrlHbGd2VYAr/HZ0TjDZTtI2t2/ySTb7JjC8wL8rSqxYmLpNrnhZzPW87sl2OCFC3re3ZhtJkIHNP85jj1gqewTC7DCW6llZdB3hBzfHWby0EX2RlcwgaMfNBEV5U0IogccdXV+S6zWK4F+yBr0sXUrdbdMFu+g3I9CbXxt0q4eVJtoaun4M2Z+bZMqZvy9FryBdSfhpgmJqwFz2luOhPOVCblCPhLrUeewrvuBXoZQWt1ZjuHfwJZ1dgjszVEqwY9S0SdqCg2ZlL9s3vDIrrd3wLWrcHLQMd9gwsppNv9c7JfIJdlcZLTmF9EuL6eCvVVrqBVqLHjva4erqYol6K/jbSfUtRCy8IlFU7LYu1KLehZKYvj3vekj3Cn08Aqljr/Q8Pw+OfUZTzKg4PVDQVfFqKtyosv From e38af41ce7895ea9c5f53f883ada87832e2cc9b3 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 18 Nov 2025 23:00:24 +0100 Subject: [PATCH 31/34] Properly normalize documents --- composer.json | 10 +++++----- tests/SAML2/XML/md/EntityDescriptorTest.php | 6 +++--- tests/SAML2/XML/md/KeyDescriptorTest.php | 8 ++++---- tests/SAML2/XML/saml/AssertionTest.php | 4 +++- tests/SAML2/XML/saml/AttributeValueTest.php | 18 +++++++---------- tests/resources/xml/alg_DigestMethod.xml | 4 ++-- tests/resources/xml/alg_SigningMethod.xml | 4 ++-- tests/resources/xml/ecp_Request.xml | 6 +++--- .../resources/xml/ecp_SubjectConfirmation.xml | 6 +++--- .../xml/idpdisc_DiscoveryResponse.xml | 4 ++-- tests/resources/xml/init_RequestInitiator.xml | 4 ++-- .../xml/md_AffiliationDescriptor.xml | 4 ++-- .../xml/md_ArtifactResolutionService.xml | 4 ++-- .../xml/md_AssertionConsumerService.xml | 4 ++-- .../xml/md_AttributeAuthorityDescriptor.xml | 6 +++--- .../xml/md_AttributeConsumingService.xml | 4 ++-- tests/resources/xml/md_AttributeService.xml | 4 ++-- tests/resources/xml/md_ContactPerson.xml | 4 ++-- tests/resources/xml/md_EncryptionMethod.xml | 8 ++++---- tests/resources/xml/md_EntitiesDescriptor.xml | 10 +++++----- tests/resources/xml/md_EntityDescriptor.xml | 2 +- tests/resources/xml/md_Extensions.xml | 20 +++++++++---------- tests/resources/xml/md_IDPSSODescriptor.xml | 8 ++++---- tests/resources/xml/md_KeyDescriptor.xml | 4 ++-- tests/resources/xml/md_Organization.xml | 4 ++-- tests/resources/xml/md_RequestedAttribute.xml | 4 ++-- tests/resources/xml/md_RoleDescriptor.xml | 8 ++++---- tests/resources/xml/md_SPSSODescriptor.xml | 10 +++++----- .../resources/xml/mdattr_EntityAttributes.xml | 6 +++--- tests/resources/xml/mdui_UIInfo.xml | 6 +++--- tests/resources/xml/saml_Advice.xml | 10 +++++----- tests/resources/xml/saml_Assertion.xml | 8 ++++---- tests/resources/xml/saml_Attribute.xml | 8 ++++---- .../resources/xml/saml_AttributeStatement.xml | 8 ++++---- .../saml_AuthnContextWithClassRefAndDecl.xml | 4 ++-- .../xml/saml_AuthnContextWithDecl.xml | 4 ++-- .../xml/saml_AuthzDecisionStatement.xml | 8 ++++---- .../resources/xml/saml_EncryptedAssertion.xml | 10 +++++----- .../resources/xml/saml_EncryptedAttribute.xml | 8 ++++---- 39 files changed, 130 insertions(+), 132 deletions(-) diff --git a/composer.json b/composer.json index f5ff05e924..088b7a88fb 100644 --- a/composer.json +++ b/composer.json @@ -31,16 +31,16 @@ "psr/http-message": "~2.0", "psr/log": "~2.3 || ~3.0", "simplesamlphp/assert": "~1.9", - "simplesamlphp/xml-common": "~2.2", + "simplesamlphp/xml-common": "~2.3", "simplesamlphp/xml-security": "~2.0", "simplesamlphp/xml-soap": "~2.0" }, "require-dev": { "ext-intl": "*", - "beste/clock": "~3.0.0", - "mockery/mockery": "~1.6.12", - "simplesamlphp/simplesamlphp-test-framework": "~1.10.2" + "beste/clock": "~3.0", + "mockery/mockery": "~1.6", + "simplesamlphp/simplesamlphp-test-framework": "~1.10" }, "suggest": { "ext-soap": "*" @@ -58,7 +58,7 @@ }, "extra": { "branch-alias": { - "dev-master": "v6.0.x-dev" + "dev-master": "v5.1.x-dev" } }, "config": { diff --git a/tests/SAML2/XML/md/EntityDescriptorTest.php b/tests/SAML2/XML/md/EntityDescriptorTest.php index de1d121637..c52c771040 100644 --- a/tests/SAML2/XML/md/EntityDescriptorTest.php +++ b/tests/SAML2/XML/md/EntityDescriptorTest.php @@ -235,16 +235,16 @@ public function testMarshalling(): void public function testMarshallingWithAffiliationDescriptor(): void { $ns_md = C::NS_MD; + $ns_mdrpi = C::NS_MDRPI; $entity_idp = C::ENTITY_IDP; $entity_other = C::ENTITY_OTHER; $document = DOMDocumentFactory::fromString( << - + http://publisher.ra/policy.txt diff --git a/tests/SAML2/XML/md/KeyDescriptorTest.php b/tests/SAML2/XML/md/KeyDescriptorTest.php index c52db1efa9..f333f01dfc 100644 --- a/tests/SAML2/XML/md/KeyDescriptorTest.php +++ b/tests/SAML2/XML/md/KeyDescriptorTest.php @@ -97,8 +97,8 @@ public function testMarshallingWithoutOptionalParameters(): void $this->assertEquals( << - + + IdentityProvider.com SSO Key @@ -134,8 +134,8 @@ public function testUnmarshallingWithoutOptionalParameters(): void { $document = DOMDocumentFactory::fromString( << - + + IdentityProvider.com SSO Key diff --git a/tests/SAML2/XML/saml/AssertionTest.php b/tests/SAML2/XML/saml/AssertionTest.php index d650b15269..21b665ef16 100644 --- a/tests/SAML2/XML/saml/AssertionTest.php +++ b/tests/SAML2/XML/saml/AssertionTest.php @@ -1182,7 +1182,9 @@ public function testNameIdEncryption(): void $identifier = $assertionToVerify->getSubject()?->getIdentifier(); $this->assertInstanceOf(EncryptedID::class, $identifier); - +//var_dump( $identifier->getEncryptedData()->getKeyInfo()->getInfo() ); +// This contains a Chunk instead of an EncryptedKey-object +// ToDo: figure out why $decryptor = (new KeyTransportAlgorithmFactory())->getAlgorithm( $identifier->getEncryptedKeys()[0]->getEncryptionMethod()?->getAlgorithm()->getValue(), PEMCertificatesMock::getPrivateKey(PEMCertificatesMock::PRIVATE_KEY), diff --git a/tests/SAML2/XML/saml/AttributeValueTest.php b/tests/SAML2/XML/saml/AttributeValueTest.php index 777a7e39ad..17337852fb 100644 --- a/tests/SAML2/XML/saml/AttributeValueTest.php +++ b/tests/SAML2/XML/saml/AttributeValueTest.php @@ -149,17 +149,13 @@ public function testMarshallingNull(): void /** * Verifies that supplying an empty string as attribute value will * generate a tag with no content (instead of e.g. an empty tag). - * */ public function testEmptyStringAttribute(): void { $av = new AttributeValue(''); $xmlRepresentation = clone self::$xmlRepresentation; $xmlRepresentation->documentElement->textContent = ''; -// $this->assertEqualXMLStructure( -// $this->xmlRepresentation->documentElement, -// $av->toXML(), -// ); + $this->assertEquals('', $av->getValue()); $this->assertEquals('xs:string', $av->getXsiType()); } @@ -203,22 +199,22 @@ public function testSerializeEncryptedID(): void { $document = DOMDocumentFactory::fromString( << + - + - + vErnRkA0oSmtQGamjZGa9RFN25SUx1UVLsLAOtopt7pyywTD7wu9pyocfD4HqduXCsvaiZpJykz11utZdvtJ0sOdm9oE+lAtNTUnKzGSNoSopGCzwNu5pqwhIEvWEWeilmJayAC2elpRYOnUs/rePxibz0Wbqa7BItLt6ZkKTtMkv0U0PpgGenF1pWzsahRtw6Y5tFq7xFQkG/z0Lz5rJ+IxExYXgB3LN6FBmVcB1ioahk2ovOwbLQ+lNAdqUMhpZx6fgdL2v7g4OYPK0rDgSALU3gU3dvU4hC/Kk9N5Rkw= - + - + - + _b420654655d491b49555c698f80efb7bda3ac6ef diff --git a/tests/resources/xml/alg_DigestMethod.xml b/tests/resources/xml/alg_DigestMethod.xml index 79d8216296..dadda9a23b 100644 --- a/tests/resources/xml/alg_DigestMethod.xml +++ b/tests/resources/xml/alg_DigestMethod.xml @@ -1,3 +1,3 @@ - - Some + + Some diff --git a/tests/resources/xml/alg_SigningMethod.xml b/tests/resources/xml/alg_SigningMethod.xml index 4843744609..99370b9e29 100644 --- a/tests/resources/xml/alg_SigningMethod.xml +++ b/tests/resources/xml/alg_SigningMethod.xml @@ -1,3 +1,3 @@ - - Some + + Some diff --git a/tests/resources/xml/ecp_Request.xml b/tests/resources/xml/ecp_Request.xml index 79d5ff7777..ad6d79f452 100644 --- a/tests/resources/xml/ecp_Request.xml +++ b/tests/resources/xml/ecp_Request.xml @@ -1,6 +1,6 @@ - - urn:x-simplesamlphp:issuer - + + urn:x-simplesamlphp:issuer + https://some/location diff --git a/tests/resources/xml/ecp_SubjectConfirmation.xml b/tests/resources/xml/ecp_SubjectConfirmation.xml index 2ff0bb24b6..2fd654bb2b 100644 --- a/tests/resources/xml/ecp_SubjectConfirmation.xml +++ b/tests/resources/xml/ecp_SubjectConfirmation.xml @@ -1,6 +1,6 @@ - - - + + + SomeKey Arbitrary Element diff --git a/tests/resources/xml/idpdisc_DiscoveryResponse.xml b/tests/resources/xml/idpdisc_DiscoveryResponse.xml index 7c71dd9c94..643c30045a 100644 --- a/tests/resources/xml/idpdisc_DiscoveryResponse.xml +++ b/tests/resources/xml/idpdisc_DiscoveryResponse.xml @@ -1,3 +1,3 @@ - - SomeExtension + + SomeExtension diff --git a/tests/resources/xml/init_RequestInitiator.xml b/tests/resources/xml/init_RequestInitiator.xml index ec1ab87944..c8751ae79c 100644 --- a/tests/resources/xml/init_RequestInitiator.xml +++ b/tests/resources/xml/init_RequestInitiator.xml @@ -1,3 +1,3 @@ - - SomeExtension + + SomeExtension diff --git a/tests/resources/xml/md_AffiliationDescriptor.xml b/tests/resources/xml/md_AffiliationDescriptor.xml index f25e01a6bf..e8c9e4fb73 100644 --- a/tests/resources/xml/md_AffiliationDescriptor.xml +++ b/tests/resources/xml/md_AffiliationDescriptor.xml @@ -1,8 +1,8 @@ - + https://simplesamlphp.org/sp/metadata https://example.org/metadata - + IdentityProvider.com SSO Key diff --git a/tests/resources/xml/md_ArtifactResolutionService.xml b/tests/resources/xml/md_ArtifactResolutionService.xml index 37b4dbad17..b0e8b7eabb 100644 --- a/tests/resources/xml/md_ArtifactResolutionService.xml +++ b/tests/resources/xml/md_ArtifactResolutionService.xml @@ -1,3 +1,3 @@ - - SomeExtension + + SomeExtension diff --git a/tests/resources/xml/md_AssertionConsumerService.xml b/tests/resources/xml/md_AssertionConsumerService.xml index b0551bf003..04c9dc5b37 100644 --- a/tests/resources/xml/md_AssertionConsumerService.xml +++ b/tests/resources/xml/md_AssertionConsumerService.xml @@ -1,3 +1,3 @@ - - SomeExtension + + SomeExtension diff --git a/tests/resources/xml/md_AttributeAuthorityDescriptor.xml b/tests/resources/xml/md_AttributeAuthorityDescriptor.xml index a8e3538736..4fb4857b8e 100644 --- a/tests/resources/xml/md_AttributeAuthorityDescriptor.xml +++ b/tests/resources/xml/md_AttributeAuthorityDescriptor.xml @@ -1,4 +1,4 @@ - + urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName @@ -6,8 +6,8 @@ urn:oasis:names:tc:SAML:2.0:nameid-format:transient urn:x-simplesamlphp:profile:one urn:x-simplesamlphp:profile:two - - + + member student faculty diff --git a/tests/resources/xml/md_AttributeConsumingService.xml b/tests/resources/xml/md_AttributeConsumingService.xml index d5a8fbfaa7..ec7a09cc54 100644 --- a/tests/resources/xml/md_AttributeConsumingService.xml +++ b/tests/resources/xml/md_AttributeConsumingService.xml @@ -1,7 +1,7 @@ - + Academic Journals R US Academic Journals R US and only us - https://ServiceProvider.com/entitlements/123456789 + https://ServiceProvider.com/entitlements/123456789 diff --git a/tests/resources/xml/md_AttributeService.xml b/tests/resources/xml/md_AttributeService.xml index a6851c5ec5..e7a2282e69 100644 --- a/tests/resources/xml/md_AttributeService.xml +++ b/tests/resources/xml/md_AttributeService.xml @@ -1,3 +1,3 @@ - - Some + + Some diff --git a/tests/resources/xml/md_ContactPerson.xml b/tests/resources/xml/md_ContactPerson.xml index ec65779169..a541ac0182 100644 --- a/tests/resources/xml/md_ContactPerson.xml +++ b/tests/resources/xml/md_ContactPerson.xml @@ -1,6 +1,6 @@ - + - SomeExtension + SomeExtension Test Company John diff --git a/tests/resources/xml/md_EncryptionMethod.xml b/tests/resources/xml/md_EncryptionMethod.xml index 8cfc490774..460b1eb5ab 100644 --- a/tests/resources/xml/md_EncryptionMethod.xml +++ b/tests/resources/xml/md_EncryptionMethod.xml @@ -1,5 +1,5 @@ - - 10 - 9lWu3Q== - Value + + 10 + 9lWu3Q== + Value diff --git a/tests/resources/xml/md_EntitiesDescriptor.xml b/tests/resources/xml/md_EntitiesDescriptor.xml index 739531bd98..ff2e9a5e10 100644 --- a/tests/resources/xml/md_EntitiesDescriptor.xml +++ b/tests/resources/xml/md_EntitiesDescriptor.xml @@ -1,6 +1,6 @@ - + - + http://publisher.ra/policy.txt @@ -19,7 +19,7 @@ - + IdentityProvider.com SSO Key @@ -30,8 +30,8 @@ urn:oasis:names:tc:SAML:2.0:nameid-format:transient - - + + member student faculty diff --git a/tests/resources/xml/md_EntityDescriptor.xml b/tests/resources/xml/md_EntityDescriptor.xml index 5e70b5ea62..2049a2743e 100644 --- a/tests/resources/xml/md_EntityDescriptor.xml +++ b/tests/resources/xml/md_EntityDescriptor.xml @@ -1,6 +1,6 @@ - + http://publisher.ra/policy.txt diff --git a/tests/resources/xml/md_Extensions.xml b/tests/resources/xml/md_Extensions.xml index 881a2ce3e0..7086d4d8b4 100644 --- a/tests/resources/xml/md_Extensions.xml +++ b/tests/resources/xml/md_Extensions.xml @@ -1,20 +1,20 @@ - - SomeScope - - - + + SomeScope + + + - + Example - + 127.0.0.0/8 - + - - + + http://edugain.org/ diff --git a/tests/resources/xml/md_IDPSSODescriptor.xml b/tests/resources/xml/md_IDPSSODescriptor.xml index 2f2338d91e..73d13f3bc5 100644 --- a/tests/resources/xml/md_IDPSSODescriptor.xml +++ b/tests/resources/xml/md_IDPSSODescriptor.xml @@ -1,6 +1,6 @@ - + - + IdentityProvider.com SSO Key @@ -19,8 +19,8 @@ urn:attribute:profile1 urn:attribute:profile2 - - + + member student faculty diff --git a/tests/resources/xml/md_KeyDescriptor.xml b/tests/resources/xml/md_KeyDescriptor.xml index 4f1f72cdcf..ebf656596b 100644 --- a/tests/resources/xml/md_KeyDescriptor.xml +++ b/tests/resources/xml/md_KeyDescriptor.xml @@ -1,5 +1,5 @@ - - + + IdentityProvider.com SSO Key diff --git a/tests/resources/xml/md_Organization.xml b/tests/resources/xml/md_Organization.xml index eee992c914..0a83838fb7 100644 --- a/tests/resources/xml/md_Organization.xml +++ b/tests/resources/xml/md_Organization.xml @@ -1,6 +1,6 @@ - + - SomeExtension + SomeExtension Identity Providers R US Identity Providers R US, a Division of Lerxst Corp. diff --git a/tests/resources/xml/md_RequestedAttribute.xml b/tests/resources/xml/md_RequestedAttribute.xml index 2cc410a3d2..fbbf95ecb4 100644 --- a/tests/resources/xml/md_RequestedAttribute.xml +++ b/tests/resources/xml/md_RequestedAttribute.xml @@ -1,3 +1,3 @@ - - value1 + + value1 diff --git a/tests/resources/xml/md_RoleDescriptor.xml b/tests/resources/xml/md_RoleDescriptor.xml index fe6048a5b7..2963a09817 100644 --- a/tests/resources/xml/md_RoleDescriptor.xml +++ b/tests/resources/xml/md_RoleDescriptor.xml @@ -1,14 +1,14 @@ - + Some - + IdentityProvider.com SSO Signing Key - + IdentityProvider.com SSO Encryption Key @@ -18,7 +18,7 @@ Identity Providers R US, a Division of Lerxst Corp. https://IdentityProvider.com - + Test Company John Doe diff --git a/tests/resources/xml/md_SPSSODescriptor.xml b/tests/resources/xml/md_SPSSODescriptor.xml index 81d09f4bbb..cc341af21c 100644 --- a/tests/resources/xml/md_SPSSODescriptor.xml +++ b/tests/resources/xml/md_SPSSODescriptor.xml @@ -1,11 +1,11 @@ - + - + http://publisher.ra/policy.txt - + ServiceProvider.com SSO Key @@ -27,13 +27,13 @@ Academic Journals R US - https://ServiceProvider.com/entitlements/123456789 + https://ServiceProvider.com/entitlements/123456789 Academic Journals R US - https://ServiceProvider.com/entitlements/123456789 + https://ServiceProvider.com/entitlements/123456789 diff --git a/tests/resources/xml/mdattr_EntityAttributes.xml b/tests/resources/xml/mdattr_EntityAttributes.xml index 10a46f5495..5f7ec2d896 100644 --- a/tests/resources/xml/mdattr_EntityAttributes.xml +++ b/tests/resources/xml/mdattr_EntityAttributes.xml @@ -1,10 +1,10 @@ - - + + is really cool - + urn:x-simplesamlphp:issuer diff --git a/tests/resources/xml/mdui_UIInfo.xml b/tests/resources/xml/mdui_UIInfo.xml index bc77554f81..9c90fe3d34 100644 --- a/tests/resources/xml/mdui_UIInfo.xml +++ b/tests/resources/xml/mdui_UIInfo.xml @@ -1,4 +1,4 @@ - + University of Examples Univërsitä øf Exåmpleß Just an example @@ -8,6 +8,6 @@ University Fictional Université Fictif https://example.org/idp/images/logo_87x88.png - - + + diff --git a/tests/resources/xml/saml_Advice.xml b/tests/resources/xml/saml_Advice.xml index 5e555e616c..739d628866 100644 --- a/tests/resources/xml/saml_Advice.xml +++ b/tests/resources/xml/saml_Advice.xml @@ -1,4 +1,4 @@ - + _Test urn:x-simplesamlphp:reference @@ -23,15 +23,15 @@ - 1 + 1 - 1 + 1 - 1 + 1 - Value + Value diff --git a/tests/resources/xml/saml_Assertion.xml b/tests/resources/xml/saml_Assertion.xml index 0f37ccf400..09bacd9f6d 100644 --- a/tests/resources/xml/saml_Assertion.xml +++ b/tests/resources/xml/saml_Assertion.xml @@ -1,4 +1,4 @@ - + urn:x-simplesamlphp:issuer SomeNameIDValue @@ -20,13 +20,13 @@ - 1 + 1 - 1 + 1 - 1 + 1 diff --git a/tests/resources/xml/saml_Attribute.xml b/tests/resources/xml/saml_Attribute.xml index 0731d136a3..24a90ee6c1 100644 --- a/tests/resources/xml/saml_Attribute.xml +++ b/tests/resources/xml/saml_Attribute.xml @@ -1,7 +1,7 @@ - + FirstValue SecondValue - 3 - 2024-04-04T04:44:44Z - + 3 + 2024-04-04T04:44:44Z + diff --git a/tests/resources/xml/saml_AttributeStatement.xml b/tests/resources/xml/saml_AttributeStatement.xml index 30dae3999a..070edbbbf7 100644 --- a/tests/resources/xml/saml_AttributeStatement.xml +++ b/tests/resources/xml/saml_AttributeStatement.xml @@ -1,11 +1,11 @@ - + - 1 + 1 - 1 + 1 - 1 + 1 diff --git a/tests/resources/xml/saml_AuthnContextWithClassRefAndDecl.xml b/tests/resources/xml/saml_AuthnContextWithClassRefAndDecl.xml index e22eae2398..56e11797ed 100644 --- a/tests/resources/xml/saml_AuthnContextWithClassRefAndDecl.xml +++ b/tests/resources/xml/saml_AuthnContextWithClassRefAndDecl.xml @@ -1,6 +1,6 @@ - + urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport - + diff --git a/tests/resources/xml/saml_AuthnContextWithDecl.xml b/tests/resources/xml/saml_AuthnContextWithDecl.xml index 42a34fd031..984ed7fd23 100644 --- a/tests/resources/xml/saml_AuthnContextWithDecl.xml +++ b/tests/resources/xml/saml_AuthnContextWithDecl.xml @@ -1,5 +1,5 @@ - - + + diff --git a/tests/resources/xml/saml_AuthzDecisionStatement.xml b/tests/resources/xml/saml_AuthzDecisionStatement.xml index 677567f885..4f13a8f1fd 100644 --- a/tests/resources/xml/saml_AuthzDecisionStatement.xml +++ b/tests/resources/xml/saml_AuthzDecisionStatement.xml @@ -1,4 +1,4 @@ - + SomeAction OtherAction @@ -26,13 +26,13 @@ - 1 + 1 - 1 + 1 - 1 + 1 diff --git a/tests/resources/xml/saml_EncryptedAssertion.xml b/tests/resources/xml/saml_EncryptedAssertion.xml index eaa7c7d882..474ecb67f5 100644 --- a/tests/resources/xml/saml_EncryptedAssertion.xml +++ b/tests/resources/xml/saml_EncryptedAssertion.xml @@ -1,11 +1,11 @@ - - + + - + - self::xenc:CipherValue[@Id="example1"] + self::xenc:CipherValue[@Id="example1"] @@ -20,7 +20,7 @@ mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5 - + sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU= diff --git a/tests/resources/xml/saml_EncryptedAttribute.xml b/tests/resources/xml/saml_EncryptedAttribute.xml index 9832ff775a..a6cd45e552 100644 --- a/tests/resources/xml/saml_EncryptedAttribute.xml +++ b/tests/resources/xml/saml_EncryptedAttribute.xml @@ -1,7 +1,7 @@ - - + + - + @@ -13,7 +13,7 @@ 1XgQwRaembYBgx/L+EtbKy8L/C09Jyp6RMPkuMNddV6PP2+ZeX+brAftzEB1j9BbjqmSHIQU85E6Up37Naeh1VNn6KTyv1r4S1oa8AJu6P4++MdRGkifWUhgqsfLdUZFiMAF5tnLor4dU/Iqr3+iWYUIbsCUkZh2uSfuYqCsVgZlJsXY2tlDgdMtbWTMGWl+Z6oP0Y83+ygo8k05uVkhYctbAThfi7daSclsna5F4PzIycdtowyzpmjVrO5t3qmUzPOiljJx1sMJFOdDcbM= - + OrBjuSpU4nnUeh4p3iBW82E0W7xVQEdELUi+PpHkpH6LcPQJBj4sLOSuzBNTmbo4cGouP3H5oyBcbILKFA2fYEAc8r17WHFD5NbWjTesWJWoH2E2vYmIdqi31109tiI55mDNGbWm02YHbz3opgmyZB6ABoj/1vHshZaWtDlDIbY= From 90f3fb455dc9113292ecb6a9325b03f6a3a9c4b6 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 18 Nov 2025 23:29:22 +0100 Subject: [PATCH 32/34] Fix code quality --- phpstan-baseline-dev.neon | 120 ++++++++++++++++-- phpstan-baseline.neon | 120 ------------------ phpstan-dev.neon | 4 +- phpstan.neon | 4 +- src/XML/EncryptedElementTrait.php | 2 +- .../Response/XmlSignatureWrappingTest.php | 10 +- tests/SAML2/Type/AnyURIListValueTest.php | 4 +- tests/SAML2/XML/md/RequestedAttributeTest.php | 1 - tests/SAML2/XML/saml/AdviceTest.php | 1 - tests/SAML2/XML/saml/EvidenceTest.php | 6 +- tests/SAML2/XML/saml/SubjectTest.php | 3 +- 11 files changed, 129 insertions(+), 146 deletions(-) diff --git a/phpstan-baseline-dev.neon b/phpstan-baseline-dev.neon index 6b92118ee0..c73bcfb016 100644 --- a/phpstan-baseline-dev.neon +++ b/phpstan-baseline-dev.neon @@ -6,6 +6,12 @@ parameters: count: 1 path: tests/InterOperability/EntityDescriptorTest.php + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\Utilities\\\\ArrayCollection'' and SimpleSAML\\SAML2\\Utilities\\ArrayCollection will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: tests/SAML2/Assertion/ProcessorTest.php + - message: '#^PHPDoc tag @var for property SimpleSAML\\Test\\SAML2\\Assertion\\Transformer\\NameIdDecryptionTransformerTest\:\:\$validator with type SimpleSAML\\SAML2\\Response\\Validation\\Validator is incompatible with native type SimpleSAML\\SAML2\\Signature\\Validator\.$#' identifier: property.phpDocType @@ -36,12 +42,24 @@ parameters: count: 1 path: tests/SAML2/Assertion/Validation/AssertionValidatorTest.php + - + message: '#^Missing call to parent\:\:setUp\(\) method\.$#' + identifier: phpunit.callParent + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + - message: '#^Parameter \#1 \$serviceProvider of method SimpleSAML\\SAML2\\Assertion\\Validation\\ConstraintValidator\\SpIsValidAudience\:\:setServiceProvider\(\) expects SimpleSAML\\SAML2\\Configuration\\ServiceProvider, Mockery\\MockInterface given\.$#' identifier: argument.type count: 3 path: tests/SAML2/Assertion/Validation/ConstraintValidator/SpIsValidAudienceTest.php + - + message: '#^Missing call to parent\:\:setUp\(\) method\.$#' + identifier: phpunit.callParent + count: 1 + path: tests/SAML2/Assertion/Validation/ConstraintValidator/SubjectConfirmationResponseToMatchesTest.php + - message: '#^Parameter \#1 \$response of class SimpleSAML\\SAML2\\Assertion\\Validation\\ConstraintValidator\\SubjectConfirmationResponseToMatches constructor expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' identifier: argument.type @@ -66,18 +84,48 @@ parameters: count: 3 path: tests/SAML2/Certificate/KeyLoaderTest.php + - + message: '#^Missing call to parent\:\:setUp\(\) method\.$#' + identifier: phpunit.callParent + count: 1 + path: tests/SAML2/Certificate/KeyLoaderTest.php + - message: '#^Parameter \#1 \$config of method SimpleSAML\\SAML2\\Certificate\\KeyLoader\:\:loadKeysFromConfiguration\(\) expects SimpleSAML\\SAML2\\Configuration\\CertificateProvider, Mockery\\MockInterface given\.$#' identifier: argument.type count: 3 path: tests/SAML2/Certificate/KeyLoaderTest.php + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\XMLSecurity\\\\Key\\\\PrivateKey'' and SimpleSAML\\XMLSecurity\\Key\\PrivateKey will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/SAML2/Certificate/PrivateKeyLoaderTest.php + + - + message: '#^Missing call to parent\:\:setUp\(\) method\.$#' + identifier: phpunit.callParent + count: 1 + path: tests/SAML2/Response/SignatureValidationTest.php + + - + message: '#^Missing call to parent\:\:setUp\(\) method\.$#' + identifier: phpunit.callParent + count: 1 + path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php + - message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\DestinationMatches\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' identifier: argument.type count: 2 path: tests/SAML2/Response/Validation/ConstraintValidator/DestinationMatchesTest.php + - + message: '#^Missing call to parent\:\:setUp\(\) method\.$#' + identifier: phpunit.callParent + count: 1 + path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php + - message: '#^Parameter \#1 \$response of method SimpleSAML\\SAML2\\Response\\Validation\\ConstraintValidator\\IsSuccessful\:\:validate\(\) expects SimpleSAML\\SAML2\\XML\\samlp\\Response, Mockery\\MockInterface given\.$#' identifier: argument.type @@ -85,19 +133,73 @@ parameters: path: tests/SAML2/Response/Validation/ConstraintValidator/IsSuccessfulTest.php - - message: '#^Parameter \#1 \$xml of static method SimpleSAML\\SAML2\\XML\\saml\\Assertion\:\:fromXML\(\) expects DOMElement, DOMNode\|null given\.$#' - identifier: argument.type + message: '#^Missing call to parent\:\:setUp\(\) method\.$#' + identifier: phpunit.callParent + count: 1 + path: tests/SAML2/Signature/PublicKeyValidatorTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''ArrayIterator'' and ArrayIterator will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/SAML2/Utilities/ArrayCollectionTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\Utilities\\\\ArrayCollection'' and SimpleSAML\\SAML2\\Utilities\\ArrayCollection will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType count: 2 - path: tests/SAML2/Response/XmlSignatureWrappingTest.php + path: tests/SAML2/Utilities/ArrayCollectionTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AdditionalMetadataLocation'' and SimpleSAML\\SAML2\\XML\\md\\AdditionalMetadataLocation will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 2 + path: tests/SAML2/XML/md/EntityDescriptorTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\ContactPerson'' and SimpleSAML\\SAML2\\XML\\md\\ContactPerson will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 3 + path: tests/SAML2/XML/md/EntityDescriptorTest.php - - message: '#^Class SimpleSAML\\Test\\SAML2\\XML\\md\\AssertionFailedException not found\.$#' - identifier: class.notFound + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\SingleSignOnService'' and SimpleSAML\\SAML2\\XML\\md\\SingleSignOnService will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType count: 1 - path: tests/SAML2/XML/md/RequestedAttributeTest.php + path: tests/SAML2/XML/md/IDPSSODescriptorTest.php - - message: '#^Parameter \#1 \$exception of method PHPUnit\\Framework\\TestCase\:\:expectException\(\) expects class\-string\, string given\.$#' - identifier: argument.type + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\AbstractRoleDescriptor'' and SimpleSAML\\SAML2\\XML\\md\\AbstractRoleDescriptor will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\ContactPerson'' and SimpleSAML\\SAML2\\XML\\md\\ContactPerson will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 4 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\md\\\\KeyDescriptor'' and SimpleSAML\\SAML2\\XML\\md\\KeyDescriptor will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 4 + path: tests/SAML2/XML/md/RoleDescriptorTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\NameID'' and SimpleSAML\\SAML2\\XML\\saml\\NameID will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType + count: 1 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\SAML2\\\\XML\\\\saml\\\\NameID'' and array\ will always evaluate to false\.$#' + identifier: method.impossibleType + count: 4 + path: tests/SAML2/XML/saml/AssertionTest.php + + - + message: '#^Call to method PHPUnit\\Framework\\Assert\:\:assertInstanceOf\(\) with ''SimpleSAML\\\\Test\\\\SAML2\\\\CustomStatement'' and SimpleSAML\\Test\\SAML2\\CustomStatement will always evaluate to true\.$#' + identifier: method.alreadyNarrowedType count: 1 - path: tests/SAML2/XML/md/RequestedAttributeTest.php + path: tests/SAML2/XML/saml/StatementTest.php diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index d5b3371b7e..267c5d7fe2 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -72,108 +72,6 @@ parameters: count: 2 path: src/Binding/HTTPArtifact.php - - - message: '#^Call to an undefined method SimpleSAML\\XMLSecurity\\XML\\ds\\SignatureValue\:\:getContent\(\)\.$#' - identifier: method.notFound - count: 1 - path: src/Binding/HTTPRedirect.php - - - - message: '#^Access to constant RSA_1_5 on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' - identifier: class.notFound - count: 1 - path: src/Certificate/PrivateKeyLoader.php - - - - message: '#^Access to property \$passphrase on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' - identifier: class.notFound - count: 2 - path: src/Certificate/PrivateKeyLoader.php - - - - message: '#^Call to method loadKey\(\) on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' - identifier: class.notFound - count: 2 - path: src/Certificate/PrivateKeyLoader.php - - - - message: '#^Instantiated class SimpleSAML\\XMLSecurity\\XMLSecurityKey not found\.$#' - identifier: class.notFound - count: 2 - path: src/Certificate/PrivateKeyLoader.php - - - - message: '#^Method SimpleSAML\\SAML2\\Certificate\\PrivateKeyLoader\:\:convertPrivateKeyToRsaKey\(\) has invalid return type SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' - identifier: class.notFound - count: 2 - path: src/Certificate/PrivateKeyLoader.php - - - - message: '#^Call to method getArray\(\) on an unknown class SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Call to method getBoolean\(\) on an unknown class SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 2 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Call to method getString\(\) on an unknown class SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 10 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 1 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Call to method hasValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 7 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:convertToIdentityProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 2 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:convertToServiceProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 2 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForDecryptionProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 2 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForIdentityProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 2 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForServiceProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 2 - path: src/Configuration/SimpleSAMLConverter.php - - - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:pluckConfiguration\(\) has invalid type SimpleSAML\\Configuration\.$#' - identifier: class.notFound - count: 2 - path: src/Configuration/SimpleSAMLConverter.php - - message: '#^Access to property \$key on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' identifier: class.notFound @@ -300,30 +198,12 @@ parameters: count: 1 path: src/XML/md/Organization.php - - - message: '#^Call to an undefined method SimpleSAML\\XMLSchema\\Type\\Interface\\ValueTypeInterface\:\:toArray\(\)\.$#' - identifier: method.notFound - count: 1 - path: src/XML/mdui/Keywords.php - - message: '#^Unsafe usage of new static\(\)\.$#' identifier: new.static count: 1 path: src/XML/saml/Attribute.php - - - message: '#^Unsafe usage of new static\(\)\.$#' - identifier: new.static - count: 1 - path: src/XML/saml/EncryptedAttribute.php - - - - message: '#^Unsafe usage of new static\(\)\.$#' - identifier: new.static - count: 1 - path: src/XML/saml/EncryptedID.php - - message: '#^Unsafe usage of new static\(\)\.$#' identifier: new.static diff --git a/phpstan-dev.neon b/phpstan-dev.neon index 378f1ae63a..c839b6e78b 100644 --- a/phpstan-dev.neon +++ b/phpstan-dev.neon @@ -2,5 +2,5 @@ parameters: level: 5 paths: - tests -#includes: -# - phpstan-baseline-dev.neon +includes: + - phpstan-baseline-dev.neon diff --git a/phpstan.neon b/phpstan.neon index e15be8aaf8..de03d2c724 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,5 +2,5 @@ parameters: level: 2 paths: - src -#includes: -# - phpstan-baseline.neon +includes: + - phpstan-baseline.neon diff --git a/src/XML/EncryptedElementTrait.php b/src/XML/EncryptedElementTrait.php index a25d105873..edddeefb2f 100644 --- a/src/XML/EncryptedElementTrait.php +++ b/src/XML/EncryptedElementTrait.php @@ -31,7 +31,7 @@ trait EncryptedElementTrait * Constructor for encrypted elements. * * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedData $encryptedData The EncryptedData object. - * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey[] $encryptedKey The EncryptedKey objects. + * @param \SimpleSAML\XMLSecurity\XML\xenc\EncryptedKey[] $decryptionKeys The EncryptedKey objects. */ final public function __construct( protected EncryptedData $encryptedData, diff --git a/tests/SAML2/Response/XmlSignatureWrappingTest.php b/tests/SAML2/Response/XmlSignatureWrappingTest.php index f76c8881e3..ccf6a47767 100644 --- a/tests/SAML2/Response/XmlSignatureWrappingTest.php +++ b/tests/SAML2/Response/XmlSignatureWrappingTest.php @@ -66,8 +66,10 @@ public function testThatASignatureReferencingAnotherAssertionIsNotValid(): void */ private function getSignedAssertionWithSignatureThatReferencesAnotherAssertion(): Assertion { - $doc = DOMDocumentFactory::fromFile(__DIR__ . '/signedAssertionWithInvalidReferencedId.xml'); - return Assertion::fromXML($doc->firstChild); + $document = DOMDocumentFactory::fromFile(__DIR__ . '/signedAssertionWithInvalidReferencedId.xml'); + /** @var \DOMElement $element */ + $element = $document->firstChild; + return Assertion::fromXML($element); } @@ -77,6 +79,8 @@ private function getSignedAssertionWithSignatureThatReferencesAnotherAssertion() private function getSignedAssertionWithEmbeddedAssertionReferencedInSignature(): Assertion { $document = DOMDocumentFactory::fromFile(__DIR__ . '/signedAssertionReferencedEmbeddedAssertion.xml'); - return Assertion::fromXML($document->firstChild); + /** @var \DOMElement $element */ + $element = $document->firstChild; + return Assertion::fromXML($element); } } diff --git a/tests/SAML2/Type/AnyURIListValueTest.php b/tests/SAML2/Type/AnyURIListValueTest.php index 96a6dd6fec..e66553f048 100644 --- a/tests/SAML2/Type/AnyURIListValueTest.php +++ b/tests/SAML2/Type/AnyURIListValueTest.php @@ -31,7 +31,7 @@ public function testAnyURIList(bool $shouldPass, string $anyURIList): void try { AnyURIListValue::fromString($anyURIList); $this->assertTrue($shouldPass); - } catch (ProtocolViolationException|SchemaViolationException $e) { + } catch (ProtocolViolationException | SchemaViolationException $e) { $this->assertFalse($shouldPass); } } @@ -48,7 +48,7 @@ public function testToArray(): void /** - * @return array + * @return array */ public static function provideAnyURIList(): array { diff --git a/tests/SAML2/XML/md/RequestedAttributeTest.php b/tests/SAML2/XML/md/RequestedAttributeTest.php index 8f1e44057e..b555f75700 100644 --- a/tests/SAML2/XML/md/RequestedAttributeTest.php +++ b/tests/SAML2/XML/md/RequestedAttributeTest.php @@ -7,7 +7,6 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\Assert\AssertionFailedException; use SimpleSAML\SAML2\Constants as C; use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\Type\SAMLStringValue; diff --git a/tests/SAML2/XML/saml/AdviceTest.php b/tests/SAML2/XML/saml/AdviceTest.php index f1262e13ac..1bbc35098a 100644 --- a/tests/SAML2/XML/saml/AdviceTest.php +++ b/tests/SAML2/XML/saml/AdviceTest.php @@ -13,7 +13,6 @@ use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\AssertionIDRef; use SimpleSAML\SAML2\XML\saml\AssertionURIRef; -use SimpleSAML\SAML2\XML\saml\EncryptedAssertion; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; diff --git a/tests/SAML2/XML/saml/EvidenceTest.php b/tests/SAML2/XML/saml/EvidenceTest.php index 1df5a82cff..dda8fe75e3 100644 --- a/tests/SAML2/XML/saml/EvidenceTest.php +++ b/tests/SAML2/XML/saml/EvidenceTest.php @@ -8,7 +8,6 @@ use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\TestCase; -use SimpleSAML\SAML2\Type\SAMLAnyURIValue; use SimpleSAML\SAML2\XML\saml\AbstractSamlElement; use SimpleSAML\SAML2\XML\saml\Assertion; use SimpleSAML\SAML2\XML\saml\AssertionIDRef; @@ -21,9 +20,6 @@ use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; use SimpleSAML\XMLSchema\Type\AnyURIValue; use SimpleSAML\XMLSchema\Type\Base64BinaryValue; -use SimpleSAML\XMLSchema\Type\IDValue; -use SimpleSAML\XMLSecurity\Alg\KeyTransport\KeyTransportAlgorithmFactory; -use SimpleSAML\XMLSecurity\TestUtils\PEMCertificatesMock; use SimpleSAML\XMLSecurity\XML\ds\KeyInfo; use SimpleSAML\XMLSecurity\XML\xenc\CipherData; use SimpleSAML\XMLSecurity\XML\xenc\CipherValue; @@ -86,6 +82,7 @@ protected function setUp(): void $ek = new EncryptedKey( cipherData: new CipherData( new CipherValue( + // phpcs:ignore Generic.Files.LineLength Base64BinaryValue::fromString('sNLWjwyj/R0oPwSgNnqowahiOwM0YU3YaH3jsH0t2YUDcHkcgouvW5x6YbNdgvGq0ImsNrkjI//0hrL4HvrOX33+DkhCo2FX5+a7UCdftfBfSjvt0houF8z3Zq/XOm6HxBUbWt5MULYpMKMZ9iAY6+raydxk2tFWgnAyHaBfzvU='), ), ), @@ -97,6 +94,7 @@ protected function setUp(): void $ed = new EncryptedData( cipherData: new CipherData( new CipherValue( + // phpcs:ignore Generic.Files.LineLength Base64BinaryValue::fromString('mlo++g0c4lTsVbL7ArhQh5/xu6t9EuNoRZXF8dqYIq0hARzKiZC5OhTZtHpQlwVd5f4N/lDsur2hhFAu5dxGVdWF+xN4wGMVoQDcyqipwH00w4lO5GNPD16mb1I5l3v3LJf9jKm+090Mv54BPsSOhSYvPBGbv2Uj6LzRE6z0l9zTWtyj2Z7lShrOYR6ZgG254HoltAA6veBXROEdPBBax0ezvoKmOBUcN1RX15Bfj0fVOX1FzS27SX+GCWYgCr0xPnhNBxaMhvU/2ayW6S8A5HWHWb1K2h/VVx6eumXaKzUFoEO5MxfC3Kxni3R3jyaGXmAZ4LhzcpWxJvz9LCpq5+9ovjnRNhheMrtQr/eZ6kWQ12pzKlHCfuFESB0IK2V2NbBDSe6C4n6TAS9mia9tT7CaKsRhVKlNMfkMKC+B6AOkTvlt6Rma5iz/QKL0A7t4LufQ/17YSb3eNOesmV/l3T8bEFqTRHiO8CwiT28ctfDjd0OKB4q1gh0PSidZL/yuaFTG/WXDpnpIV9qZELUgLVjFzW5+Rb/Alv2U7tE68c8oXv7xqmBUhkFQhYBy84cwHrCeKqn2iiJkh19aXYdgAZxys9Dp2+B2wX86coLU2CDJlyyCEohkXn5w8TkU0zNDZnh8J1oz5iawSx1d0aPy+uLNYVUMmx2hcrb3PlWdUApnyts38DcNwTkTy2/uxZmBU/4VGi3JzdnQ7KbW7EUXe3veExb63mRlU+cWl8LMRgP1FExg3CKT6HhW3roTu9GI51ofHpjPCPi41xQvoRrUo2VytBV/IZi4ArD4Y9d2tIcK2O0ZblUNjpRsNhPsVuCDLH23Fx42/5eGVkeTLPOt+Mr6IfY2d1NJGzqz9vJ4/h3L5PelDBQiD/o+5ZvgS5I5HL0bVbGXkT+v6k2GhHQDKNE3qJviXLRPjWv+Eaq+wJhukmcivA1z75/IydZhSPBZfhgORe6n5coiCf2mqiaZpI1YEZRR2g77NXf7I8qAuR7umkEpLC1ciLUpwZjaLNb7ojmC7cogXv8FmcWOk1xWdr7+kY3FXaWWwhUgxO4CSUYGdcOvydybcvAFTnf09+lR0RKVTGgnuukgYROyl8ulY2hoAFm+/jy9qcGqE/7JBlm6qx0B815TZY0aC3ulgwYDvUhdk9Sxq7Dp44h7BMBQezY2o4PBsY6nJNbCAkSULQ1rMY1nZViAAtZntTeHsnlFYm3pJo7MEhrGLYE/nSVcEHuP0z4WpwSb4CW2eOFBmrHcJfqBmDTnFtRwBQZfhQvcSyLy9Vyy//Hj7oDpC6GKmC3m9QTH+9T95sVxhHYkHN10YfHHQhn2pouNzo95QKVVtF98UGMEqrpIbtgGd+CE4icDjq8Qm8iQzJD/DB1YIjpwS0ftoD5+n/YlFYCbbOedN7uxsh9a3Q4NhbkYhNwYQN+/nkr90j6X9PS6uon04TS5GfxpX9gGczxMfeUKHh93in+UksVdzWqgrGxtdXGg7eataR2AcWoTIzsOTWC1sUIi/cOD1N2WR7dMBajNI1vZEsc2+DF3JgfYMigT0sa804LwZNeuopjcgP6qUxL+N+uFO+mobnMZAWK2zBmVwG60psV5zkOShGxq+l+AuobD0pKl0PH4qwhOIUbTc72F2snuKEAJvnpaW2kWymATnbuYsUrpUwoWUmAT4l9o6mD4XGAaYG6YUjD0JJDSJrHKgWy7j5Dqb6ocEMubzOAzpFT6H+BPd09ZraBDLELjX+yYow/adGsGw3sOwDZYfHwM+2f78j8xqCbWgaCME02umAfbkXGbIZ1l7cQv3w0QIDPKreePjI6vMHKJtSsOz9yMwb7RqMf53+m4e+HTlBZEV1m5Dd99qp3ESUYvUEg8rHmx+GeY1KyjZz14AXyxxvepQ4TZFPbROcNvL6EUm4gV7MV+MdkyRznA3nMro5vuGteuEAmqyFGuK/mmTGboA5FDBGnvRGzMt87eJtwWyeaPca7YZttaZJRv2Gbko9T7YNU9bdcJ41m9XC3BApUNQ3nQwWoallQrGX3r862to2Cl7z3MegrSt3GBDCI7RgmBPuEaVAFQQz0Rgr50zBtG834r7/RJ4gQtD0VksO1NoJoM/aifqWjKgRpawOnn2UkztqXEAkTwry04nNkMdLHCegDtl8cqdEAI5kzXMUf7fNxO19eOa+Yc4LYlNIPLOUIw3bGdCjZhhRuP9WR6UpQc69u6zK38e5Sxe+ff+XAdDB9OoH7We+9lRVvrmu4LbtbshctbX5Xz+sIq2xNmQy01xF3UHLUy3hQU1pglo9l5fLD5Nd/1xOs2hu9gaGJFI0efzJvNSHaPuXAvESvT5YBhONh6PfbjHEYuIYXL0ZVtF3cTpW29VXeyA8Uvx9PAxjSbyR/BlF1lTaCotAYCzI2keg6RTK3NCmo3co4t43hNemXPffCwykv4ShU8jdennk167W/6JTmTX7ppmseXimMP9DHnXZEomakUIZComiXxqlnTvw/Xdh9GGWA+6qgS5k68a3hdr2cD1gAKX1T53QCrXbNzpcZ9ab4CaCTv8iFtZaGXOBJjwOXAWZEf3k0I9XQZ3FCeg1Gqs8NgULwfWQTv78208kbsiLOGeu9mGEXgXNyK0yO/U4AWJb+HEfPpfeN3tpHFigzmALzt8RztCKcRv+gKm3RyVEW5'), ), ), diff --git a/tests/SAML2/XML/saml/SubjectTest.php b/tests/SAML2/XML/saml/SubjectTest.php index 315afe5b74..53fa0155e9 100644 --- a/tests/SAML2/XML/saml/SubjectTest.php +++ b/tests/SAML2/XML/saml/SubjectTest.php @@ -336,7 +336,8 @@ public function testMultipleIdentifiers(): void $document = DOMDocumentFactory::fromString( << + urn:some:audience From 792d9c90e1d4da8f5c9a1b0279d20c272f134a7f Mon Sep 17 00:00:00 2001 From: Ioannis Igoumenos <3846025+ioigoume@users.noreply.github.com> Date: Thu, 20 Nov 2025 12:34:50 +0200 Subject: [PATCH 33/34] Fix remaining tests.Added pre-commit commands in composer.json (#394) --- composer.json | 10 ++++++++++ tests/SAML2/XML/md/EntityDescriptorTest.php | 11 +++++++++-- tests/SAML2/XML/saml/SubjectTest.php | 7 ++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 088b7a88fb..327164cfc0 100644 --- a/composer.json +++ b/composer.json @@ -69,5 +69,15 @@ "phpstan/extension-installer": true, "simplesamlphp/composer-xmlprovider-installer": true } + }, + "scripts": { + "pre-commit": [ + "vendor/bin/phpcs -p", + "vendor/bin/composer-require-checker check --config-file=tools/composer-require-checker.json composer.json", + "vendor/bin/phpstan analyze -c phpstan.neon", + "vendor/bin/phpstan analyze -c phpstan-dev.neon", + "vendor/bin/composer-unused", + "vendor/bin/phpunit --no-coverage --testdox" + ] } } diff --git a/tests/SAML2/XML/md/EntityDescriptorTest.php b/tests/SAML2/XML/md/EntityDescriptorTest.php index c52c771040..1f8b68c4ac 100644 --- a/tests/SAML2/XML/md/EntityDescriptorTest.php +++ b/tests/SAML2/XML/md/EntityDescriptorTest.php @@ -494,10 +494,17 @@ public function testUnmarshalling(): void $entityDescriptor->getAdditionalMetadataLocation()[1], ); - $this->assertEquals( + // Normalize both documents before comparing + $expectedDoc = DOMDocumentFactory::fromString( $xmlRepresentation->saveXML($xmlRepresentation->documentElement), - strval($entityDescriptor), ); + $expected = DOMDocumentFactory::normalizeDocument($expectedDoc); + + $actualDoc = DOMDocumentFactory::fromString((string) $entityDescriptor); + $actual = DOMDocumentFactory::normalizeDocument($actualDoc); + + // Compare normalized XML + $this->assertXmlStringEqualsXmlString($expected->saveXML(), $actual->saveXML()); } diff --git a/tests/SAML2/XML/saml/SubjectTest.php b/tests/SAML2/XML/saml/SubjectTest.php index 53fa0155e9..858c5c6f33 100644 --- a/tests/SAML2/XML/saml/SubjectTest.php +++ b/tests/SAML2/XML/saml/SubjectTest.php @@ -266,7 +266,12 @@ public function testMarshallingBaseID(): void AbstractBaseID::fromXML(self::$baseId->documentElement)->toXML($document->documentElement); SubjectConfirmation::fromXML(self::$subjectConfirmation->documentElement)->toXML($document->documentElement); - $this->assertXmlStringEqualsXmlString($document->saveXML(), strval($subject)); + // Normalize both documents before comparing + $expected = DOMDocumentFactory::normalizeDocument($document); + $actualDoc = DOMDocumentFactory::fromString((string) $subject); + $actual = DOMDocumentFactory::normalizeDocument($actualDoc); + + $this->assertXmlStringEqualsXmlString($expected->saveXML(), $actual->saveXML()); } From 9cfaa5996f931d5092aa16e695d77a2785cb44f8 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Thu, 20 Nov 2025 11:44:03 +0100 Subject: [PATCH 34/34] Fix phpstan-baseline --- phpstan-baseline.neon | 154 +++++++++++++++++++----------------------- 1 file changed, 68 insertions(+), 86 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 62cada8dd2..267c5d7fe2 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,5 +1,29 @@ parameters: ignoreErrors: + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\AbstractMessage\:\:addValidator\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\ArtifactResponse\:\:validate\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: '#^Call to method addURLparameters\(\) on an unknown class SimpleSAML\\Utils\\HTTP\.$#' + identifier: class.notFound + count: 1 + path: src/Binding/HTTPArtifact.php + + - + message: '#^Call to method getString\(\) on an unknown class SimpleSAML\\Configuration\.$#' + identifier: class.notFound + count: 1 + path: src/Binding/HTTPArtifact.php + - message: '#^Call to static method addSign\(\) on an unknown class SimpleSAML\\Module\\saml\\Message\.$#' identifier: class.notFound @@ -33,186 +57,144 @@ parameters: - message: '#^Parameter \$key of method SimpleSAML\\SAML2\\Binding\\HTTPArtifact\:\:validateSignature\(\) has invalid type SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' identifier: class.notFound - count: 1 + count: 2 path: src/Binding/HTTPArtifact.php - message: '#^Parameter \$sp of method SimpleSAML\\SAML2\\Binding\\HTTPArtifact\:\:setSPMetadata\(\) has invalid type SimpleSAML\\Configuration\.$#' identifier: class.notFound - count: 1 + count: 2 path: src/Binding/HTTPArtifact.php - message: '#^Property SimpleSAML\\SAML2\\Binding\\HTTPArtifact\:\:\$spMetadata has unknown class SimpleSAML\\Configuration as its type\.$#' identifier: class.notFound - count: 1 + count: 2 path: src/Binding/HTTPArtifact.php - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:convertToIdentityProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + message: '#^Access to property \$key on an unknown class SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' identifier: class.notFound count: 1 - path: src/Configuration/SimpleSAMLConverter.php + path: src/SOAPClient.php - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:convertToServiceProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' - identifier: class.notFound + message: '#^Call to an undefined method SimpleSAML\\SAML2\\XML\\samlp\\AbstractMessage\:\:addValidator\(\)\.$#' + identifier: method.notFound count: 1 path: src/SOAPClient.php - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForDecryptionProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + message: '#^Call to method getCertPath\(\) on an unknown class SimpleSAML\\Utils\\Config\.$#' identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForIdentityProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + message: '#^Call to method getPublicKeys\(\) on an unknown class SimpleSAML\\Configuration\.$#' identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:enrichForServiceProvider\(\) has invalid type SimpleSAML\\Configuration\.$#' + message: '#^Call to method getString\(\) on an unknown class SimpleSAML\\Configuration\.$#' identifier: class.notFound - count: 1 + count: 3 path: src/SOAPClient.php - - message: '#^Parameter \$configuration of method SimpleSAML\\SAML2\\Configuration\\SimpleSAMLConverter\:\:pluckConfiguration\(\) has invalid type SimpleSAML\\Configuration\.$#' + message: '#^Call to method getValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' identifier: class.notFound - count: 1 - path: src/Configuration/SimpleSAMLConverter.php + count: 3 + path: src/SOAPClient.php - - message: '#^Instantiated class SimpleSAML\\Utils\\Config not found\.$#' + message: '#^Call to method hasValue\(\) on an unknown class SimpleSAML\\Configuration\.$#' identifier: class.notFound - count: 1 + count: 5 path: src/SOAPClient.php - - message: '#^Instantiated class SimpleSAML\\Utils\\Crypto not found\.$#' + message: '#^Call to method loadPrivateKey\(\) on an unknown class SimpleSAML\\Utils\\Crypto\.$#' identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: '#^Parameter \$dstMetadata of method SimpleSAML\\SAML2\\SOAPClient\:\:send\(\) has invalid type SimpleSAML\\Configuration\.$#' + message: '#^Call to method loadPublicKey\(\) on an unknown class SimpleSAML\\Utils\\Crypto\.$#' identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: '#^Parameter \$key of method SimpleSAML\\SAML2\\SOAPClient\:\:validateSSL\(\) has invalid type SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + message: '#^Instantiated class SimpleSAML\\Utils\\Config not found\.$#' identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: '#^Parameter \$srcMetadata of method SimpleSAML\\SAML2\\SOAPClient\:\:send\(\) has invalid type SimpleSAML\\Configuration\.$#' + message: '#^Instantiated class SimpleSAML\\Utils\\Crypto not found\.$#' identifier: class.notFound count: 1 path: src/SOAPClient.php - - message: '#^Unsafe usage of new static\(\)\.$#' - identifier: new.static - count: 2 - path: src/XML/md/AbstractEndpointType.php - - - - message: '#^Unsafe usage of new static\(\)\.$#' - identifier: new.static - count: 2 - path: src/XML/md/AbstractIndexedEndpointType.php - - - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\md\\AbstractRoleDescriptor\)\:\:XSI_TYPE_NAME\.$#' - identifier: classConstant.notFound - count: 2 - path: src/XML/md/AbstractRoleDescriptor.php - - - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\md\\AbstractRoleDescriptor\)\:\:XSI_TYPE_NAMESPACE\.$#' - identifier: classConstant.notFound - count: 2 - path: src/XML/md/AbstractRoleDescriptor.php - - - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\md\\AbstractRoleDescriptor\)\:\:XSI_TYPE_PREFIX\.$#' - identifier: classConstant.notFound - count: 2 - path: src/XML/md/AbstractRoleDescriptor.php - - - - message: '#^Call to an undefined static method SimpleSAML\\SAML2\\XML\\md\\AbstractSignedMdElement\:\:getXsiTypeNamespaceURI\(\)\.$#' - identifier: staticMethod.notFound - count: 1 - path: src/XML/md/AbstractSignedMdElement.php - - - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractBaseID\)\:\:XSI_TYPE_NAME\.$#' - identifier: classConstant.notFound - count: 2 - path: src/XML/saml/AbstractBaseID.php - - - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractBaseID\)\:\:XSI_TYPE_NAMESPACE\.$#' - identifier: classConstant.notFound + message: '#^Parameter \$dstMetadata of method SimpleSAML\\SAML2\\SOAPClient\:\:send\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/SOAPClient.php - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractBaseID\)\:\:XSI_TYPE_PREFIX\.$#' - identifier: classConstant.notFound + message: '#^Parameter \$key of method SimpleSAML\\SAML2\\SOAPClient\:\:validateSSL\(\) has invalid type SimpleSAML\\XMLSecurity\\XMLSecurityKey\.$#' + identifier: class.notFound count: 2 path: src/SOAPClient.php - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractCondition\)\:\:XSI_TYPE_NAME\.$#' - identifier: classConstant.notFound + message: '#^Parameter \$srcMetadata of method SimpleSAML\\SAML2\\SOAPClient\:\:send\(\) has invalid type SimpleSAML\\Configuration\.$#' + identifier: class.notFound count: 2 path: src/SOAPClient.php - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractCondition\)\:\:XSI_TYPE_NAMESPACE\.$#' - identifier: classConstant.notFound + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 2 path: src/XML/md/AbstractEndpointType.php - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractCondition\)\:\:XSI_TYPE_PREFIX\.$#' - identifier: classConstant.notFound + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 2 path: src/XML/md/AbstractIndexedEndpointType.php - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractStatement\)\:\:XSI_TYPE_NAME\.$#' - identifier: classConstant.notFound + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static count: 2 path: src/XML/md/AbstractLocalizedName.php - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractStatement\)\:\:XSI_TYPE_NAMESPACE\.$#' - identifier: classConstant.notFound - count: 2 - path: src/XML/saml/AbstractStatement.php + message: '#^Call to an undefined static method SimpleSAML\\SAML2\\XML\\md\\AbstractSignedMdElement\:\:getXsiTypeNamespaceURI\(\)\.$#' + identifier: staticMethod.notFound + count: 1 + path: src/XML/md/AbstractSignedMdElement.php - - message: '#^Access to undefined constant static\(SimpleSAML\\SAML2\\XML\\saml\\AbstractStatement\)\:\:XSI_TYPE_PREFIX\.$#' - identifier: classConstant.notFound - count: 2 - path: src/XML/saml/AbstractStatement.php + message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' + identifier: method.notFound + count: 1 + path: src/XML/md/ContactPerson.php - - message: '#^Unsafe usage of new static\(\)\.$#' - identifier: new.static + message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' + identifier: method.notFound count: 1 path: src/XML/md/EntitiesDescriptor.php - - message: '#^Unsafe usage of new static\(\)\.$#' - identifier: new.static + message: '#^Call to an undefined method SimpleSAML\\XML\\AbstractElement\:\:getList\(\)\.$#' + identifier: method.notFound count: 1 path: src/XML/md/Organization.php