Module: OmniAuth::Identity::Model::ClassMethods
- Defined in:
- lib/omniauth/identity/model.rb
Overview
Class-level methods for OmniAuth Identity models.
Instance Method Summary collapse
-
#auth_key(method = false) ⇒ String
Used to set or retrieve the method that will be used to get and set the user-supplied authentication key.
-
#authenticate(conditions, password) ⇒ Model, false
Authenticate a user with the given key and password.
- #inherited(subclass) ⇒ Object
-
#locate(_key) ⇒ Model
abstract
Locate an identity given its unique login key.
Instance Method Details
#auth_key(method = false) ⇒ String
Used to set or retrieve the method that will be used to get and set the user-supplied authentication key.
86 87 88 89 90 91 92 93 |
# File 'lib/omniauth/identity/model.rb', line 86 def auth_key(method = false) AUTH_KEY_MUTEX.synchronize do @auth_key = method.to_s unless method == false @auth_key = nil if !defined?(@auth_key) || @auth_key == "" @auth_key || "email" end end |
#authenticate(conditions, password) ⇒ Model, false
Authenticate a user with the given key and password.
69 70 71 72 73 74 |
# File 'lib/omniauth/identity/model.rb', line 69 def authenticate(conditions, password) instance = locate(conditions) return false unless instance instance.authenticate(password) end |
#inherited(subclass) ⇒ Object
76 77 78 79 |
# File 'lib/omniauth/identity/model.rb', line 76 def inherited(subclass) super if defined?(super) subclass.filtered_attributes(*filtered_attribute_names) if subclass.respond_to?(:filtered_attributes) end |
#locate(_key) ⇒ Model
This method is abstract.
Subclasses must implement this method.
Locate an identity given its unique login key.
100 101 102 |
# File 'lib/omniauth/identity/model.rb', line 100 def locate(_key) raise NotImplementedError end |