summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/user_cache_invalidator_job.h
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2013-10-10 16:56:10 -0400
committerSpencer T Brody <spencer@10gen.com>2013-10-10 18:55:55 -0400
commit49901a5d8ac97a41d72c4f89fd5ba2fb5a8789b8 (patch)
tree3ba4ef95d81bc8eb7dc40e90875abed1c382972f /src/mongo/db/auth/user_cache_invalidator_job.h
parent9a37b9f48505fb49604c6d9b99f448a18d524969 (diff)
downloadmongo-49901a5d8ac97a41d72c4f89fd5ba2fb5a8789b8.tar.gz
SERVER-9518 Invalidate user cache periodically on mongos
Diffstat (limited to 'src/mongo/db/auth/user_cache_invalidator_job.h')
-rw-r--r--src/mongo/db/auth/user_cache_invalidator_job.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/mongo/db/auth/user_cache_invalidator_job.h b/src/mongo/db/auth/user_cache_invalidator_job.h
new file mode 100644
index 00000000000..23d2367d3d6
--- /dev/null
+++ b/src/mongo/db/auth/user_cache_invalidator_job.h
@@ -0,0 +1,38 @@
+/* Copyright 2013 10gen Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "mongo/util/background.h"
+
+#include <string>
+
+namespace mongo {
+
+ class AuthorizationManager;
+
+ // Background job that periodically causes the AuthorizationManager to throw out its in-memory
+ // cache of User objects (which contains the users' credentials, roles, privileges, etc).
+ class UserCacheInvalidator : public BackgroundJob {
+ public:
+ UserCacheInvalidator(AuthorizationManager* authzManager) : _authzManager(authzManager) {}
+
+ protected:
+ virtual std::string name() const;
+ virtual void run();
+
+ private:
+ AuthorizationManager* _authzManager;
+ };
+
+} // namespace mongo