File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55namespace SimpleSAML \XMLSecurity \XML \ds ;
66
7- use DOMElement ;
8- use SimpleSAML \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
107use SimpleSAML \XML \XMLBase64ElementTrait ;
118
129/**
1714final class DigestValue extends AbstractDsElement
1815{
1916 use XMLBase64ElementTrait;
20-
21-
22- /**
23- * Validate the content of the element.
24- *
25- * @param string $content The value to go in the XML textContent
26- * @throws \Exception on failure
27- * @return void
28- */
29- protected function validateContent (string $ content ): void
30- {
31- Assert::notEmpty ($ content , 'DigestValue cannot be empty ' );
32- Assert::stringPlausibleBase64 ($ content , 'ds:DigestValue is not a valid Base64 encoded string ' );
33- }
34-
35-
36- /**
37- * Convert XML into a DigestValue
38- *
39- * @param \DOMElement $xml The XML element we should load
40- * @return self
41- *
42- * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
43- * If the qualified name of the supplied element is wrong
44- */
45- public static function fromXML (DOMElement $ xml ): object
46- {
47- Assert::same ($ xml ->localName , 'DigestValue ' , InvalidDOMElementException::class);
48- Assert::same ($ xml ->namespaceURI , DigestValue::NS , InvalidDOMElementException::class);
49-
50- return new self ($ xml ->textContent );
51- }
5217}
Original file line number Diff line number Diff line change 44
55namespace SimpleSAML \XMLSecurity \XML \ds ;
66
7- use DOMElement ;
8- use SimpleSAML \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
107use SimpleSAML \XML \XMLStringElementTrait ;
118
129/**
1714final class KeyName extends AbstractDsElement
1815{
1916 use XMLStringElementTrait;
20-
21-
22- /**
23- * Validate the content of the element.
24- *
25- * @param string $content The value to go in the XML textContent
26- * @throws \Exception on failure
27- * @return void
28- */
29- protected function validateContent (string $ content ): void
30- {
31- /**
32- * Perform no validation by default.
33- * Override this method on the implementing class to perform content validation.
34- */
35- }
36-
37-
38- /**
39- * Convert XML into a KeyName
40- *
41- * @param \DOMElement $xml The XML element we should load
42- * @return self
43- *
44- * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
45- * If the qualified name of the supplied element is wrong
46- */
47- public static function fromXML (DOMElement $ xml ): object
48- {
49- Assert::same ($ xml ->localName , 'KeyName ' , InvalidDOMElementException::class);
50- Assert::same ($ xml ->namespaceURI , KeyName::NS , InvalidDOMElementException::class);
51-
52- return new self ($ xml ->textContent );
53- }
5417}
Original file line number Diff line number Diff line change 44
55namespace SimpleSAML \XMLSecurity \XML \ds ;
66
7- use DOMElement ;
8- use SimpleSAML \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
107use SimpleSAML \XML \XMLBase64ElementTrait ;
118
129/**
1714final class SignatureValue extends AbstractDsElement
1815{
1916 use XMLBase64ElementTrait;
20-
21-
22- /**
23- * Validate the content of the element.
24- *
25- * @param string $content The value to go in the XML textContent
26- * @throws \Exception on failure
27- * @return void
28- */
29- protected function validateContent (string $ content ): void
30- {
31- Assert::notEmpty ($ content , 'SignatureValue cannot be empty ' );
32- Assert::stringPlausibleBase64 ($ content , 'SignatureValue is not a valid Base64 encoded string ' );
33- }
34-
35-
36- /**
37- * Convert XML into a SignatureValue
38- *
39- * @param \DOMElement $xml The XML element we should load
40- * @return self
41- *
42- * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException If the qualified name of the supplied element is
43- * wrong.
44- */
45- public static function fromXML (DOMElement $ xml ): object
46- {
47- Assert::same ($ xml ->localName , 'SignatureValue ' , InvalidDOMElementException::class);
48- Assert::same ($ xml ->namespaceURI , SignatureValue::NS , InvalidDOMElementException::class);
49-
50- return new self ($ xml ->textContent );
51- }
5217}
Original file line number Diff line number Diff line change 44
55namespace SimpleSAML \XMLSecurity \XML \ds ;
66
7- use DOMElement ;
8- use SimpleSAML \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
107use SimpleSAML \XML \XMLBase64ElementTrait ;
118
129/**
1714final class X509Certificate extends AbstractDsElement
1815{
1916 use XMLBase64ElementTrait;
20-
21-
22- /**
23- * Validate the content of the element.
24- *
25- * @param string $content The value to go in the XML textContent
26- * @throws \Exception on failure
27- * @return void
28- */
29- protected function validateContent (string $ content ): void
30- {
31- Assert::notEmpty ($ content , 'ds:X509Certificate cannot be empty ' );
32- Assert::stringPlausibleBase64 ($ content , 'ds:X509Certificate is not a valid Base64 encoded string ' );
33- }
34-
35-
36- /**
37- * Convert XML into a X509Certificate
38- *
39- * @param \DOMElement $xml The XML element we should load
40- * @return self
41- *
42- * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
43- * If the qualified name of the supplied element is wrong
44- */
45- public static function fromXML (DOMElement $ xml ): object
46- {
47- Assert::same ($ xml ->localName , 'X509Certificate ' , InvalidDOMElementException::class);
48- Assert::same ($ xml ->namespaceURI , X509Certificate::NS , InvalidDOMElementException::class);
49-
50- return new self ($ xml ->textContent );
51- }
5217}
Original file line number Diff line number Diff line change @@ -77,20 +77,6 @@ private function setAlgorithm(string $algorithm): void
7777 }
7878
7979
80- /**
81- * Validate the content of the element.
82- *
83- * @param string $content The value to go in the XML textContent
84- * @throws \Exception on failure
85- * @return void
86- */
87- protected function validateContent (string $ content ): void
88- {
89- Assert::notEmpty ($ content , 'X509Digest cannot be empty ' );
90- Assert::stringPlausibleBase64 ($ content , 'ds:X509Digest is not a valid Base64 encoded string ' );
91- }
92-
93-
9480 /**
9581 * Convert XML into a X509Digest
9682 *
Original file line number Diff line number Diff line change 44
55namespace SimpleSAML \XMLSecurity \XML \ds ;
66
7- use DOMElement ;
8- use SimpleSAML \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
107use SimpleSAML \XML \XMLStringElementTrait ;
118
129/**
1714final class X509IssuerName extends AbstractDsElement
1815{
1916 use XMLStringElementTrait;
20-
21-
22- /**
23- * Convert XML into a X509IssuerName
24- *
25- * @param \DOMElement $xml The XML element we should load
26- * @return self
27- *
28- * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
29- * If the qualified name of the supplied element is wrong
30- */
31- public static function fromXML (DOMElement $ xml ): object
32- {
33- Assert::same ($ xml ->localName , 'X509IssuerName ' , InvalidDOMElementException::class);
34- Assert::same ($ xml ->namespaceURI , X509IssuerName::NS , InvalidDOMElementException::class);
35-
36- return new self ($ xml ->textContent );
37- }
3817}
Original file line number Diff line number Diff line change 44
55namespace SimpleSAML \XMLSecurity \XML \ds ;
66
7- use DOMElement ;
8- use SimpleSAML \Assert \Assert ;
9- use SimpleSAML \XML \Exception \InvalidDOMElementException ;
107use SimpleSAML \XML \XMLStringElementTrait ;
118
129/**
1714final class X509SubjectName extends AbstractDsElement
1815{
1916 use XMLStringElementTrait;
20-
21-
22- /**
23- * Convert XML into a X509SubjectName
24- *
25- * @param \DOMElement $xml The XML element we should load
26- * @return self
27- *
28- * @throws \SimpleSAML\XML\Exception\InvalidDOMElementException
29- * If the qualified name of the supplied element is wrong
30- */
31- public static function fromXML (DOMElement $ xml ): object
32- {
33- Assert::same ($ xml ->localName , 'X509SubjectName ' , InvalidDOMElementException::class);
34- Assert::same ($ xml ->namespaceURI , X509SubjectName::NS , InvalidDOMElementException::class);
35-
36- return new self ($ xml ->textContent );
37- }
3817}
You can’t perform that action at this time.
0 commit comments