77use DOMElement ;
88use SimpleSAML \SAML2 \Assert \Assert ;
99use SimpleSAML \SAML2 \Constants as C ;
10- use SimpleSAML \SAML2 \Exception \ProtocolViolationException ;
11- use SimpleSAML \SAML2 \Type \SAMLStringValue ;
12- use SimpleSAML \SAML2 \XML \Decision ;
10+ use SimpleSAML \SAML2 \Type \DecisionTypeValue ;
1311use SimpleSAML \XML \Exception \{
1412 InvalidDOMElementException ,
1513 MissingElementException ,
1816};
1917use SimpleSAML \XML \{SchemaValidatableElementInterface , SchemaValidatableElementTrait };
2018use SimpleSAML \XML \Type \AnyURIValue ;
21- use ValueError ;
2219
2320use function array_pop ;
24- use function sprintf ;
21+ use function strval ;
2522
2623/**
2724 * Class representing a SAML2 AuthzDecisionStatement
@@ -36,15 +33,15 @@ final class AuthzDecisionStatement extends AbstractStatementType implements Sche
3633 /**
3734 * Initialize an AuthzDecisionStatement.
3835 *
39- * @param \SimpleSAML\SAML2 \Type\SAMLAnyURIValue $resource
40- * @param \SimpleSAML\SAML2\XML\Decision $decision
36+ * @param \SimpleSAML\XML \Type\AnyURIValue $resource
37+ * @param \SimpleSAML\SAML2\Type\DecisionTypeValue $decision
4138 * @param \SimpleSAML\SAML2\XML\saml\Action[] $action
4239 * @param \SimpleSAML\SAML2\XML\saml\Evidence|null $evidence
4340 */
4441 public function __construct (
4542 // Uses the base AnyURIValue because the SAML-specification allows this attribute to be an empty string
4643 protected AnyURIValue $ resource ,
47- protected Decision $ decision ,
44+ protected DecisionTypeValue $ decision ,
4845 protected array $ action ,
4946 protected ?Evidence $ evidence = null ,
5047 ) {
@@ -67,9 +64,9 @@ public function getResource(): AnyURIValue
6764 /**
6865 * Collect the value of the decision-property
6966 *
70- * @return \SimpleSAML\SAML2\XML\Decision
67+ * @return \SimpleSAML\SAML2\Type\DecisionTypeValue
7168 */
72- public function getDecision (): Decision
69+ public function getDecision (): DecisionTypeValue
7370 {
7471 return $ this ->decision ;
7572 }
@@ -130,16 +127,10 @@ public static function fromXML(DOMElement $xml): static
130127 TooManyElementsException::class,
131128 );
132129
133- $ decision = self ::getAttribute ($ xml , 'Decision ' , SAMLStringValue::class);
134- try {
135- $ decision = Decision::from ($ decision ->getValue ());
136- } catch (ValueError ) {
137- throw new ProtocolViolationException (sprintf ('Unknown value \'%s \' for Decision attribute. ' , $ decision ));
138- }
139130
140131 return new static (
141132 self ::getAttribute ($ xml , 'Resource ' , AnyURIValue::class),
142- $ decision ,
133+ self :: getAttribute ( $ xml , ' Decision ' , DecisionTypeValue::class) ,
143134 $ action ,
144135 array_pop ($ evidence ),
145136 );
@@ -156,8 +147,8 @@ public function toXML(?DOMElement $parent = null): DOMElement
156147 {
157148 $ e = $ this ->instantiateParentElement ($ parent );
158149
159- $ e ->setAttribute ('Resource ' , $ this ->getResource ()-> getValue ( ));
160- $ e ->setAttribute ('Decision ' , $ this ->getDecision ()-> value );
150+ $ e ->setAttribute ('Resource ' , strval ( $ this ->getResource ()));
151+ $ e ->setAttribute ('Decision ' , strval ( $ this ->getDecision ()) );
161152
162153 foreach ($ this ->getAction () as $ action ) {
163154 $ action ->toXML ($ e );
0 commit comments