diff --git a/src/XML/sp_200507/AbstractTokenAssertionType.php b/src/XML/sp_200507/AbstractTokenAssertionType.php index 2a718abb..c5b54b9d 100644 --- a/src/XML/sp_200507/AbstractTokenAssertionType.php +++ b/src/XML/sp_200507/AbstractTokenAssertionType.php @@ -24,7 +24,6 @@ abstract class AbstractTokenAssertionType extends AbstractSpElement { use ExtendableAttributesTrait; use ExtendableElementTrait; - use IncludeTokenTypeTrait; /** The namespace-attribute for the xs:any element */ public const XS_ANY_ELT_NAMESPACE = NS::OTHER; @@ -32,25 +31,17 @@ abstract class AbstractTokenAssertionType extends AbstractSpElement /** The namespace-attribute for the xs:anyAttribute element */ public const XS_ANY_ATTR_NAMESPACE = NS::ANY; - /** The exclusions for the xs:anyAttribute element */ - public const XS_ANY_ATTR_EXCLUSIONS = [ - [null, 'IncludeToken'], - ]; - /** * TokenAssertionType constructor. * - * @param \SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken|string|null $includeToken * @param array<\SimpleSAML\XML\SerializableElementInterface> $elts * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes */ final public function __construct( - IncludeToken|string|null $includeToken = null, array $elts = [], array $namespacedAttributes = [], ) { - $this->setIncludeToken($includeToken); $this->setElements($elts); $this->setAttributesNS($namespacedAttributes); } @@ -63,8 +54,7 @@ final public function __construct( */ public function isEmptyElement(): bool { - return empty($this->getIncludeToken()) - && empty($this->getAttributesNS()) + return empty($this->getAttributesNS()) && empty($this->getElements()); } @@ -90,14 +80,7 @@ public static function fromXML(DOMElement $xml): static InvalidDOMElementException::class, ); - $includeToken = self::getOptionalAttribute($xml, 'IncludeToken', null); - try { - $includeToken = IncludeToken::from($includeToken); - } catch (ValueError) { - } - return new static( - $includeToken, self::getChildElementsFromXML($xml), self::getAttributesNSFromXML($xml), ); @@ -114,13 +97,6 @@ public function toXML(DOMElement $parent = null): DOMElement { $e = $this->instantiateParentElement($parent); - if ($this->getIncludeToken() !== null) { - $e->setAttribute( - 'IncludeToken', - is_string($this->getIncludeToken()) ? $this->getIncludeToken() : $this->getIncludeToken()->value, - ); - } - foreach ($this->getElements() as $elt) { /** @psalm-var \SimpleSAML\XML\SerializableElementInterface $elt */ $elt->toXML($e); diff --git a/tests/WSSecurity/XML/mssp/RsaTokenTest.php b/tests/WSSecurity/XML/mssp/RsaTokenTest.php index 3db37d19..08b60fce 100644 --- a/tests/WSSecurity/XML/mssp/RsaTokenTest.php +++ b/tests/WSSecurity/XML/mssp/RsaTokenTest.php @@ -12,7 +12,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; @@ -28,7 +27,6 @@ */ #[Group('mssp')] #[CoversClass(RsaToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class RsaTokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $rsaToken = new RsaToken(IncludeToken::Always, [$chunk], [$attr]); + $rsaToken = new RsaToken([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($rsaToken), diff --git a/tests/WSSecurity/XML/mssp/SslContextTokenTest.php b/tests/WSSecurity/XML/mssp/SslContextTokenTest.php index 4a10e2f8..f7bc669b 100644 --- a/tests/WSSecurity/XML/mssp/SslContextTokenTest.php +++ b/tests/WSSecurity/XML/mssp/SslContextTokenTest.php @@ -12,7 +12,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; use SimpleSAML\XML\DOMDocumentFactory; @@ -28,7 +27,6 @@ */ #[Group('mssp')] #[CoversClass(SslContextToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class SslContextTokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_12, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $sslContextToken = new SslContextToken(IncludeToken::Always, [$chunk], [$attr]); + $sslContextToken = new SslContextToken([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($sslContextToken), diff --git a/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php b/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php index b795be9f..ec72b73a 100644 --- a/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/KerberosTokenTest.php @@ -11,7 +11,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\KerberosToken; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; @@ -28,7 +27,6 @@ */ #[Group('sp')] #[CoversClass(KerberosToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class KerberosTokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $KerberosToken = new KerberosToken(IncludeToken::Always, [$chunk], [$attr]); + $KerberosToken = new KerberosToken([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($KerberosToken), diff --git a/tests/WSSecurity/XML/sp_200507/RelTokenTest.php b/tests/WSSecurity/XML/sp_200507/RelTokenTest.php index 9a200992..8f170681 100644 --- a/tests/WSSecurity/XML/sp_200507/RelTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/RelTokenTest.php @@ -11,7 +11,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\RelToken; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; @@ -28,7 +27,6 @@ */ #[Group('sp')] #[CoversClass(RelToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class RelTokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $relToken = new RelToken(IncludeToken::Always, [$chunk], [$attr]); + $relToken = new RelToken([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($relToken), diff --git a/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php b/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php index 73449862..03481b8a 100644 --- a/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/SamlTokenTest.php @@ -11,7 +11,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\SamlToken; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; @@ -28,7 +27,6 @@ */ #[Group('sp')] #[CoversClass(SamlToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class SamlTokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SamlToken = new SamlToken(IncludeToken::Always, [$chunk], [$attr]); + $SamlToken = new SamlToken([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($SamlToken), diff --git a/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php b/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php index 1ef23afb..240fc292 100644 --- a/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/SecurityContextTokenTest.php @@ -11,7 +11,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\SecurityContextToken; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; @@ -28,7 +27,6 @@ */ #[Group('sp')] #[CoversClass(SecurityContextToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class SecurityContextTokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $SecurityContextToken = new SecurityContextToken(IncludeToken::Always, [$chunk], [$attr]); + $SecurityContextToken = new SecurityContextToken([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($SecurityContextToken), diff --git a/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php b/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php index 30c5cab2..31a93713 100644 --- a/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/UsernameTokenTest.php @@ -11,7 +11,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\UsernameToken; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; @@ -28,7 +27,6 @@ */ #[Group('sp')] #[CoversClass(UsernameToken::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class UsernameTokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $UsernameToken = new UsernameToken(IncludeToken::Always, [$chunk], [$attr]); + $UsernameToken = new UsernameToken([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($UsernameToken), diff --git a/tests/WSSecurity/XML/sp_200507/X509TokenTest.php b/tests/WSSecurity/XML/sp_200507/X509TokenTest.php index 9b51d99a..1a36931f 100644 --- a/tests/WSSecurity/XML/sp_200507/X509TokenTest.php +++ b/tests/WSSecurity/XML/sp_200507/X509TokenTest.php @@ -11,7 +11,6 @@ use SimpleSAML\WSSecurity\XML\sp_200507\AbstractSpElement; use SimpleSAML\WSSecurity\XML\sp_200507\AbstractTokenAssertionType; use SimpleSAML\WSSecurity\XML\sp_200507\IncludeToken; -use SimpleSAML\WSSecurity\XML\sp_200507\IncludeTokenTypeTrait; use SimpleSAML\WSSecurity\XML\sp_200507\X509Token; use SimpleSAML\XML\Attribute as XMLAttribute; use SimpleSAML\XML\Chunk; @@ -28,7 +27,6 @@ */ #[Group('sp')] #[CoversClass(X509Token::class)] -#[CoversClass(IncludeTokenTypeTrait::class)] #[CoversClass(AbstractTokenAssertionType::class)] #[CoversClass(AbstractSpElement::class)] final class X509TokenTest extends TestCase @@ -75,11 +73,12 @@ public function testMarshallingEmptyElement(): void public function testMarshalling(): void { $attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', 'value1'); + $includeToken = new XMLAttribute(C::NS_SEC_POLICY_11, 'sp', 'IncludeToken', IncludeToken::Always->value); $chunk = new Chunk(DOMDocumentFactory::fromString( 'some', )->documentElement); - $X509Token = new X509Token(IncludeToken::Always, [$chunk], [$attr]); + $X509Token = new X509Token([$chunk], [$includeToken, $attr]); $this->assertEquals( self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), strval($X509Token), diff --git a/tests/resources/xml/mssp/RsaToken.xml b/tests/resources/xml/mssp/RsaToken.xml index e7671545..f74c8e23 100644 --- a/tests/resources/xml/mssp/RsaToken.xml +++ b/tests/resources/xml/mssp/RsaToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/mssp/SslContextToken.xml b/tests/resources/xml/mssp/SslContextToken.xml index 736d4d89..34b75b0d 100644 --- a/tests/resources/xml/mssp/SslContextToken.xml +++ b/tests/resources/xml/mssp/SslContextToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200507/KerberosToken.xml b/tests/resources/xml/sp/200507/KerberosToken.xml index 17e92965..d4e473f2 100644 --- a/tests/resources/xml/sp/200507/KerberosToken.xml +++ b/tests/resources/xml/sp/200507/KerberosToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200507/RelToken.xml b/tests/resources/xml/sp/200507/RelToken.xml index ebef6e34..3b99db00 100644 --- a/tests/resources/xml/sp/200507/RelToken.xml +++ b/tests/resources/xml/sp/200507/RelToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200507/SamlToken.xml b/tests/resources/xml/sp/200507/SamlToken.xml index e07737d9..a395d852 100644 --- a/tests/resources/xml/sp/200507/SamlToken.xml +++ b/tests/resources/xml/sp/200507/SamlToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200507/SecurityContextToken.xml b/tests/resources/xml/sp/200507/SecurityContextToken.xml index 00022182..73bbbc6d 100644 --- a/tests/resources/xml/sp/200507/SecurityContextToken.xml +++ b/tests/resources/xml/sp/200507/SecurityContextToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200507/UsernameToken.xml b/tests/resources/xml/sp/200507/UsernameToken.xml index 19cb0874..af3d704c 100644 --- a/tests/resources/xml/sp/200507/UsernameToken.xml +++ b/tests/resources/xml/sp/200507/UsernameToken.xml @@ -1,3 +1,3 @@ - + some diff --git a/tests/resources/xml/sp/200507/X509Token.xml b/tests/resources/xml/sp/200507/X509Token.xml index fcefd333..2b50016d 100644 --- a/tests/resources/xml/sp/200507/X509Token.xml +++ b/tests/resources/xml/sp/200507/X509Token.xml @@ -1,3 +1,3 @@ - + some