How to use the httpntlm/ntlm.parseType2Message function in httpntlm

To help you get started, we’ve selected a few httpntlm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nodemailer / smtp-connection / lib / smtp-connection.js View on Github external
_actionAUTH_NTLM_TYPE1(str, callback) {
        let challengeMatch = str.match(/^334\s+(.+)$/);
        let challengeString = '';

        if (!challengeMatch) {
            return callback(this._formatError('Invalid login sequence while waiting for server challenge string', 'EAUTH', str, 'AUTH NTLM'));
        } else {
            challengeString = challengeMatch[1];
        }

        if (!/^NTLM/i.test(challengeString)) {
            challengeString = 'NTLM ' + challengeString;
        }

        let type2Message = ntlm.parseType2Message(challengeString, callback);
        if (!type2Message) {
            return;
        }

        let type3Message = ntlm.createType3Message(type2Message, {
            domain: this._auth.domain || '',
            workstation: this._auth.workstation || '',
            username: this._auth.user,
            password: this._auth.pass
        });

        type3Message = type3Message.substring(5); // remove the "NTLM " prefix

        this._responseActions.push(str => {
            this._actionAUTH_NTLM_TYPE3(str, callback);
        });
github Hanul / YourServerNowHot / BOX / UMAIL / node_modules / nodemailer / node_modules / smtp-connection / lib / smtp-connection.js View on Github external
SMTPConnection.prototype._actionAUTH_NTLM_TYPE1 = function (str, callback) {
    var challengeMatch = str.match(/^334\s+(.+)$/);
    var challengeString = '';

    if (!challengeMatch) {
        return callback(this._formatError('Invalid login sequence while waiting for server challenge string', 'EAUTH', str, 'AUTH NTLM'));
    } else {
        challengeString = challengeMatch[1];
    }

    if (!/^NTLM/i.test(challengeString)) {
        challengeString = 'NTLM ' + challengeString;
    }

    var type2Message = ntlm.parseType2Message(challengeString, callback);
    if (!type2Message) {
        return;
    }

    var type3Message = ntlm.createType3Message(type2Message, {
        domain: this._auth.domain || '',
        workstation: this._auth.workstation || '',
        username: this._auth.user,
        password: this._auth.pass
    });

    type3Message = type3Message.substring(5); // remove the "NTLM " prefix

    this._responseActions.push(function (str) {
        this._actionAUTH_NTLM_TYPE3(str, callback);
    }.bind(this));

httpntlm

httpntlm is a Node.js library to do HTTP NTLM authentication

MIT
Latest version published 10 months ago

Package Health Score

71 / 100
Full package analysis