* Starts the SASL flow * @param {String} authenticatorName * @param {Function} callback
(authenticatorName, callback)
| 389 | * @param {Function} callback |
| 390 | */ |
| 391 | startAuthenticating(authenticatorName, callback) { |
| 392 | if (!this.options.authProvider) { |
| 393 | return callback(new errors.AuthenticationError('Authentication provider not set')); |
| 394 | } |
| 395 | const authenticator = this.options.authProvider.newAuthenticator(this.endpoint, authenticatorName); |
| 396 | const self = this; |
| 397 | authenticator.initialResponse(function initialResponseCallback(err, token) { |
| 398 | // Start the flow with the initial token |
| 399 | if (err) { |
| 400 | return self.onAuthenticationError(callback, err); |
| 401 | } |
| 402 | self.authenticate(authenticator, token, callback); |
| 403 | }); |
| 404 | } |
| 405 | |
| 406 | /** |
| 407 | * Handles authentication requests and responses. |
no test coverage detected