Track token use times

* rename the Redis token 'timestamp' var to 'created'
* update the Redis token 'last' var when token is successfully validataed
* expose the Redis token 'last' var in GET /token route
This commit is contained in:
Scott Schneider 2015-08-20 19:54:59 -07:00
parent ce158d9fec
commit 89ce70dba9
3 changed files with 31 additions and 14 deletions

View file

@ -15,7 +15,11 @@ module Vmpooler
end
def validate_token(backend)
return if valid_token?(backend)
if valid_token?(backend)
backend.hset('vmpooler__token__' + request.env['HTTP_X_AUTH_TOKEN'], 'last', Time.now)
return true
end
content_type :json