module Authentication::InstanceMethods
Public Instance Methods
authenticate(app_id)
click to toggle source
# File lib/garufa/api/authentication.rb, line 6 def authenticate(app_id) r = Signature::Request.new(request.request_method, request.path, request.params) r.authenticate { |key| Signature::Token.new(key, Garufa::Config[:secret]) } if app_id != Garufa::Config[:app_id] request.halt [400, {}, ["Token validated, but invalid for app #{app_id}"]] end rescue Signature::AuthenticationError request.halt [401, {}, ['401 Unauthorized']] end