title: Basic/Digest HTTP Authentication in a Pyramid app
body: <p>I have a very simple Pyramid app (my first one) and I'd like to 'lock' a couple of view callables with Basic/Digest HTTP Authentication (the generic login popup). This app will be administered by just <strong>one</strong> user. So I'd like a very basic security.</p>
  
  <p>I've read theory about Pyramid's Authentication Policy, AuthKit, repoze.who, etc. But still can someone give me a simple example/idea of a <strong>very very basic security</strong> in a Pyramidd app,  just to lock several vew callables from the world?</p>
  
  <p><strong>Note</strong>: If somebody else is doing Basic Auth for a wsgi-app through Nginx and you used <a href="http://docs.pylonsproject.org/projects/pyramid_cookbook/dev/deployment/nginx.html#step-1-configuring-nginx" rel="nofollow">Cookbook conf</a> to run your app with upstream, you may confront an issue when after successful authentication Nginx leads you to 404. All you have to do is point your restricted <em>location</em> to the same upstream:</p>
  
  <pre><code>location /restricted {
          proxy_pass              http://myapp-site;
          auth_basic              "Restricted";
          auth_basic_user_file    htpasswd;
      }
  </code></pre>