README 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. Python OpenID library example code
  2. ==================================
  3. The examples directory contains working code illustrating the use of
  4. the library for performing OpenID authentication, both as a consumer
  5. and a server. There are two kinds of examples, one that can run
  6. without any external dependencies, and one that uses the Django Web
  7. framework. The examples do not illustrate how to use all of the
  8. features of the library, but they should be a good starting point to
  9. see how to use this library with your code.
  10. Both the Django libraries and the BaseHTTPServer examples require that
  11. the OpenID library is installed or that it has been added to Python's
  12. search path (PYTHONPATH environment variable or sys.path).
  13. The Django example is probably a good place to start reading the
  14. code. There is little that is Django-specific about the OpenID logic
  15. in the example, and it should be easy to port to any framework. To run
  16. the django examples, see the README file in the djopenid subdirectory.
  17. The other examples use Python's built-in BaseHTTPServer and have a
  18. good deal of ad-hoc dispatching and rendering code mixed in
  19. Using the BaseHTTPServer examples
  20. =================================
  21. This directory contains a working server and consumer that use this
  22. OpenID library. They are both written using python's standard
  23. BaseHTTPServer.
  24. To run the example system:
  25. 1. Make sure you've installed the library, as explained in the
  26. installation instructions.
  27. 2. Start the consumer server:
  28. python consumer.py --port 8001
  29. 3. In another terminal, start the identity server:
  30. python server.py --port 8000
  31. (Hit Ctrl-C in either server's window to stop that server.)
  32. 4. Open your web broswer, and go to the consumer server:
  33. http://localhost:8001/
  34. Note that all pages the consumer server shows will have "Python OpenID
  35. Consumer Example" across the top.
  36. 5. Enter an identity url managed by the sample identity server:
  37. http://localhost:8000/id/bob
  38. 6. The browser will be redirected to the sample server, which will be
  39. requesting that you log in to proceed. Enter the username for the
  40. identity URL into the login box:
  41. bob
  42. Note that all pages the identity server shows will have "Python
  43. OpenID Server Example" across the top.
  44. 7. After you log in as bob, the server example will ask you if you
  45. want to allow http://localhost:8001/ to know your identity. Say
  46. yes.
  47. 8. You should end up back on the consumer site, at a page indicating
  48. you've logged in successfully.
  49. That's a basic OpenID login procedure. You can continue through it,
  50. playing with variations to see how they work. The python code is
  51. intended to be a straightforward example of how to use the python
  52. OpenID library to function as either an identity server or consumer.
  53. Getting help
  54. ============
  55. Please send bug reports, patches, and other feedback to
  56. http://openid.net/developers/dev-mailing-lists/