From f0abca071f4bd47f152e6a8685bc18e545167f3c Mon Sep 17 00:00:00 2001 From: Wim Vandenhaute Date: Fri, 18 Mar 2016 08:51:01 +0100 Subject: [PATCH] IDMapping WS support dropped --- linkid-sdk-php/LinkIDIdMappingClient.php | 59 --------------- .../LinkIDIdMappingWSSoapClient.php | 73 ------------------- .../examples/ws/IdMappingWSExample.php | 12 --- 3 files changed, 144 deletions(-) delete mode 100644 linkid-sdk-php/LinkIDIdMappingClient.php delete mode 100644 linkid-sdk-php/LinkIDIdMappingWSSoapClient.php delete mode 100755 linkid-sdk-php/examples/ws/IdMappingWSExample.php diff --git a/linkid-sdk-php/LinkIDIdMappingClient.php b/linkid-sdk-php/LinkIDIdMappingClient.php deleted file mode 100644 index a24cb33..0000000 --- a/linkid-sdk-php/LinkIDIdMappingClient.php +++ /dev/null @@ -1,59 +0,0 @@ -/linkid-ws-username - * @param $username string the WS-Security username - * @param $password string the WS-Security password - * @param array $options [optional] - * - */ - public function __construct($linkIDHost, $username, $password, array $options = array()) - { - - $wsdlLocation = "https://" . $linkIDHost . "/linkid-ws-username/idmapping?wsdl"; - - $this->client = new LinkIDIdMappingWSSoapClient($wsdlLocation); - $this->client->__setUsernameToken($username, $password, 'PasswordDigest'); - } - - public function getUserId($attributeName, $identifier) - { - - $requestParams = new stdClass; - $requestParams->NameIDPolicy = new stdClass; - - // pass attributes to SOAP client, will create the request there using the DOM api - $this->client->__setAttributeName($attributeName); - $this->client->__setIdentifier($identifier); - - /** @noinspection PhpUndefinedMethodInspection */ - $response = $this->client->nameIdentifierMappingQuery($requestParams); - - // validate response status - $statusCode = $response->Status->StatusCode->Value; - if ($statusCode != "urn:oasis:names:tc:SAML:2.0:status:Success") { - - $secondLevelStatusCode = $response->Status->StatusCode->StatusCode->Value; - throw new Exception("Failed to get userId: " . $secondLevelStatusCode); - } - - return $response->NameID->_; - - } - -} \ No newline at end of file diff --git a/linkid-sdk-php/LinkIDIdMappingWSSoapClient.php b/linkid-sdk-php/LinkIDIdMappingWSSoapClient.php deleted file mode 100644 index d751333..0000000 --- a/linkid-sdk-php/LinkIDIdMappingWSSoapClient.php +++ /dev/null @@ -1,73 +0,0 @@ -attributeName = $attributeName; - } - - public function __setIdentifier($identifier) - { - - $this->identifier = $identifier; - } - - public function __doRequest($request, $location, $action, $version) - { - - $dom = new DOMDocument('1.0'); - - try { - - //loads the SOAP request to the Document - $dom->loadXML($request); - - } catch (DOMException $e) { - die('Parse error with code ' . $e->code); - } - - $path = new DOMXPath($dom); - - $itemList = $path->query('//*[local-name()="LinkIDNameIDMappingRequest"]'); - for ($i = 0; $i < $itemList->length; $i++) { - - $requestItem = $itemList->item($i); - /** @noinspection PhpUndefinedMethodInspection */ - $requestItem->setAttribute('AttributeType', $this->attributeName); - - $nameId = $dom->createElementNS($this->NS_SAML, 'NameID', $this->identifier); - $requestItem->appendChild($nameId); - - } - - $itemList = $path->query('//*[local-name()="NameIDPolicy"]'); - for ($i = 0; $i < $itemList->length; $i++) { - - $nameIDPolicy = $itemList->item($i); - /** @noinspection PhpUndefinedMethodInspection */ - $nameIDPolicy->setAttribute('Format', 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent'); - /** @noinspection PhpUndefinedMethodInspection */ - $nameIDPolicy->setAttribute('AllowCreate', 'true'); - } - - //save the modified SOAP request - $request = $dom->saveXML(); - - $result = parent::__doRequest($request, $location, $action, $version); - return $result; - } - -} \ No newline at end of file diff --git a/linkid-sdk-php/examples/ws/IdMappingWSExample.php b/linkid-sdk-php/examples/ws/IdMappingWSExample.php deleted file mode 100755 index b009ca0..0000000 --- a/linkid-sdk-php/examples/ws/IdMappingWSExample.php +++ /dev/null @@ -1,12 +0,0 @@ -getUserId("profile.email.address", "wim.vandenhaute@gmail.com"); - -print("

IdMapping test

"); -print("UserID: " . $userId); - -?>