module AuthenticationHelpers

Public Instance Methods

authentic?() click to toggle source
# File lib/trogdir/helpers/authentication_helpers.rb, line 11
def authentic?
  secret_key = current_syncinator.try(:secret_key)

  ApiAuth.authentic? rack_request, secret_key
end
authenticate!() click to toggle source
# File lib/trogdir/helpers/authentication_helpers.rb, line 17
def authenticate!
   unauthorized! unless authentic?
end
current_syncinator() click to toggle source
# File lib/trogdir/helpers/authentication_helpers.rb, line 6
def current_syncinator
  access_id = ApiAuth.access_id(rack_request)
  Syncinator.where(access_id: access_id).first
end
rack_request() click to toggle source
# File lib/trogdir/helpers/authentication_helpers.rb, line 2
def rack_request
  Rack::Request.new(@env)
end
unauthorized!() click to toggle source
# File lib/trogdir/helpers/authentication_helpers.rb, line 21
def unauthorized!
  error!('401 Unauthorized', 401)
end