I guess I should state that I'm running rails 2.0.1, sorry about
that. I've made some changes to clean up, but still having the same
problem, when auth is false, it's not rendering the FaultObject and
it's continuing on to the called action.
# Filters added to this controller apply to all controllers in the
application.
# Likewise, all the methods added will be available for all
controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
before_filter :authenticate, :except => [:login]
# See ActionController::RequestForgeryProtection for details
# Uncomment the :secret if you're not using the cookie session store
protect_from_forgery
# Use the RAMF credentials to authenticate for requested actions
def authenticate
login = credentials[:username]
password = credentials[:password]
auth = Account.check_credentials(login,password)
puts "Finished auth, user is #{login}, pass is #{password}, auth
is #{auth}"
if auth
puts "GOOD AUTH"
return true
else
puts "INVALID AUTH"
render :amf => FaultObject.new("Unable to verify authentication
credentials!")
return false
end
end
end
Here's the development.log output (with user/pass being nil):
Finished auth, user is , pass is , auth is false
INVALID AUTH
Processing RubyamfController#gateway (for 127.0.0.1 at 2008-04-07
09:10:50) [POST]
Session ID:
BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsABjoKQHVzZWR7AA%3D
%3D--2ebdc92239fb92fe50e05da4c16e9a095dbab8f1
Parameters: {"action"=>"gateway", "controller"=>"rubyamf"}
Processing FrequenciesController#index (for 127.0.0.1 at 2008-04-07
09:10:50) [POST]
Session ID:
BAh7BiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
%0ASGFzaHsABjoKQHVzZWR7AA%3D
%3D--2ebdc92239fb92fe50e05da4c16e9a095dbab8f1
Parameters: {"action"=>"index", "controller"=>"frequencies"}
Account Columns (0.003192) SHOW FIELDS FROM `accounts`
Account Load (0.005874) SELECT * FROM `accounts` WHERE
(`accounts`.`login` IS NULL) LIMIT 1
Frequency Load (0.000768) SELECT * FROM `frequencies`
Completed in 0.07301 (13 reqs/sec) | DB: 0.00000 (0%) | [http://
localhostfrequencies/index]
Frequency Columns (0.034334) SHOW FIELDS FROM `frequencies`
Sending data
Completed in 0.11758 (8 reqs/sec) | Rendering: 0.00005 (0%) | DB:
0.03433 (29%) | 200 OK [
http://localhostfrequencies/index]
Thanks again for any info!
H