bool find(const string& token_id, KeystoneToken& token);
void add(const string& token_id, KeystoneToken& token);
- void invalidate(const string& token_id, KeystoneToken& token);
+ void invalidate(const string& token_id);
};
bool RGWKeystoneTokenCache::find(const string& token_id, KeystoneToken& token)
lock.Unlock();
}
+void RGWKeystoneTokenCache::invalidate(const string& token_id)
+{
+ Mutex::Locker l(lock);
+ map<string, token_entry>::iterator iter = tokens.find(token_id);
+ if (iter == tokens.end())
+ return;
+
+ dout(20) << "invalidating revoked token id=" << token_id << dendl;
+ token_entry& e = iter->second;
+ tokens_lru.erase(e.lru_iter);
+ tokens.erase(iter);
+}
+
class RGWValidateKeystoneToken : public RGWHTTPClient {
bufferlist *bl;
public:
if (ret < 0)
return ret;
- bl.append((char)0); // NULL terminate
+ bl.append((char)0); // NULL terminate for debug output
dout(10) << "request returned " << bl.c_str() << dendl;
continue;
}
- dout(20) << "revoked token id=" << token->get_data() << dendl;
+ string token_id = token->get_data();
+ keystone_token_cache->invalidate(token_id);
}
return 0;
if (ret < 0)
return ret;
- bl.append((char)0); // NULL terminate
+ bl.append((char)0); // NULL terminate for debug output
dout(20) << "received response: " << bl.c_str() << dendl;