Module: ModelTokenAuth::ControllersAuth
- Defined in:
- lib/model_token_auth/controllers_auth.rb
Instance Method Summary collapse
Instance Method Details
#authenticate! ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/model_token_auth/controllers_auth.rb', line 3 def authenticate! token = request.headers['HTTP_AUTHORIZATION'] if token.present? token_ = AccessToken.find_by_token(parses_the_token(token)) if token_&.entity_type? authenticate_entity(token_) else head :unauthorized end else head :bad_request end end |