-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use local versions of StringElementTrait and URIElementTrait to compl…
…y with stricter SAML 2.0 specs
- Loading branch information
Showing
34 changed files
with
158 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\SAML2\XML; | ||
|
||
use SimpleSAML\Assert\Assert; | ||
use SimpleSAML\SAML2\Exception\ProtocolViolationException; | ||
use SimpleSAML\XML\StringElementTrait as BaseStringElementTrait; | ||
|
||
/** | ||
* Trait extending the default StringElementTrait to comply with the restrictions added by the SAML 2.0 specifications. | ||
* | ||
* @package simplesamlphp/saml2 | ||
*/ | ||
trait StringElementTrait | ||
{ | ||
use BaseStringElementTrait; | ||
|
||
/** | ||
* 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(/** @scrutinizer ignore-unused */ string $content): void | ||
{ | ||
/** | ||
* 1.3.1 String Values | ||
* | ||
* All SAML string values have the type xs:string, which is built in to the W3C XML Schema Datatypes | ||
* specification [Schema2]. Unless otherwise noted in this specification or particular profiles, all strings in | ||
* SAML messages MUST consist of at least one non-whitespace character (whitespace is defined in the | ||
* XML Recommendation [XML] Section 2.3). | ||
*/ | ||
Assert::notWhitespaceOnly($content, ProtocolViolationException::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\SAML2\XML; | ||
|
||
use SimpleSAML\Assert\Assert; | ||
use SimpleSAML\SAML2\Assert\Assert as SAMLAssert; | ||
use SimpleSAML\SAML2\Exception\ProtocolViolationException; | ||
use SimpleSAML\XML\Exception\SchemaViolationException; | ||
use SimpleSAML\XML\URIElementTrait as BaseURIElementTrait; | ||
|
||
/** | ||
* Trait extending the default URIElementTrait to comply with the restrictions added by the SAML 2.0 specifications. | ||
* | ||
* @package simplesamlphp/saml2 | ||
*/ | ||
trait URIElementTrait | ||
{ | ||
use BaseURIElementTrait; | ||
|
||
/** | ||
* 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 | ||
{ | ||
/** | ||
* 1.3.2 URI Values | ||
* | ||
* Unless otherwise indicated in this specification, all URI reference values used within SAML-defined | ||
* elements or attributes MUST consist of at least one non-whitespace character, and are REQUIRED to be | ||
* absolute [RFC 2396]. | ||
*/ | ||
Assert::notWhitespaceOnly($content, ProtocolViolationException::class); | ||
SAMLAssert::validURI($content, SchemaViolationException::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.