You do not need to do anything with UserSessionController, since this controller will only process registration and logout.
Authlogic and are authenticate_with_http_basicnot related to each other. If you want to authenticate through HTTP basic, you just need to create an authentication method using the method provided by Rails and put this method in before_filter. When logging in through HTTP authentication, I assume that the username and password should be required for each request.
So yours ProductsControllerwill be something like this
class ProductsController < ApplicationController
before_filter :authenticate_via_http_basic
skip_before_filter :require_authentication
...
protected
def authenticate_via_http_basic
unless current_user
authenticate_with_http_basic do |username, password|
if user = User.find_by_username(username)
user.valid_password?(password)
else
false
end
end
end
end
source
share