| Conditions | 1 |
| Paths | 1 |
| Total Lines | 22 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 27 | protected function setSignature(Signature $signature): void |
||
| 28 | { |
||
| 29 | /** |
||
| 30 | * Signatures MUST contain a single <ds:Reference> containing a same-document reference to the ID |
||
| 31 | * attribute value of the root element of the assertion or protocol message being signed. For example, if the |
||
| 32 | * ID attribute value is "foo", then the URI attribute in the <ds:Reference> element MUST be "#foo". |
||
| 33 | */ |
||
| 34 | |||
| 35 | $references = $signature->getSignedInfo()->getReferences(); |
||
| 36 | Assert::count($references, 1, "A signature needs to have exactly one Reference, %d found."); |
||
| 37 | |||
| 38 | $reference = array_pop($references); |
||
| 39 | Assert::notNull($reference->getURI(), "URI attribute not found.", ReferenceValidationFailedException::class); |
||
| 40 | |||
| 41 | Assert::same( |
||
| 42 | $reference->getURI(), |
||
| 43 | '#' . $this->getID(), |
||
| 44 | "Reference does not point to given element.", |
||
| 45 | ReferenceValidationFailedException::class, |
||
| 46 | ); |
||
| 47 | |||
| 48 | $this->signature = $signature; |
||
| 49 | } |
||
| 51 |