After some try I came up with this solution:
class Authlogic::RackAdapter < Authlogic::ControllerAdapters::AbstractAdapter
def initialize(env)
request = Rack::Request.new(env)
super(request)
Authlogic::Session::Base.controller = self
end
end
And in my middleware class I modified the 'is_user_logged_in?' method to this one:
def is_user_logged_id?(env)
begin
adapter = Authlogic::RackAdapter.new(env)
logged_in = UserSession.find && UserSession.find.user
return true
rescue Exception => e
return false
end
end
This way I can find the user... However when the user isn't logged in instead if nil I got an exception that is why I put the whole code in a rescue block...
Any better aproaches are welcome.