~ubuntu-branches/ubuntu/hardy/libapache2-mod-python/hardy

« back to all changes in this revision

Viewing changes to doc-html/hand-pub-alg-auth.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2006-03-20 19:05:14 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060320190514-7gcx7mdusfp5it8r
Tags: 3.1.4-0ubuntu1
* Merge with Debian a little bit harder, minimising our diffs a bit.
* New upstream release, containing no changes other than the security
  fix for CVE-2005-0088 and an externally-visible module version bump.
* Tweak configure.in with upstream fix to resolve FTBFS with bash 3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2
2
<html>
3
3
<head>
 
4
<link rel="STYLESHEET" href="modpython.css" type='text/css' />
 
5
<link rel="first" href="modpython.html" title='Mod_python Manual' />
 
6
<link rel='contents' href='contents.html' title="Contents" />
 
7
<link rel='index' href='genindex.html' title='Index' />
 
8
<link rel='last' href='about.html' title='About this document...' />
 
9
<link rel='help' href='about.html' title='About this document...' />
 
10
<link rel="prev" href="hand-pub-alg-args.html" />
 
11
<link rel="parent" href="hand-pub-alg.html" />
 
12
<link rel="next" href="node92.html" />
 
13
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
 
14
<meta name='aesop' content='information' />
4
15
<title>6.1.2.3 Authentication</title>
5
 
<META NAME="description" CONTENT="6.1.2.3 Authentication">
6
 
<META NAME="keywords" CONTENT="modpython">
7
 
<META NAME="resource-type" CONTENT="document">
8
 
<META NAME="distribution" CONTENT="global">
9
 
<link rel="STYLESHEET" href="modpython.css">
10
 
<link rel="first" href="modpython.html">
11
 
<link rel="contents" href="contents.html" title="Contents">
12
 
<link rel="index" href="genindex.html" title="Index">
13
 
<LINK REL="previous" href="hand-pub-alg-args.html">
14
 
<LINK REL="up" href="hand-pub-alg.html">
15
 
<LINK REL="next" HREF="node92.html">
16
16
</head>
17
17
<body>
18
18
<DIV CLASS="navigation">
 
19
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
19
20
<table align="center" width="100%" cellpadding="0" cellspacing="2">
20
21
<tr>
21
 
<td><A href="hand-pub-alg-args.html"><img src="icons/previous.gif"
22
 
  border="0" height="32"
23
 
  alt="Previous Page" width="32"></A></td>
24
 
<td><A href="hand-pub-alg.html"><img src="icons/up.gif"
25
 
  border="0" height="32"
26
 
  alt="Up One Level" width="32"></A></td>
27
 
<td><A HREF="node92.html"><img src="icons/next.gif"
28
 
  border="0" height="32"
29
 
  alt="Next Page" width="32"></A></td>
 
22
<td class='online-navigation'><a rel="prev" title="6.1.2.2 Argument Matching and"
 
23
  href="hand-pub-alg-args.html"><img src='previous.png'
 
24
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
25
<td class='online-navigation'><a rel="parent" title="6.1.2 The Publishing Algorithm"
 
26
  href="hand-pub-alg.html"><img src='up.png'
 
27
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
28
<td class='online-navigation'><a rel="next" title="6.1.3 Form Data"
 
29
  href="node92.html"><img src='next.png'
 
30
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
30
31
<td align="center" width="100%">Mod_python Manual</td>
31
 
<td><A href="contents.html"><img src="icons/contents.gif"
32
 
  border="0" height="32"
33
 
  alt="Contents" width="32"></A></td>
34
 
<td><img src="icons/blank.gif"
35
 
  border="0" height="32"
36
 
  alt="" width="32"></td>
37
 
<td><A href="genindex.html"><img src="icons/index.gif"
38
 
  border="0" height="32"
39
 
  alt="Index" width="32"></A></td>
 
32
<td class='online-navigation'><a rel="contents" title="Table of Contents"
 
33
  href="contents.html"><img src='contents.png'
 
34
  border='0' height='32'  alt='Contents' width='32' /></A></td>
 
35
<td class='online-navigation'><img src='blank.png'
 
36
  border='0' height='32'  alt='' width='32' /></td>
 
37
<td class='online-navigation'><a rel="index" title="Index"
 
38
  href="genindex.html"><img src='index.png'
 
39
  border='0' height='32'  alt='Index' width='32' /></A></td>
40
40
</tr></table>
41
 
<b class="navlabel">Previous:</b> <a class="sectref" href="hand-pub-alg-args.html">6.1.2.2 Argument Matching and</A>
42
 
<b class="navlabel">Up:</b> <a class="sectref" href="hand-pub-alg.html">6.1.2 The Publishing Algorithm</A>
43
 
<b class="navlabel">Next:</b> <a class="sectref" HREF="node92.html">6.1.3 Form Data</A>
44
 
<br><hr>
 
41
<div class='online-navigation'>
 
42
<b class="navlabel">Previous:</b>
 
43
<a class="sectref" rel="prev" href="hand-pub-alg-args.html">6.1.2.2 Argument Matching and</A>
 
44
<b class="navlabel">Up:</b>
 
45
<a class="sectref" rel="parent" href="hand-pub-alg.html">6.1.2 The Publishing Algorithm</A>
 
46
<b class="navlabel">Next:</b>
 
47
<a class="sectref" rel="next" href="node92.html">6.1.3 Form Data</A>
 
48
</div>
 
49
<hr /></div>
45
50
</DIV>
46
51
<!--End of Navigation Panel-->
47
52
 
48
 
<H3><A NAME="SECTION008123000000000000000">&nbsp;</A>
 
53
<H3><A NAME="SECTION008123000000000000000"></A><A NAME="hand-pub-alg-auth"></A>
49
54
<BR>
50
55
6.1.2.3 Authentication
51
56
</H3>
103
108
In the example below, only user "<tt class="samp">eggs</tt>" with password "<tt class="samp">spam</tt>"can access the <code>hello</code> function:
104
109
 
105
110
<P>
106
 
<dl><dd><pre class="verbatim">
 
111
<div class="verbatim"><pre>
107
112
  __auth_realm__ = "Members only"
108
113
 
109
114
  def __auth__(req, user, passwd):
122
127
 
123
128
  def hello(req):
124
129
  return "hello"
125
 
</pre></dl>
 
130
</pre></div>
126
131
 
127
132
<P>
128
133
Here is the same functionality, but using an alternative technique:
129
134
 
130
135
<P>
131
 
<dl><dd><pre class="verbatim">
 
136
<div class="verbatim"><pre>
132
137
  __auth_realm__ = "Members only"
133
138
  __auth__ = {"eggs":"spam", "joe":"eoj"}
134
139
  __access__ = ["eggs"]
135
140
 
136
141
  def hello(req):
137
142
  return "hello"
138
 
</pre></dl>
 
143
</pre></div>
139
144
 
140
145
<P>
141
146
Since functions cannot be assigned attributes, to protect a function,
143
148
the function, e.g.:
144
149
 
145
150
<P>
146
 
<dl><dd><pre class="verbatim">
 
151
<div class="verbatim"><pre>
147
152
  def sensitive(req):
148
153
 
149
154
  def __auth__(req, user, password):
156
161
 
157
162
  # something involving sensitive information
158
163
  return 'sensitive information`
159
 
</pre></dl>
 
164
</pre></div>
160
165
 
161
166
<P>
162
167
Note that this technique will also work if <code>__auth__</code> or
190
195
<P>
191
196
 
192
197
<DIV CLASS="navigation">
193
 
<p><hr>
 
198
<div class='online-navigation'>
 
199
<p></p><hr />
194
200
<table align="center" width="100%" cellpadding="0" cellspacing="2">
195
201
<tr>
196
 
<td><A href="hand-pub-alg-args.html"><img src="icons/previous.gif"
197
 
  border="0" height="32"
198
 
  alt="Previous Page" width="32"></A></td>
199
 
<td><A href="hand-pub-alg.html"><img src="icons/up.gif"
200
 
  border="0" height="32"
201
 
  alt="Up One Level" width="32"></A></td>
202
 
<td><A HREF="node92.html"><img src="icons/next.gif"
203
 
  border="0" height="32"
204
 
  alt="Next Page" width="32"></A></td>
 
202
<td class='online-navigation'><a rel="prev" title="6.1.2.2 Argument Matching and"
 
203
  href="hand-pub-alg-args.html"><img src='previous.png'
 
204
  border='0' height='32'  alt='Previous Page' width='32' /></A></td>
 
205
<td class='online-navigation'><a rel="parent" title="6.1.2 The Publishing Algorithm"
 
206
  href="hand-pub-alg.html"><img src='up.png'
 
207
  border='0' height='32'  alt='Up One Level' width='32' /></A></td>
 
208
<td class='online-navigation'><a rel="next" title="6.1.3 Form Data"
 
209
  href="node92.html"><img src='next.png'
 
210
  border='0' height='32'  alt='Next Page' width='32' /></A></td>
205
211
<td align="center" width="100%">Mod_python Manual</td>
206
 
<td><A href="contents.html"><img src="icons/contents.gif"
207
 
  border="0" height="32"
208
 
  alt="Contents" width="32"></A></td>
209
 
<td><img src="icons/blank.gif"
210
 
  border="0" height="32"
211
 
  alt="" width="32"></td>
212
 
<td><A href="genindex.html"><img src="icons/index.gif"
213
 
  border="0" height="32"
214
 
  alt="Index" width="32"></A></td>
 
212
<td class='online-navigation'><a rel="contents" title="Table of Contents"
 
213
  href="contents.html"><img src='contents.png'
 
214
  border='0' height='32'  alt='Contents' width='32' /></A></td>
 
215
<td class='online-navigation'><img src='blank.png'
 
216
  border='0' height='32'  alt='' width='32' /></td>
 
217
<td class='online-navigation'><a rel="index" title="Index"
 
218
  href="genindex.html"><img src='index.png'
 
219
  border='0' height='32'  alt='Index' width='32' /></A></td>
215
220
</tr></table>
216
 
<b class="navlabel">Previous:</b> <a class="sectref" href="hand-pub-alg-args.html">6.1.2.2 Argument Matching and</A>
217
 
<b class="navlabel">Up:</b> <a class="sectref" href="hand-pub-alg.html">6.1.2 The Publishing Algorithm</A>
218
 
<b class="navlabel">Next:</b> <a class="sectref" HREF="node92.html">6.1.3 Form Data</A>
219
 
<hr>
220
 
<span class="release-info">Release 3.1.3, documentation updated on February 17, 2004.</span>
 
221
<div class='online-navigation'>
 
222
<b class="navlabel">Previous:</b>
 
223
<a class="sectref" rel="prev" href="hand-pub-alg-args.html">6.1.2.2 Argument Matching and</A>
 
224
<b class="navlabel">Up:</b>
 
225
<a class="sectref" rel="parent" href="hand-pub-alg.html">6.1.2 The Publishing Algorithm</A>
 
226
<b class="navlabel">Next:</b>
 
227
<a class="sectref" rel="next" href="node92.html">6.1.3 Form Data</A>
 
228
</div>
 
229
</div>
 
230
<hr />
 
231
<span class="release-info">Release 3.1.3, documentation updated on January 29, 2005.</span>
221
232
</DIV>
222
233
<!--End of Navigation Panel-->
223
234