<br><br><div class="gmail_quote">On Mon, Aug 17, 2009 at 11:45 AM, Reza Lotun <span dir="ltr">&lt;<a href="mailto:rlotun@gmail.com">rlotun@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

The short answer is that you need to use twisted.cred. </blockquote><div><br>You don&#39;t need to do that at all, it just happens to be the best way. <br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
 
wrapper = guard.HTTPAuthSessionWrapper(<br>
                    Portal(SimpleRealm(), checkers),<br>
                    [guard.BasicCredentialFactory(&#39;<a href="http://yoursite.com" target="_blank">yoursite.com</a>&#39;)])<br>
 </blockquote><div><br>Where is Portal and SimpleRealm in your example? Those are actually quite large constructs which are crucial to guard doing anything useful at all. <br><br>Since there are numerous circumstances that people need Htauth, it is implemented as follows<br>
<br>from twisted.web import http<br># and other stuff...<br><br>class HTTPAuthPage(rend.Page):<br>    def renderHTTP(self, ctx):<br>        request = inevow.IRequest(ctx)<br>        username, password = request.getUser(), request.getPassword()<br>
<br>        if [My auth details check out]:<br>            return rend.Page.renderHTTP(self, ctx) <br><br>        else:<br>            request.setHeader(&#39;WWW-Authenticate&#39;, &#39;Basic realm=&quot;My realm name&quot;&#39;)<br>
            request.setResponseCode(http.UNAUTHORIZED)<br>            return &quot;Authentication required.&quot;<br><br>
</div></div>