clear-password-auth.js 606 B

1234567891011121314151617181920212223
  1. const PluginAuth = require('./plugin-auth');
  2. /**
  3. * Send password in clear.
  4. * (used only when SSL is active)
  5. */
  6. class ClearPasswordAuth extends PluginAuth {
  7. constructor(packSeq, compressPackSeq, pluginData, resolve, reject, multiAuthResolver) {
  8. super(resolve, reject, multiAuthResolver);
  9. this.sequenceNo = packSeq;
  10. }
  11. start(out, opts, info) {
  12. out.startPacket(this);
  13. if (opts.password) out.writeString(opts.password);
  14. out.writeInt8(0);
  15. out.flushBuffer(true);
  16. this.emit('send_end');
  17. this.onPacketReceive = this.successSend;
  18. }
  19. }
  20. module.exports = ClearPasswordAuth;