@node-ntlm/core
NTLM node utility function
Last updated 4 years ago by skrtheboss .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @node-ntlm/core 
SYNC missed versions from official npm registry.

@node-ntlm/core

NodeJs Support weekly downloads from npm Renovate Bot SNYK Report npm version
Minified size Minified-Zipped size Semantic Release code style: prettier Mit License

@node-ntlm/core is a Node.js NTLM utility package

It's heavily inspired from httpntlm written in typescript and with nodejs 18 support.

Install

You can install @node-ntlm/core using the Node Package Manager (npm):

npm install @node-ntlm/core

How to use

import {
    createType1Message,
    createType3Message,
    extractNtlmMessageFromAuthenticateHeader,
    parseType2Message,
} from '@node-ntlm/core';
import { fetch } from 'undici';

const negotiateMessage = createType1Message({ domain: 'test.host', workstation: 'pc1' });

const negotiateResponse = await fetch('http://test-service.url/api', {
    headers: { authorization: negotiateMessage },
    keepalive: true,
});

const type2Message = extractNtlmMessageFromAuthenticateHeader(negotiateResponse.headers.get('www-authenticate'));

if (!type2Message) {
    throw new Error('Could not find type 2 message on response headers!');
}

const authMessage = createType3Message(parseType2Message(type2Message), {
    domain: 'test.host',
    workstation: 'pc1',
    username: 'test',
    password: 'test',
});

const result = await fetch('http://test-service.url/api', {
    headers: { Authorization: authMessage },
    keepalive: false,
});

console.log(await result.json());

@node-ntlm/core/testing

Usage:

import { generateNegotiateResponse } from '@node-ntlm/core/testing';

const negotiateRespnse = generateNegotiateResponse(...getAuthorization header somewhere)

Current Tags

  • 0.3.2                                ...           latest (4 years ago)

7 Versions

  • 0.3.2                                ...           4 years ago
  • 0.3.1                                ...           4 years ago
  • 0.3.0                                ...           4 years ago
  • 0.2.3                                ...           4 years ago
  • 0.2.2                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
Maintainers (1)
Downloads
Total 16
Today 1
This Week 16
This Month 16
Last Day 8
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE