summaryrefslogtreecommitdiffstats
path: root/examples/README
blob: b6cbb67bee761b223daa846a0fd49bfe6f330228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
OpenID Example Code
-------------------

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
==================================

NOTE: If you want to try the example consumer without installing this
package, just make sure you add the package's 'Auth' directory to your
PHP include path.

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:

  consumer/index.php - Renders a form so you can begin the OpenID auth
process.  The form submits the OpenID to try_auth.php.

  consumer/try_auth.php - Starts the authentication with the OpenID
server that manages your OpenID and redirects your browser to the
server's login page.  Instructs the server to return to
finish_auth.php when you're done authenticating.

  consumer/finish_auth.php - Finishes the authentication by checking
the server's response.  Tells you if the authentication was
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 - Code to handle session data for user settings.

  lib/render/*.php - Files for each page presented by the server.