title: Configure doorkeeper's resource_owner_authenticator without other gems
body: <p>I'm currently adding a RESTful API on to the sample app from the Rails Tutorial, and I'm trying to secure it using doorkeeper without other gems like devise or clearance. I want doorkeeper to authenticate a user based on an existing session. The current sessions implementation keeps a <code>remember_token</code> in the browser cookies (assigned at signin) and stores the hashed token in the User model. </p>
  
  <p>I have a <code>current_user</code> method in the <code>SessionsHelper</code> module (app/helpers/sessions_helper.rb), which is also included in the ApplicationController:</p>
  
  <pre><code>def current_user
    remember_token = User.digest(cookies[:remember_token])
    @current_user ||= User.find_by(remember_token: remember_token)
  end
  </code></pre>
  
  <p>Here is <code>resource_owner_authenticator</code> (other failed implementations are commented out):</p>
  
  <pre><code>resource_owner_authenticator do
    # fail "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
    # Put your resource owner authentication logic here.
    # Example implementation:
    #   User.find_by_id(session[:user_id]) || redirect_to(new_user_session_url)
    # puts current_user || "no user"
    # current_user # || redirect_to(signin_path)
    # remember_token = User.digest(request.cookies[:remember_token])
    # User.find_by(remember_token: remember_token)
    # puts "in resource_owner_authenticator"
    current_user
  end
  </code></pre>
  
  <p>Here's the error from one GET request:</p>
  
  <pre><code>Started GET "/users/1" for 127.0.0.1 at 2014-08-24 12:40:25 -0400
  Processing by UsersController#show as HTML
    Parameters: {"id"=&gt;"1"}
  Filter chain halted as #&lt;Proc:0x007f294c886310@/home/mike/.rvm/gems/ruby-2.0.0-p481@railstutorial_rails_4_0/gems/doorkeeper-1.4.0/lib/doorkeeper/helpers/filter.rb:8&gt; rendered or redirected
  Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms)
  </code></pre>
  
  <p>I'm wondering, first of all, whether it's possible to authenticate without devise or clearance, and even if it is, whether it's advisable. Secondly, I'm not sure exactly what's available in <code>Doorkeeper.configure</code> -- is <code>current_user</code>? Are cookies? If anyone can see what I'm doing wrong here, thanks. I'm using Rails 4 and Doorkeeper 1.4.0.</p>