Accept API authentication with keys token

This commit is contained in:
Thibault Jouan
2015-05-06 03:14:11 +00:00
parent 0f1f7106b2
commit ba3c0380d0
2 changed files with 17 additions and 3 deletions

View File

@@ -37,6 +37,9 @@ module API
end
def authenticate!
if key = authenticate_with_http_token { |t| Key.authenticate(t) }
self.current_user = key.user
end
head :unauthorized if current_user.nil?
end