<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.4" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: HTTP Basic Authentication using restful_authentication with Rails 1.2</title>
	<link>http://jotthought.com/articles/2007/09/27/http-basic-authentication-using-restful_authentication-with-rails-12/</link>
	<description>A place for me to speak my mind</description>
	<pubDate>Fri, 21 Nov 2008 10:38:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.4</generator>

	<item>
		<title>by: Paul</title>
		<link>http://jotthought.com/articles/2007/09/27/http-basic-authentication-using-restful_authentication-with-rails-12/#comment-8464</link>
		<pubDate>Sun, 24 Feb 2008 02:46:42 +0000</pubDate>
		<guid>http://jotthought.com/articles/2007/09/27/http-basic-authentication-using-restful_authentication-with-rails-12/#comment-8464</guid>
					<description>Thank you for posting this!  I had a similar problem with restful_authentication on rails2.0.  I was using curl for a .json URL and it worked ok (presumably because the basic auth was part of the command line and was being provided with the first request -- not waiting for a 401).  However, using a browser it would fail with a 406 because the browser wasn't getting a 401 to present a pop-up authentication box.  Adding these lines to authenticated_system.rb got it to work:

        format.json do
          request_http_basic_authentication 'Web Password'
        end

Thanks again!</description>
		<content:encoded><![CDATA[<p>Thank you for posting this!  I had a similar problem with restful_authentication on rails2.0.  I was using curl for a .json URL and it worked ok (presumably because the basic auth was part of the command line and was being provided with the first request &#8212; not waiting for a 401).  However, using a browser it would fail with a 406 because the browser wasn&#8217;t getting a 401 to present a pop-up authentication box.  Adding these lines to authenticated_system.rb got it to work:</p>
<p>        format.json do<br />
          request_http_basic_authentication &#8216;Web Password&#8217;<br />
        end</p>
<p>Thanks again!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Ben</title>
		<link>http://jotthought.com/articles/2007/09/27/http-basic-authentication-using-restful_authentication-with-rails-12/#comment-7783</link>
		<pubDate>Thu, 31 Jan 2008 18:22:05 +0000</pubDate>
		<guid>http://jotthought.com/articles/2007/09/27/http-basic-authentication-using-restful_authentication-with-rails-12/#comment-7783</guid>
					<description>It's been a while since I wrote this but if I remember correctly, this is the issue with login_required. The method uses &#124;&#124;= to set self.current_user. This is usually idiomatic ruby but the problem in this case is self.current_user == :false. The &lt;b&gt;symbol&lt;/b&gt; :false will always evaluate to true. Try this out in irb :false &#038;& true. That will return true since :false evaluates as true. Does that help clarify the bug I found?

I looked at the most recent version of the plugin and it looks like this code has been refactored. I haven't looked at it in detail to determine if the problem still exists.</description>
		<content:encoded><![CDATA[<p>It&#8217;s been a while since I wrote this but if I remember correctly, this is the issue with login_required. The method uses ||= to set self.current_user. This is usually idiomatic ruby but the problem in this case is self.current_user == :false. The <b>symbol</b> :false will always evaluate to true. Try this out in irb :false &#038;&#038; true. That will return true since :false evaluates as true. Does that help clarify the bug I found?</p>
<p>I looked at the most recent version of the plugin and it looks like this code has been refactored. I haven&#8217;t looked at it in detail to determine if the problem still exists.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: rick</title>
		<link>http://jotthought.com/articles/2007/09/27/http-basic-authentication-using-restful_authentication-with-rails-12/#comment-7770</link>
		<pubDate>Thu, 31 Jan 2008 07:10:11 +0000</pubDate>
		<guid>http://jotthought.com/articles/2007/09/27/http-basic-authentication-using-restful_authentication-with-rails-12/#comment-7770</guid>
					<description>Hey, I'm not sure what login_required has to do with your issue.  logged_in? checks to see if current_user == :false or if it is a valid logged in user.  The 406 comes from the #access_denied method which needs to be updated to handle js requests. Instead of 'format.xml', I should use format.any to intercept every other format.  In fact, it just came up trying to build an iphone interface to an app I'm working on.  Doh.</description>
		<content:encoded><![CDATA[<p>Hey, I&#8217;m not sure what login_required has to do with your issue.  logged_in? checks to see if current_user == :false or if it is a valid logged in user.  The 406 comes from the #access_denied method which needs to be updated to handle js requests. Instead of &#8216;format.xml&#8217;, I should use format.any to intercept every other format.  In fact, it just came up trying to build an iphone interface to an app I&#8217;m working on.  Doh.
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
