(authContext: AuthContext)
| 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 | |
| 36 | function x509AuthenticateCommand(credentials: MongoCredentials) { |
no test coverage detected