MCPcopy
hub / github.com/mongodb/node-mongodb-native / auth

Method auth

src/cmap/auth/x509.ts:20–33  ·  view source on GitHub ↗
(authContext: AuthContext)

Source from the content-addressed store, hash-verified

18 }
19
20 override async auth(authContext: AuthContext) {
21 const connection = authContext.connection;
22 const credentials = authContext.credentials;
23 if (!credentials) {
24 throw new MongoMissingCredentialsError('AuthContext must provide credentials.');
25 }
26 const response = authContext.response;
27
28 if (response?.speculativeAuthenticate) {
29 return;
30 }
31
32 await connection.command(ns('$external.$cmd'), x509AuthenticateCommand(credentials), undefined);
33 }
34}
35
36function x509AuthenticateCommand(credentials: MongoCredentials) {

Callers 2

performInitialHandshakeFunction · 0.45
reauthFunction · 0.45

Calls 3

nsFunction · 0.90
x509AuthenticateCommandFunction · 0.85
commandMethod · 0.45

Tested by

no test coverage detected