Method: Challah::TokenTechnique#authenticate
- Defined in:
- lib/challah/techniques/token_technique.rb
#authenticate ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/challah/techniques/token_technique.rb', line 16 def authenticate # Token authorization functionality is only enabled with the :token_enabled option. # This is turned off by default and must be manually enabled for security reasons. return nil unless Challah.[:token_enabled] return nil unless token.present? if user = user_model.where(api_key: token).first if user.valid_session? return user end end nil end |