Skip to content
Snippets Groups Projects
Commit dd35c014 authored by Olav Morken's avatar Olav Morken
Browse files

Added code to retrieve the ID used in a LogoutRequest and the InResponseTo...

Added code to retrieve the ID used in a LogoutRequest and the InResponseTo attribute from a LogoutResponse.


git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@541 44740490-163a-0410-bde0-09ae8108e29a
parent 651edcb5
No related branches found
No related tags found
No related merge requests found
......@@ -23,9 +23,19 @@ class SimpleSAML_XML_SAML20_LogoutRequest {
const PROTOCOL = 'urn:oasis:names:tc:SAML:2.0';
/**
* This variable holds the generated request id for this request.
*/
private $id = null;
function __construct(SimpleSAML_Configuration $configuration, SimpleSAML_Metadata_MetaDataStorageHandler $metadatastore) {
$this->configuration = $configuration;
$this->metadata = $metadatastore;
/* Generate request id. */
$this->id = SimpleSAML_Utilities::generateID();
}
public function setXML($xml) {
......@@ -128,7 +138,6 @@ class SimpleSAML_XML_SAML20_LogoutRequest {
$spnamequalifier = isset($issuermd['SPNameQualifier']) ? $issuermd['SPNameQualifier'] : $issuermd['entityid'];
}
$id = SimpleSAML_Utilities::generateID();
$issueInstant = SimpleSAML_Utilities::generateTimestamp();
$destination = $receivermd['SingleLogoutService'];
......@@ -136,7 +145,7 @@ class SimpleSAML_XML_SAML20_LogoutRequest {
$logoutRequest = '<samlp:LogoutRequest
xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
ID="' . $id . '" Version="2.0"
ID="' . $this->id . '" Version="2.0"
Destination="' . htmlspecialchars($destination) . '"
IssueInstant="' . $issueInstant . '">
<saml:Issuer >' . htmlspecialchars($issuer) . '</saml:Issuer>
......@@ -147,6 +156,16 @@ class SimpleSAML_XML_SAML20_LogoutRequest {
return $logoutRequest;
}
/**
* This function retrieves the request id we used for the generated logout request.
*
* @return The request id of the generated logout request.
*/
public function getGeneratedID() {
return $this->id;
}
}
?>
\ No newline at end of file
......@@ -81,6 +81,26 @@ class SimpleSAML_XML_SAML20_LogoutResponse {
return $issuer;
}
/**
* This function retrieves the InResponseTo attribute value from the logout response.
*
* @return The InResponseTo attribute value from the logout response.
*/
public function getInResponseTo() {
$dom = $this->getDOM();
$responseElement = $dom->getElementsByTagName('LogoutResponse')->item(0);
$inResponseTo = $responseElement->getAttribute('InResponseTo');
if(empty($inResponseTo)) {
throw new Exception('Empty InResponseTo attribute on SAML2 logout response.');
}
return $inResponseTo;
}
// Not updated for response. from request.
public function generate($issuer, $receiver, $inresponseto, $mode ) {
if (!in_array($mode, array('SP', 'IdP'))) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment