Class: TorqueBox::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/torquebox/security/authentication.rb

Instance Method Summary collapse

Constructor Details

#initialize(auth_bean) ⇒ Authenticator

Returns a new instance of Authenticator.



44
45
46
# File 'lib/torquebox/security/authentication.rb', line 44

def initialize(auth_bean)
  @auth_bean = auth_bean
end

Instance Method Details

#authenticate(user, pass, &block) ⇒ Object



48
49
50
51
52
53
54
55
56
57
# File 'lib/torquebox/security/authentication.rb', line 48

def authenticate(user, pass, &block)
  if @auth_bean.nil?
    $stderr.puts "ERROR: No authentication delegate found. Authentication not enabled." 
    return false 
  end

  authenticated = @auth_bean.authenticate(user, pass)
  block.call if authenticated && block
  authenticated
end