Rack(Warden) woes

Hi,

I’m trying to use the Warden gem via RailsWarden. It is not working,
but I guess I don’t understand a few things.

How do you access a Rack thing from a method in your controller?

env[:warden] fails with a method not found error for env.

I want only certain actions to check to see if the user is logged in.

I assumed that warden was doing all the work since my strategy checked
for the correct password. I didn’t need to do anything in my
controller login action

Here is the strategy code:

Warden::Strategies.add(:password) do
def valid?
params[:login][:password]
puts “logging in”
end
def authenticate!
puts “authenticating”
params[:login][:password] == ‘password’ ? success! : fail!
end
end

However any password succeeds. Indeed the puts are never happening.

Does/can warden log what it is doing? Nothing is getting logged to the
console or development.log.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs