Base project https://github.com/gautamsi/node-ntlm-client (Nico Haller [email protected])
A node.js NTLM client with support for NTLM and NTLMv2 authentication
npm install ntlm2
A convenience function that tries to authenticate against a given URL using the request
module.
If NTLM is not supported, it will fallback to Basic Auth.
- Arguments
options
an object holding below options for the authentication process:uri
the target URLmethod
the HTTP verbusername
password
request
this is optional. An object that holds options that should be passed to the request instance
- Returns
Promise
when resolved, therequest
instance, the result and the response body will be passed
Creates a type 1 NTLM message to initialize the NTLM handshake
- Arguments
workstation
Optional. Ifundefined
,''
will be usedtarget
Optional. This is the domain/host we are trying to authenticate against.
- Returns
string
Complete NTLM string that should be sent to the server in theAuthentication
header
Decodes a type 2 message received from the server including the NTLM challenge
- Arguments
str
Either the base64 encoded type 2 message, or the completeWWW-Authenticate
header, or an object containg the response headers (http.IncomingMessage
)
- Returns
type2Message
An object containing the following information about the received type 2 message:flags
,encoding
,version
,challenge
,targetName
,targetInfo
.
Creates a type 3 message based on the type 2 message received from the server.
- Arguments
type2Message
The decoded type 2 message objectusername
password
workstation
Optional. If falsy,''
will be usedtarget
Optional. If falsy, the target name from the type 2 message will be used. This is the domain/host we are trying to authenticate against.
- Returns
string
Complete NTLM string that should be sent to the server in theAuthentication
header