Class: TorqueBox::Authenticator

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

Instance Method Summary (collapse)

Constructor Details

- (Authenticator) initialize(auth_bean)

Returns a new instance of Authenticator



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

def initialize(auth_bean)
  @auth_bean = auth_bean
end

Instance Method Details

- (Object) authenticate(user, pass, &block)



48
49
50
51
52
53
54
55
56
57
# File 'security/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