|
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <title>auth — Authentication — Documentation</title>
- <link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
- <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
- <script type="text/javascript">
- var DOCUMENTATION_OPTIONS = {
- URL_ROOT: '',
- VERSION: '',
- COLLAPSE_MODINDEX: false,
- FILE_SUFFIX: '.html',
- HAS_SOURCE: true
- };
- </script>
- <script type="text/javascript" src="_static/jquery.js"></script>
- <script type="text/javascript" src="_static/doctools.js"></script>
- <link rel="top" title="Documentation" href="index.html" />
- <link rel="up" title="Server Side Internals" href="server_side_internals.html" />
- <link rel="next" title="webnotes — Webnotes Module" href="webnotes.html" />
- <link rel="prev" title="Server Side Internals" href="server_side_internals.html" />
- </head>
- <body>
- <div style="background-color: #FFF; text-align: left; padding: 8px 0px"><img src="_static/banner300910.gif"></div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- accesskey="I">index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- accesskey="M">modules</a> |</li>
- <li class="right" >
- <a href="webnotes.html" title="webnotes — Webnotes Module"
- accesskey="N">next</a> |</li>
- <li class="right" >
- <a href="server_side_internals.html" title="Server Side Internals"
- accesskey="P">previous</a> |</li>
- <li><a href="index.html">Documentation</a> »</li>
- <li><a href="server_side_api.html" >3. Server Side API</a> »</li>
- <li><a href="server_side_internals.html" accesskey="U">Server Side Internals</a> »</li>
- </ul>
- </div>
- <div class="sphinxsidebar">
- <div class="sphinxsidebarwrapper">
- <h3><a href="index.html">Table Of Contents</a></h3>
- <ul>
- <li><a class="reference external" href=""><tt class="docutils literal"><span class="pre">auth</span></tt> — Authentication</a><ul>
- <li><a class="reference external" href="#authentication-object">Authentication object</a></li>
- </ul>
- </li>
- </ul>
-
- <h4>Previous topic</h4>
- <p class="topless"><a href="server_side_internals.html"
- title="previous chapter">Server Side Internals</a></p>
- <h4>Next topic</h4>
- <p class="topless"><a href="webnotes.html"
- title="next chapter"><tt class="docutils literal"><span class="pre">webnotes</span></tt> — Webnotes Module</a></p>
- <h3>This Page</h3>
- <ul class="this-page-menu">
- <li><a href="_sources/auth.txt"
- rel="nofollow">Show Source</a></li>
- </ul>
- <div id="searchbox" style="display: none">
- <h3>Quick search</h3>
- <form class="search" action="search.html" method="get">
- <input type="text" name="q" size="18" />
- <input type="submit" value="Go" />
- <input type="hidden" name="check_keywords" value="yes" />
- <input type="hidden" name="area" value="default" />
- </form>
- <p class="searchtip" style="font-size: 90%">
- Enter search terms or a module, class or function name.
- </p>
- </div>
- <script type="text/javascript">$('#searchbox').show(0);</script>
- </div>
- </div>
-
- <div class="document">
- <div class="documentwrapper">
- <div class="bodywrapper">
- <div class="body">
-
- <div class="section" id="module-auth">
- <h1><tt class="xref docutils literal"><span class="pre">auth</span></tt> — Authentication<a class="headerlink" href="#module-auth" title="Permalink to this headline">¶</a></h1>
- <div class="section" id="authentication-object">
- <h2>Authentication object<a class="headerlink" href="#authentication-object" title="Permalink to this headline">¶</a></h2>
- <dl class="class">
- <dt id="auth.Authentication">
- <em class="property">class </em><tt class="descclassname">auth.</tt><tt class="descname">Authentication</tt><big>(</big><em>self</em>, <em>form</em>, <em>in_cookies</em>, <em>out_cookies</em>, <em>out</em><big>)</big><a class="headerlink" href="#auth.Authentication" title="Permalink to this definition">¶</a></dt>
- <dd><p>A new Authenticate object is created at the beginning of any request. It will manage login, session and
- cookies. <a href="#id1"><span class="problematic" id="id2">:method:`update`</span></a> must be called at the end of the request to update cookies and
- session.</p>
- <p>The constructor will also set the global <cite>webnotes.conn</cite>, <cite>webnotes.session</cite> and <cite>webnotes.user</cite></p>
- <p>To enable a login, the :object:form must have a cmd = “login” (see request handling for more details)</p>
- <dl class="attribute">
- <dt id="auth.Authentication.conn">
- <tt class="descname">conn</tt><a class="headerlink" href="#auth.Authentication.conn" title="Permalink to this definition">¶</a></dt>
- <dd><cite>webnotes.db.Database</cite> object created after authentication</dd></dl>
-
- <dl class="attribute">
- <dt id="auth.Authentication.session">
- <tt class="descname">session</tt><a class="headerlink" href="#auth.Authentication.session" title="Permalink to this definition">¶</a></dt>
- <dd>session dictionary of the current session</dd></dl>
-
- <dl class="attribute">
- <dt id="auth.Authentication.cookies">
- <tt class="descname">cookies</tt><a class="headerlink" href="#auth.Authentication.cookies" title="Permalink to this definition">¶</a></dt>
- <dd>session dictionary of incoming cookies</dd></dl>
-
- <dl class="attribute">
- <dt id="auth.Authentication.domain">
- <tt class="descname">domain</tt><a class="headerlink" href="#auth.Authentication.domain" title="Permalink to this definition">¶</a></dt>
- <dd>domain name of the request</dd></dl>
-
- <dl class="attribute">
- <dt id="auth.Authentication.remote_ip">
- <tt class="descname">remote_ip</tt><a class="headerlink" href="#auth.Authentication.remote_ip" title="Permalink to this definition">¶</a></dt>
- <dd>IP address of the reqeust</dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.update">
- <tt class="descname">update</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.update" title="Permalink to this definition">¶</a></dt>
- <dd><strong>Must be called at the end of the request, to update the session and clear expired sessions</strong></dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.set_env">
- <tt class="descname">set_env</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.set_env" title="Permalink to this definition">¶</a></dt>
- <dd>Sets the properties <cite>domain</cite> and <cite>remote_ip</cite> from the environmental variables</dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.set_db">
- <tt class="descname">set_db</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.set_db" title="Permalink to this definition">¶</a></dt>
- <dd><p>In case of a multi-database system, this methods sets the correct database connection.</p>
- <ul class="simple">
- <li>It will first search for cookie <cite>account_id</cite></li>
- <li>It will next search for cookies or form variable <cite>__account</cite></li>
- <li>It will try and search from the domain mapping table <cite>Account Domain</cite> in the <cite>accounts</cite> database</li>
- <li>It will try and use the default</li>
- </ul>
- </dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.check_ip">
- <tt class="descname">check_ip</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.check_ip" title="Permalink to this definition">¶</a></dt>
- <dd>If the current request is from a separate IP than the one which was used to create the session, then
- this throws an Exception</dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.load_session">
- <tt class="descname">load_session</tt><big>(</big><em>sid</em><big>)</big><a class="headerlink" href="#auth.Authentication.load_session" title="Permalink to this definition">¶</a></dt>
- <dd>Load session from the given session id <cite>sid</cite></dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.login">
- <tt class="descname">login</tt><big>(</big><em>as_guest = 0</em><big>)</big><a class="headerlink" href="#auth.Authentication.login" title="Permalink to this definition">¶</a></dt>
- <dd><p>Will login user from <cite>self.form</cite>. If as_guest is true, it will check if Guest profile is enabled</p>
- <p>It will also:</p>
- <ul class="simple">
- <li>validate if approved ips are set in <cite>Profile</cite></li>
- <li>start the session</li>
- <li>set “remember me”</li>
- <li>return out.message as “Logged In”</li>
- </ul>
- </dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.check_password">
- <tt class="descname">check_password</tt><big>(</big><em>user</em>, <em>pwd</em><big>)</big><a class="headerlink" href="#auth.Authentication.check_password" title="Permalink to this definition">¶</a></dt>
- <dd>Checks if the user has the pwd and is enabled</dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.validate_ip">
- <tt class="descname">validate_ip</tt><big>(</big><em>user</em><big>)</big><a class="headerlink" href="#auth.Authentication.validate_ip" title="Permalink to this definition">¶</a></dt>
- <dd>Validates IP address from the ip_address value in the user’s <cite>Profile</cite></dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.start_session">
- <tt class="descname">start_session</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.start_session" title="Permalink to this definition">¶</a></dt>
- <dd>Starts a session, and updates last login details in the users’s <cite>Profile</cite></dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.clear_expired">
- <tt class="descname">clear_expired</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.clear_expired" title="Permalink to this definition">¶</a></dt>
- <dd>Removes old sessions from <cite>tabSessions</cite> that are older than <cite>session_expiry</cite> in <cite>Control Panel</cite> or 24:00 hrs</dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.set_cookies">
- <tt class="descname">set_cookies</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.set_cookies" title="Permalink to this definition">¶</a></dt>
- <dd>Sets outgoing cookies</dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.set_remember_me">
- <tt class="descname">set_remember_me</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.set_remember_me" title="Permalink to this definition">¶</a></dt>
- <dd>Checks if there is a ‘remember_me’ property in <cite>form</cite> with a value and if true, its sets the
- expiry of each cookie for <cite>remember_for_days</cite> in <cite>Control Panel</cite> or 7 days</dd></dl>
-
- <dl class="method">
- <dt id="auth.Authentication.get_cookies">
- <tt class="descname">get_cookies</tt><big>(</big><big>)</big><a class="headerlink" href="#auth.Authentication.get_cookies" title="Permalink to this definition">¶</a></dt>
- <dd>Loads incoming cookies in <cite>cookies</cite></dd></dl>
-
- </dd></dl>
-
- </div>
- </div>
-
-
- </div>
- </div>
- </div>
- <div class="clearer"></div>
- </div>
- <div class="related">
- <h3>Navigation</h3>
- <ul>
- <li class="right" style="margin-right: 10px">
- <a href="genindex.html" title="General Index"
- >index</a></li>
- <li class="right" >
- <a href="modindex.html" title="Global Module Index"
- >modules</a> |</li>
- <li class="right" >
- <a href="webnotes.html" title="webnotes — Webnotes Module"
- >next</a> |</li>
- <li class="right" >
- <a href="server_side_internals.html" title="Server Side Internals"
- >previous</a> |</li>
- <li><a href="index.html">Documentation</a> »</li>
- <li><a href="server_side_api.html" >3. Server Side API</a> »</li>
- <li><a href="server_side_internals.html" >Server Side Internals</a> »</li>
- </ul>
- </div>
- <div class="footer">
- © Copyright 2010, Rushabh Mehta.
- Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3.
- </div>
- </body>
- </html>
|