Class: SimpleAuthentication::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_authentication/authenticator.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ Authenticator

Returns a new instance of Authenticator.



6
7
8
# File 'lib/simple_authentication/authenticator.rb', line 6

def initialize(controller)
  @controller = controller
end

Class Method Details

.authenticator_for(identifier) ⇒ Object



49
50
51
# File 'lib/simple_authentication/authenticator.rb', line 49

def self.authenticator_for(identifier)
  authenticators.detect{|a| a.identifier == identifier }
end

.identifierObject



45
46
47
# File 'lib/simple_authentication/authenticator.rb', line 45

def self.identifier
  name.split('::').last.gsub(/Authenticator$/, '').underscore
end

Instance Method Details

#authenticateObject

Raises:

  • (NotImplementedError)


10
11
12
# File 'lib/simple_authentication/authenticator.rb', line 10

def authenticate
  raise NotImplementedError
end

#authenticate_if_possibleObject



18
19
20
21
# File 'lib/simple_authentication/authenticator.rb', line 18

def authenticate_if_possible
  return false unless authentication_possible?
  authenticate
end

#authentication_possible?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/simple_authentication/authenticator.rb', line 14

def authentication_possible?
  false
end