diff options
author | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-06 16:24:26 +0000 |
---|---|---|
committer | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-06 16:24:26 +0000 |
commit | 7acad8e5e7a56a2413d4fb18df919e0839cd7571 (patch) | |
tree | 9dceba29a50bc299f102629729db49d1be5fcedc /php/Attic/examples/sample-idp/soapEndpoint.php | |
parent | aab4db8ebcce9d5263a3c1a898d011711876a01d (diff) | |
download | lasso-7acad8e5e7a56a2413d4fb18df919e0839cd7571.tar.gz lasso-7acad8e5e7a56a2413d4fb18df919e0839cd7571.tar.xz lasso-7acad8e5e7a56a2413d4fb18df919e0839cd7571.zip |
PHP Idp Sample :
- form for creating metadata
- sso support
- small README with installation instruction
Diffstat (limited to 'php/Attic/examples/sample-idp/soapEndpoint.php')
-rw-r--r-- | php/Attic/examples/sample-idp/soapEndpoint.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/php/Attic/examples/sample-idp/soapEndpoint.php b/php/Attic/examples/sample-idp/soapEndpoint.php index 11cfd52b..84b60bf7 100644 --- a/php/Attic/examples/sample-idp/soapEndpoint.php +++ b/php/Attic/examples/sample-idp/soapEndpoint.php @@ -22,4 +22,70 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + require_once 'DB.php'; + + header("Content-Type: text/xml\r\n"); + + if (empty($HTTP_RAW_POST_DATA)) + die("HTTP_RAW_POST_DATA is empty!"); + + $config = unserialize(file_get_contents('config.inc')); + + $server_dump = file_get_contents($config['server_dump_filename']); + + lasso_init(); + + $requestype = lasso_getRequestTypeFromSoapMsg($HTTP_RAW_POST_DATA); + $server = LassoServer::newfromdump($server_dump); + + $db = &DB::connect($config['dsn']); + + if (DB::isError($db)) + die($db->getMessage()); + + switch ($requestype) + { + // Login + case lassoRequestTypeLogin: + $login = new LassoLogin($server); + $login->processRequestMsg($HTTP_RAW_POST_DATA); + $artifact = $login->assertionArtifact; + + $query = "SELECT response_dump FROM assertions WHERE assertion='"; + $query .= $artifact ."'"; + + $res =& $db->query($query); + if (DB::isError($res)) + die($res->getMessage()); + + // Good Artifact, send reponse_dump + if ($res->numRows()) + { + $row = $res->fetchRow(); + + $query = "DELETE FROM assertions WHERE assertion='" . $artifact . "'"; + + $res =& $db->query($query); + if (DB::isError($res)) + die($res->getMessage()); + header("Content-Length: " . strlen($row[0]) . "\r\n"); + echo $row[0]; + } + else + { + // Wrong Artifact + header("HTTP/1.0 403 Forbidden"); + header("Content-Length: 0\r\n"); + exit; + } + break; + case lassoRequestTypeLogout: + break; + case lassoRequestTypeDefederation: + break; + default: + die("Unkown request type!"); + } + + lasso_shutdown(); ?> |