summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/authorization_manager_impl.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
commit959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch)
treeacc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/auth/authorization_manager_impl.cpp
parent76588293975fc059cf076779e4283e6ffaf8afff (diff)
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/auth/authorization_manager_impl.cpp')
-rw-r--r--src/mongo/db/auth/authorization_manager_impl.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/auth/authorization_manager_impl.cpp b/src/mongo/db/auth/authorization_manager_impl.cpp
index 93450c8b1f5..f350dcdc140 100644
--- a/src/mongo/db/auth/authorization_manager_impl.cpp
+++ b/src/mongo/db/auth/authorization_manager_impl.cpp
@@ -389,6 +389,7 @@ AuthorizationManagerImpl::AuthorizationManagerImpl(
AuthorizationManagerImpl::~AuthorizationManagerImpl() = default;
std::unique_ptr<AuthorizationSession> AuthorizationManagerImpl::makeAuthorizationSession() {
+ invariant(_externalState != nullptr);
return std::make_unique<AuthorizationSessionImpl>(
_externalState->makeAuthzSessionExternalState(this),
AuthorizationSessionImpl::InstallMockForTestingOrAuthImpl{});
@@ -675,35 +676,35 @@ void AuthorizationManagerImpl::_pinnedUsersThreadRoutine() noexcept try {
void AuthorizationManagerImpl::invalidateUserByName(OperationContext* opCtx,
const UserName& userName) {
LOGV2_DEBUG(20235, 2, "Invalidating user", "user"_attr = userName);
- _updateCacheGeneration();
_authSchemaVersionCache.invalidateAll();
// Invalidate the named User, assuming no externally provided roles. When roles are defined
// externally, there exists no user document which may become invalid.
_userCache.invalidateKey(UserRequest(userName, boost::none));
+ _updateCacheGeneration();
}
void AuthorizationManagerImpl::invalidateUsersFromDB(OperationContext* opCtx, StringData dbname) {
LOGV2_DEBUG(20236, 2, "Invalidating all users from database", "database"_attr = dbname);
- _updateCacheGeneration();
_authSchemaVersionCache.invalidateAll();
_userCache.invalidateKeyIf(
[&](const UserRequest& userRequest) { return userRequest.name.getDB() == dbname; });
+ _updateCacheGeneration();
}
void AuthorizationManagerImpl::invalidateUsersByTenant(OperationContext* opCtx,
const TenantId& tenant) {
LOGV2_DEBUG(6323600, 2, "Invalidating tenant users", "tenant"_attr = tenant);
- _updateCacheGeneration();
_authSchemaVersionCache.invalidateAll();
_userCache.invalidateKeyIf(
[&](const UserRequest& userRequest) { return userRequest.name.getTenant() == tenant; });
+ _updateCacheGeneration();
}
void AuthorizationManagerImpl::invalidateUserCache(OperationContext* opCtx) {
LOGV2_DEBUG(20237, 2, "Invalidating user cache");
- _updateCacheGeneration();
_authSchemaVersionCache.invalidateAll();
_userCache.invalidateAll();
+ _updateCacheGeneration();
}
Status AuthorizationManagerImpl::refreshExternalUsers(OperationContext* opCtx) {