readme 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. OpenID Example Code
  2. -------------------
  3. After you've installed this package (see ../README), you can use these
  4. example packages to get started. They'll show you what this package
  5. can do, and you can use them as the basis for your own OpenID support.
  6. consumer/: OpenID Example Consumer
  7. ==================================
  8. NOTE: If you want to try the example consumer without installing this
  9. package, just make sure you add the package's 'Auth' directory to your
  10. PHP include path.
  11. To try the example consumer implementation, just copy the consumer/
  12. directory into a place on your web server and point your browser at
  13. the new directory.
  14. 1. Check to be sure that /tmp is in your "open_basedir" configuration,
  15. if open_basedir is being used to restrict PHP's file I/O. See
  16. http://us2.php.net/features.safe-mode for more information. For
  17. example, in your php.ini, change
  18. open_basedir = "..."
  19. to
  20. open_basedir = "/tmp:..."
  21. (If you really don't want to add /tmp to your open_basedir, you can
  22. modify consumer/common.php and change $store_path so it doesn't
  23. create the store directory in /tmp.)
  24. 2. Copy or symlink the consumer/ directory into a part of your
  25. webserver's docroot. For example, if your DocumentRoot is
  26. /var/www/, do this:
  27. # cd /var/www
  28. # ln -s /path/to/PHP-OpenID-X.Y.Z/examples/consumer
  29. 3. Navigate to http://www.example.com/consumer and enter an OpenID
  30. into the form presented there and click "Verify".
  31. consumer/ Files
  32. ===============
  33. The 'index.php' file will render a form and get you started. These
  34. are the example consumer files:
  35. consumer/index.php - Renders a form so you can begin the OpenID auth
  36. process. The form submits the OpenID to try_auth.php.
  37. consumer/try_auth.php - Starts the authentication with the OpenID
  38. server that manages your OpenID and redirects your browser to the
  39. server's login page. Instructs the server to return to
  40. finish_auth.php when you're done authenticating.
  41. consumer/finish_auth.php - Finishes the authentication by checking
  42. the server's response. Tells you if the authentication was
  43. successful.
  44. consumer/common.php - Includes the setup code you'll need to create
  45. a Consumer object and participate in an OpenID authentication.
  46. server/: OpenID Example Server
  47. ==============================
  48. To try the example server, follow these steps:
  49. 1. Copy or symlink the server/ directory into a part of your
  50. webserver's docroot. For example, if your DocumentRoot is
  51. /var/www/, do this:
  52. # cd /var/www
  53. # ln -s /path/to/PHP-OpenID-X.Y.Z/examples/server
  54. 2. Navigate to the server example. You'll be redirected to
  55. server/setup.php where you can choose some configuration options to
  56. generate a configuration. Once finished, you can download a file
  57. "config.php." Save that file in the example server directory.
  58. The example server has the following features:
  59. - It serves its own identity pages, whose URLs are of the form
  60. http://.../server/server.php/idpage?user=USERNAME
  61. - It does not require passwords.
  62. - It does not support a "trusted sites" page, as you pointed out.
  63. In general, the example server is NOT supposed to be treated as a
  64. fully-equiped OpenID server (i.e., with user accounts and other
  65. state). It is supposed to demonstrate how to write PHP applications
  66. that use the library.
  67. Upgrading from the 1.X.X example server
  68. =======================================
  69. The 2.X.X library's example server is different from the 1.X.X example
  70. server in the following ways:
  71. - The new example server does not support authenticating arbitrary
  72. URLs. It serves its own URLs. This makes it easier to set up and
  73. test.
  74. - The new example server does not support password authentication.
  75. This makes it easier to set up and is not necessary for
  76. illustrating the use of the library.
  77. - The new example server does not have a "trusted sites" page.
  78. server/ Files
  79. =============
  80. These files make up the server example code:
  81. config.php - The configuration file you'll need to customize to run
  82. the example server.
  83. server.php - The PHP rendering script that takes care of handling
  84. server requests from both regular user agents and consumers.
  85. lib/actions.php - Handles the various types of requests that the
  86. server supports.
  87. lib/common.php - Supplies functions that wrap the OpenID API calls
  88. to make them easier to use.
  89. lib/render.php - Miscellaneous page rendering code.
  90. lib/session.php - Code to handle session data for user settings.
  91. lib/render/*.php - Files for each page presented by the server.