Last active
June 4, 2019 10:09
-
-
Save zargyle/52621165e3f7e1edbd14 to your computer and use it in GitHub Desktop.
Salesforce Delegated Authentication PHP Web Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once "nusoap/lib/nusoap.php"; | |
//create the server. | |
$server = new soap_server; | |
//set configuration for the web service's WSDL. | |
$server->configureWSDL('authentication.soap.sforce.com','urn:authentication.soap.sforce.com','',"document"); | |
//register an action called Authenticate. | |
$server->register( | |
'Authenticate', | |
array('username'=>'xsd:string','password'=>'xsd:string','sourceIp'=>'xsd:string'), | |
array('Authenticated'=>'xsd:boolean') | |
); | |
function Authenticate($username, $password, $sourceIp) { | |
try{ | |
$valid = false; | |
//Authenticate request here | |
return $valid; | |
} catch (Exception $e) { | |
//write error message a log file $e->getMessage(); | |
return false; | |
} | |
} | |
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; | |
$server->service($HTTP_RAW_POST_DATA); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment