88use SimpleSAML \WSSecurity \Assert \Assert ;
99use SimpleSAML \WSSecurity \Constants as C ;
1010use SimpleSAML \XML \Exception \InvalidDOMElementException ;
11- use SimpleSAML \XML \Exception \SchemaViolationException ;
1211use SimpleSAML \XML \XsNamespace as NS ;
12+ use SimpleSAML \XMLSchema \Type \AnyURIValue ;
13+ use SimpleSAML \XMLSchema \Type \IDValue ;
14+ use SimpleSAML \XMLSchema \Type \StringValue ;
1315
1416/**
1517 * Class defining the BinarySecurityTokenType element
@@ -25,29 +27,28 @@ abstract class AbstractBinarySecurityTokenType extends AbstractEncodedString
2527 /**
2628 * AbstractBinarySecurityTokenType constructor
2729 *
28- * @param string $content
29- * @param string |null $valueType
30- * @param string |null $Id
31- * @param string |null $EncodingType
30+ * @param \SimpleSAML\XMLSchema\Type\StringValue $content
31+ * @param \SimpleSAML\XMLSchema\Type\AnyURIValue |null $valueType
32+ * @param \SimpleSAML\XMLSchema\Type\IDValue |null $Id
33+ * @param \SimpleSAML\XMLSchema\Type\AnyURIValue |null $EncodingType
3234 * @param array<\SimpleSAML\XML\Attribute> $namespacedAttributes
3335 */
3436 final public function __construct (
35- string $ content ,
36- protected ?string $ valueType = null ,
37- ?string $ Id = null ,
37+ StringValue $ content ,
38+ protected ?AnyURIValue $ valueType = null ,
39+ ?IDValue $ Id = null ,
3840 ?string $ EncodingType = null ,
3941 array $ namespacedAttributes = [],
4042 ) {
41- Assert::nullOrValidURI ($ valueType , SchemaViolationException::class);
42-
43+ Assert::validBase64Binary ($ content ->getValue ());
4344 parent ::__construct ($ content , $ Id , $ EncodingType , $ namespacedAttributes );
4445 }
4546
4647
4748 /**
48- * @return string |null
49+ * @return \SimpleSAML\XMLSchema\Type\AnyURIValue |null
4950 */
50- public function getValueType (): ?string
51+ public function getValueType (): ?AnyURIValue
5152 {
5253 return $ this ->valueType ;
5354 }
@@ -79,10 +80,10 @@ public static function fromXML(DOMElement $xml): static
7980 }
8081
8182 return new static (
82- $ xml ->textContent ,
83- self ::getOptionalAttribute ($ xml , 'ValueType ' , null ),
83+ StringValue:: fromString ( $ xml ->textContent ) ,
84+ self ::getOptionalAttribute ($ xml , 'ValueType ' , AnyURIValue::class, null ),
8485 $ Id ,
85- self ::getOptionalAttribute ($ xml , 'EncodingType ' , null ),
86+ self ::getOptionalAttribute ($ xml , 'EncodingType ' , AnyURIValue::class, null ),
8687 $ nsAttributes ,
8788 );
8889 }
@@ -99,7 +100,7 @@ public function toXML(?DOMElement $parent = null): DOMElement
99100 $ e = parent ::toXML ($ parent );
100101
101102 if ($ this ->getValueType () !== null ) {
102- $ e ->setAttribute ('ValueType ' , $ this ->getValueType ());
103+ $ e ->setAttribute ('ValueType ' , $ this ->getValueType ()-> getValue () );
103104 }
104105
105106 return $ e ;
0 commit comments