# Rack(Warden) woes

**URL:** <https://www.ruby-forum.com/t/rack-warden-woes/184331>\
**Category:** Rails\
**Created:** [March 1, 2010, 2:54am UTC](https://www.ruby-forum.com/t/rack-warden-woes/184331 "2010-03-01T02:54:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Howland](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7993a0/32.png) [@Ed\_Howland](https://www.ruby-forum.com/u/Ed_Howland)\
**Post date:** [March 1, 2010, 2:54am UTC](https://www.ruby-forum.com/t/rack-warden-woes/184331/1 "2010-03-01T02:54:58Z")

</div>

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.
