diff options
Diffstat (limited to 'src/mongo/db/auth/authentication_session.h')
-rw-r--r-- | src/mongo/db/auth/authentication_session.h | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/src/mongo/db/auth/authentication_session.h b/src/mongo/db/auth/authentication_session.h index 8870abefc76..1c3b34b16ee 100644 --- a/src/mongo/db/auth/authentication_session.h +++ b/src/mongo/db/auth/authentication_session.h @@ -33,44 +33,47 @@ namespace mongo { - class ClientBasic; +class ClientBasic; + +/** + * Abstract type representing an ongoing authentication session. + * + * An example subclass is MongoAuthenticationSession. + */ +class AuthenticationSession { + MONGO_DISALLOW_COPYING(AuthenticationSession); + +public: + enum SessionType { + SESSION_TYPE_MONGO, // The mongo-specific challenge-response authentication mechanism. + SESSION_TYPE_SASL // SASL authentication mechanism. + }; /** - * Abstract type representing an ongoing authentication session. - * - * An example subclass is MongoAuthenticationSession. + * Sets the authentication session for the given "client" to "newSession". */ - class AuthenticationSession { - MONGO_DISALLOW_COPYING(AuthenticationSession); - public: - enum SessionType { - SESSION_TYPE_MONGO, // The mongo-specific challenge-response authentication mechanism. - SESSION_TYPE_SASL // SASL authentication mechanism. - }; - - /** - * Sets the authentication session for the given "client" to "newSession". - */ - static void set(ClientBasic* client, std::unique_ptr<AuthenticationSession> newSession); + static void set(ClientBasic* client, std::unique_ptr<AuthenticationSession> newSession); - /** - * Swaps "client"'s current authentication session with "other". - */ - static void swap(ClientBasic* client, std::unique_ptr<AuthenticationSession>& other); + /** + * Swaps "client"'s current authentication session with "other". + */ + static void swap(ClientBasic* client, std::unique_ptr<AuthenticationSession>& other); - virtual ~AuthenticationSession() = default; + virtual ~AuthenticationSession() = default; - /** - * Return an identifer of the type of session, so that a caller can safely cast it and - * extract the type-specific data stored within. - */ - SessionType getType() const { return _sessionType; } + /** + * Return an identifer of the type of session, so that a caller can safely cast it and + * extract the type-specific data stored within. + */ + SessionType getType() const { + return _sessionType; + } - protected: - explicit AuthenticationSession(SessionType sessionType) : _sessionType(sessionType) {} +protected: + explicit AuthenticationSession(SessionType sessionType) : _sessionType(sessionType) {} - private: - const SessionType _sessionType; - }; +private: + const SessionType _sessionType; +}; } // namespace mongo |