• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

djopenid/H03-May-2022-994674

READMEH A D18-Jun-20102.9 KiB9256

__init__.pyH A D18-Jun-20100 10

consumer.pyH A D18-Jun-201017.8 KiB508401

discoverH A D18-Jun-20101.4 KiB4738

server.pyH A D18-Jun-201024 KiB722603

README

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