Module: Devise::Models::AccessTokenAuthenticatable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/devise/models/access_token_authenticatable.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #after_token_authentication(token) ⇒ Object
- #authentication_token ⇒ Object
- #ensure_authentication_token! ⇒ Object
- #invalidate_authentication_token! ⇒ Object
-
#reset_authentication_token! ⇒ Object
TODO Remove this entirely.
- #set_authentication_token! ⇒ Object
Instance Method Details
#after_token_authentication(token) ⇒ Object
32 33 34 |
# File 'lib/devise/models/access_token_authenticatable.rb', line 32 def after_token_authentication(token) token.used! end |
#authentication_token ⇒ Object
28 29 30 |
# File 'lib/devise/models/access_token_authenticatable.rb', line 28 def authentication_token access_token.try(:token) end |
#ensure_authentication_token! ⇒ Object
17 18 19 |
# File 'lib/devise/models/access_token_authenticatable.rb', line 17 def ensure_authentication_token! set_authentication_token! unless access_token end |
#invalidate_authentication_token! ⇒ Object
8 9 10 |
# File 'lib/devise/models/access_token_authenticatable.rb', line 8 def invalidate_authentication_token! access_token.invalidate! if access_token end |
#reset_authentication_token! ⇒ Object
TODO Remove this entirely. A user should be able to have many access tokens, that should expire after a period of time.
23 24 25 26 |
# File 'lib/devise/models/access_token_authenticatable.rb', line 23 def reset_authentication_token! invalidate_authentication_token! set_authentication_token! end |
#set_authentication_token! ⇒ Object
12 13 14 15 |
# File 'lib/devise/models/access_token_authenticatable.rb', line 12 def set_authentication_token! self.access_token = access_tokens.create! save(:validate => false) end |