Module: Icanhazpdf::Controller::Authentication

Defined in:
lib/icanhazpdf/controller.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_as_icanhazpdfObject

true if the request includes the correct Icanhazpdf api key



32
33
34
35
# File 'lib/icanhazpdf/controller.rb', line 32

def authenticate_as_icanhazpdf
  return false unless params[:icanhazpdf].present?
  return params[:icanhazpdf] == Icanhazpdf::Client::api_key
end

#authenticate_as_icanhazpdf_or_authenticate_user!Object

attemps to authenticate as Icanhazpdf and falls back to devise



38
39
40
# File 'lib/icanhazpdf/controller.rb', line 38

def authenticate_as_icanhazpdf_or_authenticate_user!
  authenticate_as_icanhazpdf || authenticate_user!
end