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 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>1.2.1 Module</title>
<META NAME="description" CONTENT="1.2.1 Module">
<META NAME="keywords" CONTENT="lib">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="lib.css" type='text/css'>
<link rel="first" href="lib.html">
<link rel="contents" href="contents.html" title="Contents">
<LINK REL="next" HREF="node7.html">
<LINK REL="previous" href="module-HttpAuthenticate.html">
<LINK REL="up" href="module-HttpAuthenticate.html">
<LINK REL="next" HREF="node7.html">
<meta name='aesop' content='information'>
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-HttpAuthenticate.html"><img src="../icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-HttpAuthenticate.html"><img src="../icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node7.html"><img src="../icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">CherryPy Standard Library Reference</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-HttpAuthenticate.html">1.2 HttpAuthenticate </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-HttpAuthenticate.html">1.2 HttpAuthenticate </A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node7.html">1.2.2 Example</A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION003210000000000000000">
1.2.1 Module</A>
</H2>
This module allows you to protect a part of your website with a login and a password, using a basic
HTTP authentication scheme.
<P>
All you have to do is declare a CherryClass that inherits from <var>HttpAuthenticate</var>, and all your masks
and views will be automatically protected.
<P>
To perform this magic, <var>HttpAuthenticate</var> uses AOP (aspect oriented programming). This basically means
that it will add some extra code at the beginning of each of your masks and views.
<P>
You may override the following methods:
<P>
<dl><dt><b><a name="l2h-6"><tt class="function">function: getPasswordListForLogin</tt></a></b>(<var>login</var>)
<dd>
This is where you specify what the valid login/password combinations are. The input value is the login that the
user entered. The method should return a list of all valid passwords for this login. If the login is incorrect, just
return an empty list.
<P>
Note: Being able to return several matching passwords for a login allows you to keep a "master key" password that works
with all logins.
</dl>
<P>
<dl><dt><b><a name="l2h-7"><tt class="function">mask or view: unauthorized</tt></a></b>()
<dd>
This is the page that is displayed when the user entered an incorrect login/password 3 times in a row.
</dl>
<P>
<dl><dt><b><a name="l2h-8"><tt class="member">variable: login</tt></a></b>
<dd>
String containing the login of the user that is logged in. The string is empty if no-one is logged in.
</dl>
<P>
Note: There is no "logout" method. Users are automatically logged out when they close their browser window.
<P>
<div class="seealso">
<p class="heading"><b>See Also:</b></p>
<dl compact class="seemodule">
<dt>Module <b><tt class="module"><a href="module-CookieAuthenticate.html">CookieAuthenticate</a></tt>:</b>
<dd>Cookie-based authentication.
</dl>
<dl compact class="seemodule">
<dt>Module <b><tt class="module"><a href="module-CookieSessionAuthenticate.html">CookieSessionAuthenticate</a></tt>:</b>
<dd>Cookie/session-based authentication.
</dl>
</div>
<P>
<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="module-HttpAuthenticate.html"><img src="../icons/previous.gif"
border="0" height="32"
alt="Previous Page" width="32"></A></td>
<td><A href="module-HttpAuthenticate.html"><img src="../icons/up.gif"
border="0" height="32"
alt="Up One Level" width="32"></A></td>
<td><A HREF="node7.html"><img src="../icons/next.gif"
border="0" height="32"
alt="Next Page" width="32"></A></td>
<td align="center" width="100%">CherryPy Standard Library Reference</td>
<td><A href="contents.html"><img src="../icons/contents.gif"
border="0" height="32"
alt="Contents" width="32"></A></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
<td><img src="../icons/blank.gif"
border="0" height="32"
alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="module-HttpAuthenticate.html">1.2 HttpAuthenticate </A>
<b class="navlabel">Up:</b> <a class="sectref" href="module-HttpAuthenticate.html">1.2 HttpAuthenticate </A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node7.html">1.2.2 Example</A>
<hr>
<span class="release-info">Release 0.10, documentation updated on 19 March 2004.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>
|