Module: Api::Intercept

Extended by:
ActiveSupport::Concern
Includes:
ActionController::HttpAuthentication::Token::ControllerMethods, TokenAuthentication
Included in:
ApplicationController
Defined in:
app/controllers/concerns/api/intercept.rb

Instance Method Summary collapse

Methods included from TokenAuthentication

#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate

Instance Method Details

#intercept_apiTrue, render

Returns If authentication is requried, as defined in the routes, then it must pass here.

Returns:

  • (True, render)

    If authentication is requried, as defined in the routes, then it must pass here.



25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/concerns/api/intercept.rb', line 25

def intercept_api
  @api_request = true
  res = true

  res = intercept_user if params[:authenticate_user]
  res = intercept_project if res && params[:authenticate_project] || params[:project_token]
  res = intercept_user_or_project if res && params[:authenticate_user_or_project]
  res = set_project_from_params if res && params[:project_id]

  res
end