module ActionController::HttpAuthentication::Token
def authenticate(controller, &login_procedure)
Returns the return value of `&login_procedure` if a token is found.
authenticate(controller) { |token, options| ... }
take 2 arguments:
login_procedure - Proc to call if a token is present. The Proc should
controller - ActionController::Base instance for the current request.
the present token and options.
If token Authorization header is present, call the login procedure with
def authenticate(controller, &login_procedure) token, options = token_and_options(controller.request) if !token.blank? login_procedure.call(token, options) end end