diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/README | 102 |
1 files changed, 97 insertions, 5 deletions
diff --git a/examples/README b/examples/README index 5fb79d1..55df59b 100644 --- a/examples/README +++ b/examples/README @@ -1,11 +1,44 @@ OpenID Example Code ------------------- -To try the example consumer implementation (which is probably what you -want), just copy the consumer/ directory into a place on your web -server and point your browser at the new directory. (Be sure that the -'Auth' directory included in this package is installed in your PHP -include_path.) +After you've installed this package (see ../README), you can use these +example packages to get started. They'll show you what this package +can do, and you can use them as the basis for your own OpenID support. + +consumer/: OpenID Example Consumer +================================== + +To try the example consumer implementation, just copy the consumer/ +directory into a place on your web server and point your browser at +the new directory. + +1. Check to be sure that /tmp is in your "open_basedir" configuration, + if open_basedir is being used to restrict PHP's file I/O. See + http://us2.php.net/features.safe-mode for more information. For + example, in your php.ini, change + + open_basedir = "..." + + to + + open_basedir = "/tmp:..." + + (If you really don't want to add /tmp to your open_basedir, you can + modify consumer/common.php and change $store_path so it doesn't + create the store directory in /tmp.) + +2. Copy or symlink the consumer/ directory into a part of your + webserver's docroot. For example, if your DocumentRoot is + /var/www/, do this: + + # cd /var/www + # ln -s /path/to/PHP-OpenID-X.Y.Z/examples/consumer + +3. Navigate to http://www.example.com/consumer and enter an OpenID + into the form presented there and click "Verify". + +consumer/ Files +=============== The 'index.php' file will render a form and get you started. These are the example consumer files: @@ -24,3 +57,62 @@ successful. consumer/common.php - Includes the setup code you'll need to create a Consumer object and participate in an OpenID authentication. + +server/: OpenID Example Server +============================== + +To try the example server, follow these steps: + +1. Customize server/config.php based on what your PHP installation + supports. The documentation in the file describes what each value + is for. + +2. Copy or symlink the server/ directory into a part of your + webserver's docroot. For example, if your DocumentRoot is + /var/www/, do this: + + # cd /var/www + # ln -s /path/to/PHP-OpenID-X.Y.Z/examples/server + +3. For each of the identity URLs you added to the $openid_users array + in config.php, add the following to the <HEAD> tag of the pages at + those URLs: + + <link rel="openid.server" href="http://www.example.com/server/server.php" /> + + Where "www.example.com/server" is the path to the server symlink + that you created in step (2). + +4. Navigate to http://www.example.com/server and click the "Log In" + link to test the OpenID(s) entered into the config file. + +5. Use the OpenID checkup tool to try authenticating with your OpenID: + + http://www.openidenabled.com/resources/openid-test/checkup + + If your OpenID server isn't on the public internet, you can use the + example consumer packaged with this library. See the consumer + section above. + +server/ Files +============= + +These files make up the server example code: + + config.php - The configuration file you'll need to customize to run +the example server. + + server.php - The PHP rendering script that takes care of handling +server requests from both regular user agents and consumers. + + lib/actions.php - Handles the various types of requests that the +server supports. + + lib/common.php - Supplies functions that wrap the OpenID API calls +to make them easier to use. + + lib/render.php - Miscellaneous page rendering code. + + lib/session.php - More miscellaneous page rendering code. + + lib/render/*.php - Files for each page presented by the server. |