simplesamlphp /
saml2
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace SimpleSAML\SAML2\XML\samlp; |
||
| 6 | |||
| 7 | use DOMElement; |
||
| 8 | use SimpleSAML\SAML2\Assert\Assert; |
||
| 9 | use SimpleSAML\SAML2\Exception\ProtocolViolationException; |
||
| 10 | use SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue; |
||
|
0 ignored issues
–
show
|
|||
| 11 | use SimpleSAML\SAML2\XML\saml\AuthnContextClassRef; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\SAML2\XML\saml\AuthnContextClassRef was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 12 | use SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 13 | use SimpleSAML\XML\Constants as C; |
||
|
0 ignored issues
–
show
The type
SimpleSAML\XML\Constants was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | use SimpleSAML\XML\SchemaValidatableElementInterface; |
||
| 15 | use SimpleSAML\XML\SchemaValidatableElementTrait; |
||
| 16 | use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException; |
||
| 17 | use SimpleSAML\XMLSchema\Exception\SchemaViolationException; |
||
| 18 | |||
| 19 | use function array_merge; |
||
| 20 | use function strval; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Class representing SAML2 RequestedAuthnContext |
||
| 24 | * |
||
| 25 | * @package simplesamlphp/saml2 |
||
| 26 | */ |
||
| 27 | final class RequestedAuthnContext extends AbstractSamlpElement implements SchemaValidatableElementInterface |
||
|
0 ignored issues
–
show
The type
SimpleSAML\SAML2\XML\samlp\AbstractSamlpElement was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 28 | { |
||
| 29 | use SchemaValidatableElementTrait; |
||
| 30 | |||
| 31 | |||
| 32 | /** |
||
| 33 | * Initialize a RequestedAuthnContext. |
||
| 34 | * |
||
| 35 | * @param ( |
||
| 36 | * \SimpleSAML\SAML2\XML\saml\AuthnContextClassRef| |
||
| 37 | * \SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef |
||
| 38 | * )[] $requestedAuthnContexts |
||
| 39 | * @param \SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue $Comparison |
||
| 40 | */ |
||
| 41 | public function __construct( |
||
| 42 | protected array $requestedAuthnContexts = [], |
||
| 43 | protected ?AuthnContextComparisonTypeValue $Comparison = null, |
||
| 44 | ) { |
||
| 45 | Assert::maxCount($requestedAuthnContexts, C::UNBOUNDED_LIMIT); |
||
| 46 | Assert::minCount($requestedAuthnContexts, 1, SchemaViolationException::class); |
||
| 47 | Assert::allIsInstanceOfAny( |
||
| 48 | $requestedAuthnContexts, |
||
| 49 | [AuthnContextClassRef::class, AuthnContextDeclRef::class], |
||
| 50 | SchemaViolationException::class, |
||
| 51 | ); |
||
| 52 | |||
| 53 | if ($requestedAuthnContexts[0] instanceof AuthnContextClassRef) { |
||
| 54 | Assert::allIsInstanceOf( |
||
| 55 | $requestedAuthnContexts, |
||
| 56 | AuthnContextClassRef::class, |
||
| 57 | 'You need either AuthnContextClassRef or AuthnContextDeclRef, not both.', |
||
| 58 | ProtocolViolationException::class, |
||
| 59 | ); |
||
| 60 | } else { // Can only be AuthnContextDeclRef |
||
| 61 | Assert::allIsInstanceOf( |
||
| 62 | $requestedAuthnContexts, |
||
| 63 | AuthnContextDeclRef::class, |
||
| 64 | 'You need either AuthnContextClassRef or AuthnContextDeclRef, not both.', |
||
| 65 | ProtocolViolationException::class, |
||
| 66 | ); |
||
| 67 | } |
||
| 68 | } |
||
| 69 | |||
| 70 | |||
| 71 | /** |
||
| 72 | * Collect the value of the requestedAuthnContexts-property |
||
| 73 | * |
||
| 74 | * @return (\SimpleSAML\SAML2\XML\saml\AuthnContextClassRef|\SimpleSAML\SAML2\XML\saml\AuthnContextDeclRef)[] |
||
| 75 | */ |
||
| 76 | public function getRequestedAuthnContexts(): array |
||
| 77 | { |
||
| 78 | return $this->requestedAuthnContexts; |
||
| 79 | } |
||
| 80 | |||
| 81 | |||
| 82 | /** |
||
| 83 | * Collect the value of the Comparison-property |
||
| 84 | * |
||
| 85 | * @return \SimpleSAML\SAML2\Type\AuthnContextComparisonTypeValue|null |
||
| 86 | */ |
||
| 87 | public function getComparison(): ?AuthnContextComparisonTypeValue |
||
| 88 | { |
||
| 89 | return $this->Comparison; |
||
| 90 | } |
||
| 91 | |||
| 92 | |||
| 93 | /** |
||
| 94 | * Convert XML into a RequestedAuthnContext |
||
| 95 | * |
||
| 96 | * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException |
||
| 97 | * if the qualified name of the supplied element is wrong |
||
| 98 | */ |
||
| 99 | public static function fromXML(DOMElement $xml): static |
||
| 100 | { |
||
| 101 | Assert::same($xml->localName, 'RequestedAuthnContext', InvalidDOMElementException::class); |
||
| 102 | Assert::same($xml->namespaceURI, RequestedAuthnContext::NS, InvalidDOMElementException::class); |
||
| 103 | |||
| 104 | return new static( |
||
| 105 | array_merge( |
||
| 106 | AuthnContextClassRef::getChildrenOfClass($xml), |
||
| 107 | AuthnContextDeclRef::getChildrenOfClass($xml), |
||
| 108 | ), |
||
| 109 | self::getOptionalAttribute($xml, 'Comparison', AuthnContextComparisonTypeValue::class, null), |
||
| 110 | ); |
||
| 111 | } |
||
| 112 | |||
| 113 | |||
| 114 | /** |
||
| 115 | * Convert this RequestedAuthnContext to XML. |
||
| 116 | * |
||
| 117 | * @param \DOMElement|null $parent The element we should append this RequestedAuthnContext to. |
||
| 118 | * @return \DOMElement |
||
| 119 | */ |
||
| 120 | public function toXML(?DOMElement $parent = null): DOMElement |
||
| 121 | { |
||
| 122 | $e = $this->instantiateParentElement($parent); |
||
| 123 | |||
| 124 | foreach ($this->getRequestedAuthnContexts() as $context) { |
||
| 125 | $context->toXML($e); |
||
| 126 | } |
||
| 127 | |||
| 128 | if ($this->getComparison() !== null) { |
||
| 129 | $e->setAttribute('Comparison', strval($this->getComparison())); |
||
| 130 | } |
||
| 131 | |||
| 132 | return $e; |
||
| 133 | } |
||
| 134 | } |
||
| 135 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths