Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

"psr/clock": "~1.0.0",
"psr/log": "~2.3.1 | ~3.0.0",
"simplesamlphp/assert": "~1.8.1",
"simplesamlphp/xml-common": "~1.24.2",
"simplesamlphp/xml-security": "~1.13.0"
"simplesamlphp/assert": "~1.8.2",
"simplesamlphp/xml-common": "~2.0.1",
"simplesamlphp/xml-security": "~2.0.0"
},
"require-dev": {
"beste/clock": "~3.0.0",
"simplesamlphp/simplesamlphp-test-framework": "~1.9.2"
"simplesamlphp/simplesamlphp-test-framework": "~1.9.3"
},
"autoload": {
"psr-4": {
Expand Down
76 changes: 0 additions & 76 deletions phpstan-baseline.neon

This file was deleted.

2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ parameters:
level: 1
paths:
- src
includes:
- phpstan-baseline.neon
22 changes: 12 additions & 10 deletions src/SAML11/Assert/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@
*
* @package simplesamlphp/saml11
*
* @method static void validDateTime(mixed $value, string $message = '', string $exception = '')
* @method static void validURI(mixed $value, string $message = '', string $exception = '')
* @method static void validEntityID(mixed $value, string $message = '', string $exception = '')
* @method static void nullOrValidDateTime(mixed $value, string $message = '', string $exception = '')
* @method static void nullOrValidURI(mixed $value, string $message = '', string $exception = '')
* @method static void nullOrValidEntityID(mixed $value, string $message = '', string $exception = '')
* @method static void allValidDateTime(mixed $value, string $message = '', string $exception = '')
* @method static void allValidURI(mixed $value, string $message = '', string $exception = '')
* @method static void allValidEntityID(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 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 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 SAMLAnyURITrait;
use SAMLDateTimeTrait;
use SAMLStringTrait;
}
63 changes: 0 additions & 63 deletions src/SAML11/Assert/CustomAssertionTrait.php

This file was deleted.

39 changes: 39 additions & 0 deletions src/SAML11/Assert/SAMLAnyURITrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace SimpleSAML\SAML11\Assert;

use SimpleSAML\Assert\AssertionFailedException;
use SimpleSAML\SAML11\Exception\ProtocolViolationException;

/**
* @package simplesamlphp/saml11
*/
trait SAMLAnyURITrait
{
/**
* @param string $value
* @param string $message
*/
protected static function validSAMLAnyURI(string $value, string $message = ''): void
{
parent::validAnyURI($value, $message);

try {
/**
* 1.2.1 String and URI Values
*
* Unless otherwise indicated in this specification, all URI reference values MUST consist
* of at least one non-whitespace character
*/
static::notWhitespaceOnly(
$value,
$message ?: '%s is not a SAML1.1-compliant URI',
ProtocolViolationException::class,
);
} catch (AssertionFailedException $e) {
throw new ProtocolViolationException($e->getMessage());
}
}
}
39 changes: 39 additions & 0 deletions src/SAML11/Assert/SAMLDateTimeTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

namespace SimpleSAML\SAML11\Assert;

use SimpleSAML\Assert\AssertionFailedException;
use SimpleSAML\SAML11\Exception\ProtocolViolationException;

/**
* @package simplesamlphp/saml11
*/
trait SAMLDateTimeTrait
{
/**
* @param string $value
* @param string $message
*/
protected static function validSAMLDateTime(string $value, string $message = ''): void
{
parent::validDateTime($value, $message);

try {
/**
* 1.2.2 Time Values
*
* All SAML time values have the type xsd:dateTime, which is built in to the W3C XML Schema Datatypes
* specification [Schema2], and MUST be expressed in UTC form
*/
static::endsWith(
$value,
'Z',
$message ?: '%s is not a DateTime expressed in the UTC timezone using the \'Z\' timezone identifier.',
);
} catch (AssertionFailedException $e) {
throw new ProtocolViolationException($e->getMessage());
}
}
}
37 changes: 37 additions & 0 deletions src/SAML11/Assert/SAMLStringTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace SimpleSAML\SAML11\Assert;

use SimpleSAML\Assert\AssertionFailedException;
use SimpleSAML\SAML11\Exception\ProtocolViolationException;
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;

/**
* @package simplesamlphp/saml11
*/
trait SAMLStringTrait
{
/**
* @param string $value
* @param string $message
*/
protected static function validSAMLString(string $value, string $message = ''): void
{
parent::validString($value, $message, SchemaViolationException::class);

try {
/**
* 1.2.1 String and URI Values
*
* All strings in SAML messages MUST consist of at least one non-whitespace character
* (whitespace is defined in the XML Recommendation [XML] §2.3).
* Empty and whitespace-only values are disallowed.
*/
static::notWhitespaceOnly($value, $message ?: '%s is not a SAML1.1-compliant string');
} catch (AssertionFailedException $e) {
throw new ProtocolViolationException($e->getMessage());
}
}
}
Loading