diff options
Diffstat (limited to 'src/mongo/db/auth/auth_decorations.cpp')
-rw-r--r-- | src/mongo/db/auth/auth_decorations.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/auth/auth_decorations.cpp b/src/mongo/db/auth/auth_decorations.cpp index a3b5059e380..9dc6ccf868e 100644 --- a/src/mongo/db/auth/auth_decorations.cpp +++ b/src/mongo/db/auth/auth_decorations.cpp @@ -64,7 +64,13 @@ public: } } - void onDestroyClient(Client* client) override {} + void onDestroyClient(Client* client) override { + // Logout before the client is destroyed. + auto& authzSession = getAuthorizationSession(client); + if (authzSession) { + authzSession->logoutAllDatabases(client, "Client has disconnected"); + } + } void onCreateOperationContext(OperationContext* opCtx) override {} void onDestroyOperationContext(OperationContext* opCtx) override {} |