diff options
| author | Damien Laniel <dlaniel@entrouvert.com> | 2006-03-19 19:01:05 +0000 |
|---|---|---|
| committer | Damien Laniel <dlaniel@entrouvert.com> | 2006-03-19 19:01:05 +0000 |
| commit | 94a496468af1f5c835d1b990fb8b2913bc8fb5ba (patch) | |
| tree | f7b86157685bdb2aafef36cb9c340c927f86c3c1 /docs | |
| parent | ab3167fba53bab17c6b8fdce41fbf8cfe931111d (diff) | |
| download | lasso-94a496468af1f5c835d1b990fb8b2913bc8fb5ba.tar.gz lasso-94a496468af1f5c835d1b990fb8b2913bc8fb5ba.tar.xz lasso-94a496468af1f5c835d1b990fb8b2913bc8fb5ba.zip | |
fixed doc writing-a-php-sp.txt
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/lasso-book/writing-a-php-sp.txt | 64 |
1 files changed, 35 insertions, 29 deletions
diff --git a/docs/lasso-book/writing-a-php-sp.txt b/docs/lasso-book/writing-a-php-sp.txt index 9d44ca0e..235383f8 100644 --- a/docs/lasso-book/writing-a-php-sp.txt +++ b/docs/lasso-book/writing-a-php-sp.txt @@ -14,10 +14,19 @@ Writing a Liberty service Provider in PHP Lasso PHP Binding Basics ======================== -Lasso functions are available from the LASSO php extension. +Lasso functions are available from the Lasso php extension. -In order to load the lasso extension you juste have to add the lasso PHP extension in your -``php.ini`` configuration file, or try to load it dynamicaly, like:: +There are two ways to load this extension. + +This first one is to add the line : + + extension = lasso.so + +in your ``php.ini`` configuration file, which can be found in something like /etc/php4/apache2/php.ini +(if you're using apache2 and php4, otherwise adpat the path to your configuration). + + +The other way is to load it dynamicaly, like:: if (!extension_loaded('lasso')) { @@ -63,7 +72,7 @@ available in a ``LassoServer`` object. The ``LassoServer`` object may be created as follows:: lasso_init(); - $server = &new LassoServer("sp-metadata.xml", "sp-private-key.pem", + $server = new LassoServer("sp-metadata.xml", "sp-private-key.pem", "sp-crt.pem", LASSO_SIGNATURE_METHOD_RSA_SHA1); $server->addProvider(LASSO_PROVIDER_ROLE_IDP, "idp-metadata.xml", "idp-public-key.pem", "ca-crt.pem"); @@ -95,9 +104,9 @@ Serialization It is then really easy to get back properly constructed objects:: - $lspk_server = &LassoServer::newFromDump($dump); + $lspk_server = LassoServer::newFromDump($dump); -.. warning:: The server dump only contains the filenames; not the actual file +.. warning:: The server dump only contains the filenames, not the actual file contents. Files should not be moved afterwards. @@ -151,11 +160,11 @@ match a providerID defined in the metadata file). :: - $lassoLogin = &new LassoLogin($server); + $lassoLogin = new LassoLogin($server); $lassoLogin->initAuthnRequest($idpProviderId, LASSO_HTTP_METHOD_REDIRECT); $lassoRequest = $lassoLogin->request; $lassoRequest->NameIDPolicy = LASSO_LIB_NAMEID_POLICY_TYPE_FEDERATED; - $lassoRequest->consent = LASSO_LIB_CONSENT_UNAVAILABLE; + $lassoRequest->consent = LASSO_LIB_CONSENT_OBTAINED; $lassoRequest->ForceAuthn = 0; $lassoRequest->IsPassive = 0; $lassoRequest->relayState = "relay state"; @@ -163,10 +172,10 @@ match a providerID defined in the metadata file). $lassoLogin->buildAuthnRequestMsg(); -You can now redirect the user to the URL defined in ``$lassoLogin->msg_url``; for +You can now redirect the user to the URL defined in ``$lassoLogin->msgUrl``; for example:: - header("Location: ".$lassoLogin->msg_url); + header("Location: ".$lassoLogin->msgUrl); The user then logs in on the identity provider which ultimately redirects back @@ -178,13 +187,13 @@ passed in the query parameter. :: - $lassoLogin = &new LassoLogin($lspk_server); + $lassoLogin = new LassoLogin($lspk_server); $lassoLogin->initRequest($query_string, LASSO_HTTP_METHOD_REDIRECT); $lassoLogin->buildRequestMsg(); The service provider must check this artifact using a SOAP request to the -identity provider. The URL is ``$lassoLogin->msg_url`` while the -request is ``$lassoLogin->msg_body``. The request must succeed with +identity provider. The URL is ``$lassoLogin->msgUrl`` while the +request is ``$lassoLogin->msgBody``. The request must succeed with an HTTP 200 status code; let's consider its content is put in the ``$answer``, the next statement would be:: @@ -217,16 +226,14 @@ provider; this is a good opportunity to ask the user for more information. You can get respective dumps like this:: - if($lassoLogin->isIdentityDirty()) - { - $lassoIdentity = $lassoLogin->identity; - $lassoIdentityDump = $lassoIdentity->dump(); + if($lassoLogin->isIdentityDirty) { + $lassoIdentity = $lassoLogin->identity; + $lassoIdentityDump = $lassoIdentity->dump(); } - - if(lassoLogin->isSessionDirty()) - { - $lassoSession = $lassoLogin->session; - $lassoSessionDump = $lassoSession->dump(); + + if($lassoLogin->isSessionDirty) { + $lassoSession = $lassoLogin->session; + $lassoSessionDump = $lassoSession->dump(); } /* code to store $identity_dump and $session_dump */ @@ -246,27 +253,26 @@ This part is about a logout using SOAP and initiated on the service provider. :: - $lassoLogout = &new LassoLogout($server); + $lassoLogout = new LassoLogout($server); Identity and session dumps should be restored to prepare the logout request. :: - if ($session_dump != NULL) - { - $lassoLogout->setSessionFromDump($session_dump); + if ($session_dump != NULL) { + $lassoLogout->setSessionFromDump($session_dump); } if ($identity_dump != NULL) { - lassoLogout->setIdentiyFromDump($identity_dump); + $lassoLogout->setIdentityFromDump($identity_dump); } - + $lassoLogout->initRequest($idpProviderId, LASSO_HTTP_METHOD_SOAP); $lassoLogout->buildRequestMsg(); The service provider must then make a SOAP request to the identity provider; -``$msg_url`` and ``$msg_body``. You should then pass the answer to Lasso:: +``$msgUrl`` and ``$msgBody``. You should then pass the answer to Lasso:: $lassoLogout->processResponseMsg($answer)); |
