Skip to content

Commit 0724c6b

Browse files
committed
Implement DOM schema validation
1 parent dd92f6c commit 0724c6b

File tree

190 files changed

+603
-271
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

190 files changed

+603
-271
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
"psr/http-message": "^2.0",
3333
"psr/log": "^2.0 || ^3.0",
3434
"simplesamlphp/assert": "~1.6.0",
35-
"simplesamlphp/xml-common": "~1.22.0",
35+
"simplesamlphp/xml-common": "~1.23.0",
3636
"simplesamlphp/xml-security": "~1.12.0",
37-
"simplesamlphp/xml-soap": "~1.5.6"
37+
"simplesamlphp/xml-soap": "~1.6.0"
3838
},
3939
"require-dev": {
4040
"ext-intl": "*",

src/XML/alg/AbstractAlgElement.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ abstract class AbstractAlgElement extends AbstractElement
1919

2020
/** @var string */
2121
public const NS_PREFIX = 'alg';
22+
23+
/** @var string */
24+
public const SCHEMA = 'resources/schemas/sstc-saml-metadata-algsupport-v1.0.xsd';
2225
}

src/XML/alg/DigestMethod.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use SimpleSAML\SAML2\Assert\Assert as SAMLAssert;
1010
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1111
use SimpleSAML\XML\ExtendableElementTrait;
12+
use SimpleSAML\XML\SchemaValidatableElementInterface;
13+
use SimpleSAML\XML\SchemaValidatableElementTrait;
1214
use SimpleSAML\XML\XsNamespace as NS;
1315

1416
/**
@@ -17,9 +19,10 @@
1719
* @link http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-algsupport.pdf
1820
* @package simplesamlphp/saml2
1921
*/
20-
final class DigestMethod extends AbstractAlgElement
22+
final class DigestMethod extends AbstractAlgElement implements SchemaValidatableElementInterface
2123
{
2224
use ExtendableElementTrait;
25+
use SchemaValidatableElementTrait;
2326

2427
/** The namespace-attribute for the xs:any element */
2528
public const XS_ANY_ELT_NAMESPACE = NS::ANY;

src/XML/alg/SigningMethod.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use SimpleSAML\SAML2\Assert\Assert as SAMLAssert;
1010
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1111
use SimpleSAML\XML\ExtendableElementTrait;
12+
use SimpleSAML\XML\SchemaValidatableElementInterface;
13+
use SimpleSAML\XML\SchemaValidatableElementTrait;
1214
use SimpleSAML\XML\XsNamespace as NS;
1315

1416
use function strval;
@@ -19,9 +21,10 @@
1921
* @link http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-metadata-algsupport.pdf
2022
* @package simplesamlphp/saml2
2123
*/
22-
final class SigningMethod extends AbstractAlgElement
24+
final class SigningMethod extends AbstractAlgElement implements SchemaValidatableElementInterface
2325
{
2426
use ExtendableElementTrait;
27+
use SchemaValidatableElementTrait;
2528

2629
/** The namespace-attribute for the xs:any element */
2730
public const XS_ANY_ELT_NAMESPACE = NS::ANY;

src/XML/ecp/AbstractEcpElement.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ abstract class AbstractEcpElement extends AbstractElement
2121

2222
/** @var string */
2323
public const NS_PREFIX = 'ecp';
24+
25+
/** @var string */
26+
public const SCHEMA = 'resources/schemas/saml-schema-ecp-2.0.xsd';
2427
}

src/XML/ecp/RelayState.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,18 @@
1010
use SimpleSAML\SOAP\Constants as C;
1111
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1212
use SimpleSAML\XML\Exception\MissingAttributeException;
13+
use SimpleSAML\XML\SchemaValidatableElementInterface;
14+
use SimpleSAML\XML\SchemaValidatableElementTrait;
1315
use SimpleSAML\XML\StringElementTrait;
1416

1517
/**
1618
* Class representing the ECP RelayState element.
1719
*
1820
* @package simplesamlphp/saml2
1921
*/
20-
final class RelayState extends AbstractEcpElement
22+
final class RelayState extends AbstractEcpElement implements SchemaValidatableElementInterface
2123
{
24+
use SchemaValidatableElementTrait;
2225
use StringElementTrait;
2326

2427
/**

src/XML/ecp/Request.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1414
use SimpleSAML\XML\Exception\MissingAttributeException;
1515
use SimpleSAML\XML\Exception\TooManyElementsException;
16+
use SimpleSAML\XML\SchemaValidatableElementInterface;
17+
use SimpleSAML\XML\SchemaValidatableElementTrait;
1618

1719
use function intval;
1820
use function strval;
@@ -22,8 +24,10 @@
2224
*
2325
* @package simplesamlphp/saml2
2426
*/
25-
final class Request extends AbstractEcpElement
27+
final class Request extends AbstractEcpElement implements SchemaValidatableElementInterface
2628
{
29+
use SchemaValidatableElementTrait;
30+
2731
/**
2832
* Create a ECP Request element.
2933
*

src/XML/ecp/RequestAuthenticated.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
use SimpleSAML\SOAP\Constants as C;
1111
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1212
use SimpleSAML\XML\Exception\MissingAttributeException;
13+
use SimpleSAML\XML\SchemaValidatableElementInterface;
14+
use SimpleSAML\XML\SchemaValidatableElementTrait;
1315

1416
use function boolval;
1517
use function strval;
@@ -19,8 +21,10 @@
1921
*
2022
* @package simplesamlphp/saml2
2123
*/
22-
final class RequestAuthenticated extends AbstractEcpElement
24+
final class RequestAuthenticated extends AbstractEcpElement implements SchemaValidatableElementInterface
2325
{
26+
use SchemaValidatableElementTrait;
27+
2428
/**
2529
* Create a ECP RequestAuthenticated element.
2630
*

src/XML/ecp/Response.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@
1111
use SimpleSAML\SOAP\Constants as C;
1212
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1313
use SimpleSAML\XML\Exception\MissingAttributeException;
14+
use SimpleSAML\XML\SchemaValidatableElementInterface;
15+
use SimpleSAML\XML\SchemaValidatableElementTrait;
1416

1517
/**
1618
* Class representing the ECP Response element.
1719
*
1820
* @package simplesamlphp/saml2
1921
*/
20-
final class Response extends AbstractEcpElement
22+
final class Response extends AbstractEcpElement implements SchemaValidatableElementInterface
2123
{
24+
use SchemaValidatableElementTrait;
25+
2226
/**
2327
* Create a ECP Response element.
2428
*

src/XML/ecp/SubjectConfirmation.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@
1313
use SimpleSAML\XML\Exception\InvalidDOMElementException;
1414
use SimpleSAML\XML\Exception\MissingAttributeException;
1515
use SimpleSAML\XML\Exception\TooManyElementsException;
16+
use SimpleSAML\XML\SchemaValidatableElementInterface;
17+
use SimpleSAML\XML\SchemaValidatableElementTrait;
1618

1719
/**
1820
* Class representing the ECP SubjectConfirmation element.
1921
*
2022
* @package simplesamlphp/saml2
2123
*/
22-
final class SubjectConfirmation extends AbstractEcpElement
24+
final class SubjectConfirmation extends AbstractEcpElement implements SchemaValidatableElementInterface
2325
{
26+
use SchemaValidatableElementTrait;
27+
2428
/**
2529
* Create a ECP SubjectConfirmation element.
2630
*

0 commit comments

Comments
 (0)