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



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

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



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

def authenticate_as_icanhazpdf_or_authenticate_user!
  authenticate_as_icanhazpdf || authenticate_user!
end