Class: SimpleAuthentication::Authenticator
- Inherits:
-
Object
- Object
- SimpleAuthentication::Authenticator
- Defined in:
- lib/simple_authentication/authenticator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #authenticate ⇒ Object
- #authenticate_if_possible ⇒ Object
- #authentication_possible? ⇒ Boolean
-
#initialize(controller) ⇒ Authenticator
constructor
A new instance of Authenticator.
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 |
.identifier ⇒ Object
45 46 47 |
# File 'lib/simple_authentication/authenticator.rb', line 45 def self.identifier name.split('::').last.gsub(/Authenticator$/, '').underscore end |
Instance Method Details
#authenticate ⇒ Object
10 11 12 |
# File 'lib/simple_authentication/authenticator.rb', line 10 def authenticate raise NotImplementedError end |
#authenticate_if_possible ⇒ Object
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
14 15 16 |
# File 'lib/simple_authentication/authenticator.rb', line 14 def authentication_possible? false end |