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

@ -49,7 +49,7 @@ describe Vmpooler::API::V1 do
it 'returns a list of tokens if authed' do
expect(redis).to receive(:keys).with('vmpooler__token__*').and_return(["vmpooler__token__abc"])
expect(redis).to receive(:hgetall).with('vmpooler__token__abc').and_return({"user" => "admin", "timestamp" => "now"})
expect(redis).to receive(:hgetall).with('vmpooler__token__abc').and_return({"user" => "admin", "created" => "now"})
authorize 'admin', 's3cr3t'