Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 762e4b4e451f9de4722602c03fda2c9b > files > 219

python-fedora-0.3.25.1-1.fc14.1.noarch.rpm



<!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>Fedora Django Authentication Backend &mdash; python-fedora v0.3.25.1 documentation</title>
    <link rel="stylesheet" href="_static/default.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '',
        VERSION:     '0.3.25.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within python-fedora v0.3.25.1 documentation"
          href="_static/opensearch.xml"/>
    <link rel="top" title="python-fedora v0.3.25.1 documentation" href="index.html" />
    <link rel="up" title="Authentication to FAS" href="auth.html" />
    <link rel="next" title="FASWho Plugin" href="faswho.html" />
    <link rel="prev" title="Authentication to FAS" href="auth.html" /> 
  </head>
  <body>
    <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="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="faswho.html" title="FASWho Plugin"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="auth.html" title="Authentication to FAS"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">python-fedora v0.3.25.1 documentation</a> &raquo;</li>
          <li><a href="auth.html" accesskey="U">Authentication to FAS</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="fedora-django-authentication-backend">
<h1>Fedora Django Authentication Backend<a class="headerlink" href="#fedora-django-authentication-backend" title="Permalink to this headline">¶</a></h1>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Authors:</th><td class="field-body">Ignacio Vazquez-Abrams</td>
</tr>
<tr class="field"><th class="field-name">Date:</th><td class="field-body">23 Feb 2009</td>
</tr>
<tr class="field"><th class="field-name">For Version:</th><td class="field-body">0.3.x</td>
</tr>
</tbody>
</table>
<p>The django.auth package provides an authentication backend for Django
projects.</p>
<div class="section" id="fedora-django-auth">
<h2>fedora.django.auth<a class="headerlink" href="#fedora-django-auth" title="Permalink to this headline">¶</a></h2>
<p>As FAS users are authenticated they are added to
<tt class="xref py py-class docutils literal"><span class="pre">FasUser</span></tt>. FAS groups are added to
<tt class="xref py py-class docutils literal"><span class="pre">Group</span></tt> both during <tt class="docutils literal"><span class="pre">syncdb</span></tt> and when
a user is authenticated.</p>
<div class="section" id="integrating-into-a-django-project">
<h3>Integrating into a Django Project<a class="headerlink" href="#integrating-into-a-django-project" title="Permalink to this headline">¶</a></h3>
<p>Add the following lines to the project&#8217;s <tt class="file docutils literal"><span class="pre">settings.py</span></tt>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">AUTHENTICATION_BACKENDS</span> <span class="o">=</span> <span class="p">(</span>
    <span class="s">&#39;fedora.django.auth.backends.FasBackend&#39;</span><span class="p">,</span>
<span class="p">)</span>

<span class="n">FAS_USERNAME</span> <span class="o">=</span> <span class="s">&#39;&lt;username&gt;&#39;</span>
<span class="n">FAS_PASSWORD</span> <span class="o">=</span> <span class="s">&#39;&lt;password&gt;&#39;</span>
<span class="n">FAS_USERAGENT</span> <span class="o">=</span> <span class="s">&#39;&lt;user agent&gt;&#39;</span>
<span class="n">FAS_URL</span> <span class="o">=</span> <span class="s">&#39;&lt;base URL of FAS server&gt;&#39;</span>
<span class="n">FAS_ADMINS</span> <span class="o">=</span> <span class="p">(</span> <span class="o">...</span> <span class="p">)</span>
</pre></div>
</div>
<p><tt class="docutils literal"><span class="pre">FAS_USERNAME</span></tt> and <tt class="docutils literal"><span class="pre">FAS_PASSWORD</span></tt> are used to retrieve group
information during <tt class="docutils literal"><span class="pre">syncdb</span></tt> as well as to retrieve users via the
authentication backend. They should be set to a low-privilege account
that can read group and user information.</p>
<p><tt class="docutils literal"><span class="pre">FAS_USERAGENT</span></tt> is the string used to identify yourself to the FAS
server.</p>
<p><tt class="docutils literal"><span class="pre">FAS_URL</span></tt> is the base URL of the FAS server to authenticate against.</p>
<p><tt class="docutils literal"><span class="pre">FAS_ADMINS</span></tt> is a tuple of usernames that you want to have superuser
rights in the Django project.</p>
<p>Add <tt class="docutils literal"><span class="pre">fedora.django.auth.middleware.FasMiddleware</span></tt> to the
<tt class="docutils literal"><span class="pre">MIDDLEWARE_CLASSES</span></tt> tuple, between
<tt class="docutils literal"><span class="pre">django.contrib.sessions.middleware.SessionMiddleware</span></tt> and
<tt class="docutils literal"><span class="pre">django.contrib.auth.middleware.AuthenticationMiddleware</span></tt>.</p>
<p>Additionally, set <tt class="docutils literal"><span class="pre">FAS_GENERICEMAIL</span></tt> to <tt class="xref docutils literal"><span class="pre">False</span></tt> in order to use the
email address specified in FAS instead of &lt;username&gt;``&#64;fedoraproject.org``.</p>
<p>Add <tt class="docutils literal"><span class="pre">fedora.django.auth</span></tt> to <tt class="docutils literal"><span class="pre">INSTALLED_APPS</span></tt>.</p>
<p>Finally, run <tt class="docutils literal"><span class="pre">python</span> <span class="pre">manage.py</span> <span class="pre">syncdb</span></tt> to add the models for the added app to the database.</p>
<div class="admonition warning">
<p class="first admonition-title">Warning</p>
<p class="last">The <tt class="docutils literal"><span class="pre">User.first_name</span></tt> and <tt class="docutils literal"><span class="pre">User.last_name</span></tt> attributes are always
empty since FAS does not have any equivalents. The <tt class="docutils literal"><span class="pre">name</span></tt>
read-only property results in a round trip to the FAS server.</p>
</div>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Fedora Django Authentication Backend</a><ul>
<li><a class="reference internal" href="#fedora-django-auth">fedora.django.auth</a><ul>
<li><a class="reference internal" href="#integrating-into-a-django-project">Integrating into a Django Project</a></li>
</ul>
</li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="auth.html"
                        title="previous chapter">Authentication to FAS</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="faswho.html"
                        title="next chapter">FASWho Plugin</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/django.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="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="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="faswho.html" title="FASWho Plugin"
             >next</a> |</li>
        <li class="right" >
          <a href="auth.html" title="Authentication to FAS"
             >previous</a> |</li>
        <li><a href="index.html">python-fedora v0.3.25.1 documentation</a> &raquo;</li>
          <li><a href="auth.html" >Authentication to FAS</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2007-2011 Red Hat, Inc..
      Last updated on Nov 02, 2011.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
    </div>
  </body>
</html>