summaryrefslogtreecommitdiffstats
path: root/lib/SAML2/ArtifactResolve.php
blob: b0e100649cc6836733e8cb4160a4cd8f0f7e4a02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
 * The Artifact is part of the SAML 2.0 IdP code, and it builds an artifact object.
 * I am using strings, because I find them easier to work with.
 * I want to use this, to be consistent with the other saml2_requests
 *
 * @author Danny Bollaert, UGent AS. <danny.bollaert@ugent.be>
 * @package simpleSAMLphp
 * @version $Id$
 */
class SAML2_ArtifactResolve extends SAML2_Request {


	private  $artifact;



	public function __construct(DOMElement $xml = NULL) {
		parent::__construct('ArtifactResolve', $xml);

		if(!is_null($xml)){
			$results = SAML2_Utils::xpQuery($xml, './saml_protocol:Artifact');
			$this->artifact = $results[0]->textContent;
		}

	}


	/**
	 * Retrieve the Artifact in this response.
	 *
	 * @return string artifact.
	 */
	public function getArtifact() {
		return $this->artifact;
	}


	/**
	 * Set the artifact that should be included in this response.
	 *
	 * @param String  The $artifact.
	 */
	public function setArtifact($artifact) {
		assert('is_string($artifact)');
		$this->artifact = $artifact;
	}

	/**
	 * Convert the response message to an XML element.
	 *
	 * @return DOMElement  This response.
	 */
	public function toUnsignedXML() {

		$root = parent::toUnsignedXML();
		$artifactelement = $this->document->createElementNS(SAML2_Const::NS_SAMLP, 'Artifact', $this->artifact);
		$root->appendChild($artifactelement);
		return $root;
	}




}