Class: Lazer::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/lazer/application_controller.rb

Direct Known Subclasses

SchemaController, ScopesController

Instance Method Summary collapse

Instance Method Details

#authenticate!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/lazer/application_controller.rb', line 7

def authenticate!
  if params[:api_key].blank?
    render json: "Missing api_key param", status: 401
    return
  end
  if ENV["LAZER_KEY"].blank?
    render json: "You need to set your LAZER_KEY env variable", status: 401
    return
  end
  if params[:api_key] != ENV["LAZER_KEY"]
    render json: "api_key param doesn't match LAZER_KEY env variable", status: 401
    return
  end
end