Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

cypress-ntlm-auth

bjowes12.9kMIT4.2.3TypeScript support: included

NTLM authentication plugin for Cypress

cypress, ntlm, windows authentication

readme

cypress-ntlm-auth

NTLM authentication plugin for Cypress

If you want to perform end-to-end testing against deployed sites that require Windows Authentication, and you want to use Cypress, you will find that Cypress does not support Windows Authentication. Windows Authentication is quite widely used in corporate intranets. This plugin bridges the gap by providing NTLM authentication (and Negotiate when using SSO) for Cypress in a streamlined manner.

version downloads CodeQL Unit tests E2E tests MIT License

Changelog

Never heard of Cypress?

Read the intro at their site and find out if it is the thing for you. (spoiler - it is!)

Want to use NTLM or Negotiate authentication for something else?

Parts of this library should be readily reusable, the ntlm-proxy is application agnostic and should be usable with Selenium or other solutions - you'll have to provide the streamlining into your application yourself though.

BREAKING CHANGES from 4.0.0

The HTTPS/SSL/TLS certificate validation has been refactored, and will now permit invalid certificates with a warning logged to the console. Previous versions would fail the test in this scenario. Most users won't need to update their test code, but if you require stricter validation, see HTTPS/SSL/TLS Certificates for details.

Install

npm install --save-dev cypress-ntlm-auth

The --save-dev flag stores cypress-ntlm-auth as a development dependency, which is suitable for a testing utility.

Configure

Follow these steps to configure Cypress to utilize this plugin:

Commands

In the file cypress/support/e2e.js (or .ts) add this line

import "cypress-ntlm-auth/dist/commands";

Types (Intellisense)

For proper typings when using TypeScript, add "cypress-ntlm-auth" to the types block of cypress/tsconfig.json. By default, the types block only includes node and cypress. In that case, the updated block should be "types": ["cypress", "node", "cypress-ntlm-auth"]. If you use other plugins there may be other additions.

Startup

npx cypress-ntlm open

The most convenient way to start Cypress with NTLM authentication is

npx cypress-ntlm open

This starts the ntlm-proxy and runs cypress in headed mode (like cypress open). After Cypress exits, the ntlm-proxy is terminated. cypress-ntlm open accepts the same command line arguments that cypress open does.

npx cypress-ntlm run

npx cypress-ntlm run

This starts the ntlm-proxy and runs cypress in headless mode (like cypress run), suitable for CI. After Cypress exits, the ntlm-proxy is terminated.cypress-ntlm run accepts the same command line arguments that cypress run does.

Advanced startup

ntlm-proxy

This binary is available in the node_modules/.bin folder. Use it if you need to start the ntlm-proxy manually. To use specific ports you can set CYPRESS_NTLM_AUTH_API and CYPRESS_NTLM_AUTH_PROXY environment variables.

Examples

shell (Mac and Linux)
# Start NTLM proxy
npx ntlm-proxy

# Start NTLM proxy as a background process
npx ntlm-proxy &

# Start NTLM proxy with debug logging to console
DEBUG=cypress:plugin:ntlm-auth npx ntlm-proxy
cmd (Windows)
# Start NTLM proxy
npx ntlm-proxy

# Start NTLM proxy as a background process, close window when ntlm-proxy terminates
start /min \"ntlm-proxy\" cmd /c npx ntlm-proxy

# Start NTLM proxy with debug logging to console
set DEBUG=cypress:plugin:ntlm-auth
npx ntlm-proxy
Powershell (Windows)
# Start NTLM proxy
npx ntlm-proxy

# Start NTLM proxy as a background process, close window when ntlm-proxy terminates
start /min \"ntlm-proxy\" cmd /c npx ntlm-proxy

# Start NTLM proxy with debug logging to console
$env:DEBUG='cypress:plugin:ntlm-auth'
npx ntlm-proxy

ntlm-proxy-exit

This binary is available in the node_modules/.bin folder. Use it to send an exit command to a ntlm-proxy running in the background. CYPRESS_NTLM_AUTH_API environment variable must be set for this command.

Examples

shell (Mac and Linux)
# Terminate NTLM proxy
npx ntlm-proxy-exit

# Stop NTLM proxy with debug logging to console
DEBUG=cypress:plugin:ntlm-auth npx ntlm-proxy-exit
cmd (Windows)
# Terminate NTLM proxy
npx ntlm-proxy-exit

# Stop NTLM proxy with debug logging to console
set DEBUG=cypress:plugin:ntlm-auth
npx ntlm-proxy-exit
Powershell (Windows)
# Terminate NTLM proxy
npx ntlm-proxy-exit

# Stop NTLM proxy with debug logging to console
$env:DEBUG='cypress:plugin:ntlm-auth'
npx ntlm-proxy-exit

cypress-ntlm

This binary is available in the node_modules/.bin folder. Use it to start Cypress with NTLM authentication configured. Depending on environment variables, this command will use an existing ntlm-proxy or start its own. It is easier to just let it handle its own ntlm-proxy, but if you need to use a specific instance, you need to set the environment variable:

  • CYPRESS_NTLM_AUTH_API - set this to the url the ntlm-proxy config API is listening to (example: http://localhost:54368)

When this is set, cypress-ntlm will check if it can reach the proxy and see that it is alive. Otherwise the cypress-ntlm command will fail.

Example - Mac, Linux and Windows

# Start Cypress with NTLM authentication
npx cypress-ntlm open

Upstream proxy

If your network environment enforces proxy usage for internet access (quite likely given that you are using NTLM) and the host you are testing uses resources on the internet (e.g. loading bootstrap or jQuery from a CDN), you need to make the ntlm-proxy aware of the internet proxy. This is done by setting the (standardized) environment variables below before starting the ntlm-proxy (with either the ntlm-proxy binary or the cypress-ntlm binary):

  • HTTP_PROXY - The URL to the proxy for accessing external HTTP/HTTPS resources. Example: http://proxy.acme.com:8080
  • HTTPS_PROXY - (optional) The URL to the proxy for accessing external HTTPS resources. Overrides HTTP_PROXY for HTTPS resources. Example: http://proxy.acme.com:8080
  • NO_PROXY - A comma separated list of internal hosts to exclude from proxying. Add the host you are testing, and other local network resources used from the browser when accessing the host you are testing. Note that hosts that are located on the internet (not your intranet) must not be added, they should pass through the upstream proxy.

Include only the hostname (or IP), not the protocol or port. Wildcards are supported. Example: *.acme.com. IPv6 addresses shall be quoted in brackets like [::1].

Since the plugin requires traffic to localhost to be excluded from the corporate proxy, the plugin adds localhost and 127.0.0.1 to the NO_PROXY setting automatically unless they are already there. To disable this behavior (if you require an additional custom proxy), add <-loopback> to NO_PROXY.

Note that these environment variables must be specified as uppercase. Lowercase variants will be ignored.

Usage

cy.ntlm(ntlmHosts, username, password, [domain, [workstation]])

The ntlm command is used to configure host/user mappings. After this command, all network communication from cypress to the specified hosts is monitored by the ntlm-proxy. If the server sends an authentication challenge, the ntlm-proxy will perform a NTLM login handshake with the configured user. Note that "all network communication" includes calls to cy.visit(host), cy.request(host) and indirect network communication (when the browser fetches additional resources after the cy.visit(host) call).

If domain and workstation are not set, the ntlm-proxy will use the domain of the ntlmHost.

Syntax

cy.ntlm(ntlmHosts, username, password, [domain, [workstation, [ntlmVersion]]]);
  • ntlmHosts: array of FQDNs or hostnames of the servers where NTLM authentication shall be applied. The hosts must NOT include protocol or the rest of the url (path and query) - only host:port level authentication is supported. In addition, wildcards are allowed to simplify specifying hosts for a whole intranet. Ports cannot be combined with wildcards. Example: ['localhost:4200', '*.acme.com']
  • username: the username for the account to authenticate with
  • password: the password or the account to authenticate with (see Security advice regarding entering passwords)
  • domain (optional): the domain for the account to authenticate with (for AD account authentication). Default value: the domain of the ntlmHost.
  • workstation (optional): the workstation name of the client. Default value: os.hostname()
  • ntlmVersion (optional): the version of the NTLM protocol to use. Valid values are 1 and 2. Default value: 2. This can be useful for legacy hosts that don't support NTLMv2 or for certain scenarios where the NTLMv2 handshake fails (the plugin does not implement all features of NTLMv2 yet).

The ntlm command may be called multiple times to setup multiple ntlmHosts, also with different credentials. If the ntlm command is called with the same ntlmHost again, it overwrites the credentials for that ntlmHost. Existing connections are not terminated, but if the server requests reauthentication the new credentials will be used. To terminate existing connections when chaning credentials, use the cy.ntlmReset() command.

If multiple configurations match a hosts, the most specific configuration is applied. The order of priority is:

  1. Configuration with hostname and port
  2. Configuration with hostname
  3. Configuration with wildcard hostname

Configuration set with the ntlm command persists until it is reset (see ntlmReset command) or when the proxy is terminated. Take note that it is not cleared when the current spec file is finished.

Example

You want to test a IIS website on your intranet https://ntlm.acme.com that requires Windows Authentication and allows NTLM. The test user is acme\bobby (meaning domain acme and username bobby), and the password is brown.

cy.ntlm(["ntlm.acme.com"], "bobby", "brown", "acme");
// Access the ntlm site with user bobby
cy.visit("https://ntlm.acme.com");
// Test actions and asserts here

cy.ntlm(["ntlm.acme.com"], "admin", "secret", "acme");
// Access the ntlm site with user admin
cy.visit("https://ntlm.acme.com");
// Test actions and asserts here

cy.ntlm(["ntlm-legacy.acme.com"], "admin", "secret", "acme", undefined, 1);
// Access the ntlm-legacy site with user admin using NTLMv1
cy.visit("https://ntlm-legacy.acme.com");
// Test actions and asserts here

Security advice

Hard coding password into your test specs isn't a great idea, even though it may seem harmless. Test code will end up in a repository, which makes the full credentials for the accounts used in your tests searchable in the repository. Even if the repository is on an internal company hosted server, this is not good practice. The recommended way to handle credentials is to use config files / environment variables, and to have these populated by your release pipeline. Cypress has several options to provide custom configuration for different environments - pick one that makes sense in your pipeline.

You can then combine this with setting up multiple accounts to test your application using different levels of access (if needed by your application). Using this technique, you should end up with something like this:

// Read-only user access
cy.ntlm(
  ["ntlm.acme.com"],
  Cypress.env.NTLM_READONLY_USERNAME,
  Cypress.env.NTLM_READONLY_PASSWORD,
  Cypress.env.NTLM_READONLY_DOMAIN
);
// tests ...

// Admin user access
cy.ntlm(
  ["ntlm.intranet.acme.com"],
  Cypress.env.NTLM_ADMIN_USERNAME,
  Cypress.env.NTLM_ADMIN_PASSWORD,
  Cypress.env.NTLM_ADMIN_DOMAIN
);
// tests ...

Pro-tip: baseUrl

If you are testing a single site, it is convenient to set the baseUrl parameter in Cypress to the hostname, so you don't have to provide it on every call to cy.visit() or cy.request(). Set it in cypress.json or simply use:

Cypress.env.baseUrl = ntlmHost;

This will persist until the current spec file is finished.

cy.ntlmSso(ntlmHosts)

The ntlmSso command is used to configure host for single sign on authentication. After this command, all network communication from cypress to the specified hosts is monitored by the ntlm-proxy. If the server sends an authentication challenge, the ntlm-proxy will perform a NTLM or Negotiate login handshake with the credentials of the user running the test client. Note that "all network communication" includes calls to cy.visit(host), cy.request(host) and indirect network communication (when the browser fetches additional resources after the cy.visit(host) call).

Syntax

cy.ntlmSso(ntlmHosts);
  • ntlmHosts: array of FQDNs or hostnames of the servers where NTLM or Negotiate authentication with single sign on shall be applied. The hosts must NOT include protocol, port or the rest of the url (path and query) - only host level authentication is supported. In addition, wildcards are allowed to simplify specifying SSO for a whole intranet. Example: ['localhost', '*.acme.com']

The ntlmSso command may be called multiple times, each call will overwrite the previous ntlmSso configuration.

The NTLM protocol version cannot be specified, it is negotiated automatically. The client will follow the settings in Windows (LMCompatibilityLevel), which could mean that a legacy host with NTLMv1 only cannot be accessed if the client settings don't allow NTLMv1.

Configuration set with the ntlmSso command persists until it is reset (see ntlmReset command) or when the proxy is terminated. Take note that it is not cleared when the current spec file is finished.

Example

You want to test a IIS website on your intranet https://ntlm.acme.com that requires Windows Authentication and allows NTLM.

// Enable single sign on all hosts within *.acme.com
cy.ntlmSso(["*.acme.com"]);
// Access the ntlm site with the user running the test client
cy.visit("https://ntlm.acme.com");
// Test actions and asserts here

// Enable single sign on for both ntlm.acme-legacy.com and all hosts within *.acme.com
cy.ntlmSso(["ntlm.acme-legacy.com", "*.acme.com"]);
// Access the legacy site with the user running the test client
cy.visit("https://ntlm.acme-legacy.com");
// Test actions and asserts here

cy.ntlmReset()

The ntlmReset command is used to remove all connections and all configured ntlmHosts from previous ntlm command calls. Since the proxy configuration persists even when a test case or spec file is finished, a good practice is to call ntlmReset in the beforeEach method. This ensures that you have a clean setup at the start of each test.

Syntax

cy.ntlmReset();

Example

Using ntlmReset to clear configuration.

cy.ntlm(["ntlm.acme.com"], "bobby", "brown", "acme");
cy.visit("https://ntlm.acme.com"); // This succeeds
cy.ntlmReset();
cy.visit("https://ntlm.acme.com"); // This fails (401)

Debugging

When reporting issues with this plugin, please collect debug logs for your scenario as described below and add them to the issue.

shell (Mac or Linux)

  1. Open a terminal and go to your project root directory.
  2. DEBUG=cypress:plugin:ntlm-auth npx cypress-ntlm open
  3. Run your cypress tests and view the logs in the terminal.

cmd (Windows)

  1. Open a cmd window and go to your project root directory.
  2. set DEBUG=cypress:plugin:ntlm-auth
  3. npx cypress-ntlm open
  4. Run your cypress tests and view the logs in the cmd window.

Powershell (Windows)

  1. Open a Powershell window and go to your project root directory.
  2. $env:DEBUG='cypress:plugin:ntlm-auth'
  3. npx cypress-ntlm open
  4. Run your cypress tests and view the logs in the Powershell window.

Debug logging of NTLM and Negotiate headers

To write also the NTLM and Negotiate headers sent and received by ntlm-proxy, set the environment variable DEBUG_NTLM_HEADERS=1. If you use this, take some care with the logs since access to the NTLM and Negotiate headers are an attack vector for the account, especially if you are using NTLMv1.

Node module API

This plugin can also be called as a Node module.

cypress-ntlm API

The cypress-ntlm API mimics the behavior of the run and open methods in Cypress module API - accepting the same arguments, passing them on to Cypress and returning the same value. It will automatically start the ntlm-proxy before calling cypress.run(), and it will shut down the ntlm-proxy after the tests have finished.

Example

const cypressNtlmAuth = require("cypress-ntlm-auth/dist");
cypressNtlmAuth
  .run({
    spec: "./cypress/integration/test.spec.js",
  })
  .then((result) => console.log(result))
  .catch((err) => console.log(err));

ntlm-proxy API

It is also possible to launch and control the ntlm-proxy through the API, without using Cypress. Through this method, it is possible to launch multiple parallel ntlm-proxy instances within the same node process. Each process can operate independently with unique configuration, making it possible to act as multiple users towards the same site simultaneously. This may be useful for testing chat servers for instance.

Factory method

  • startNtlmProxy() : starts a ntlm-proxy and returns a NtlmProxy object. It contains a ports property with the URLs to config API and to the proxy. The URL to the proxy should be used to configure your test object (likely a browser) to ensure the traffic will pass through the proxy.

NtlmProxy methods

All these methods mimic the corresponding Cypress commands, see Usage for details about the arguments.

  • async NtlmProxy.alive() : check if the proxy responds. Returns a resets configuration and connections in the proxy
  • async NtlmProxy.reset() : resets configuration and connections in the proxy
  • async NtlmProxy.ntlm(NtlmConfig) : adds an NTLM enabled site (or an array of sites) to the proxy
  • async NtlmProxy.ntlmSso(NtlmSsoConfig) : sets which sites should perform SSO authentication. Only supported on Windows.
  • async NtlmProxy.stop() : closes all connections and stops the proxy.

Example

const cypressNtlmAuth = require("cypress-ntlm-auth/dist");

async function run() {
  let proxy = await cypressNtlmAuth.startNtlmProxy();
  console.log(proxy);
  await proxy.reset();
  let ntlmConfig = {
    ntlmHosts: ["localhost:5000"],
    username: "bobby",
    password: "brown",
    domain: "acme",
  };
  await proxy.ntlm(ntlmConfig);

  let ntlmSso = {
    ntlmHosts: ["localhost:5006"],
  };
  // ntlmSso will throw on non-Windows OS
  await proxy.ntlmSso(ntlmSso);

  await proxy.alive();
  await proxy.stop();
}
run();

Notes

Docker and global installs

When using the Docker containers provided by Cypress, Cypress is installed globally. Since this plugin requires the Node module API of Cypress, one cannot mix global Cypress with a local install of the plugin. There are two options:

  1. Install cypress-ntlm-auth both globally and locally, and use global binary to start it (use cypress-ntlm, not npx cypress-ntlm).
  2. Install cypress-ntlm-auth globally and modify the cypress/support/index.js file to use the path of the global installation of the plugin. The path to use can be found by entering npm root -g. Prefix the import statement of cypress-ntlm-auth with this path. For instance, the typical path for a linux installation should be /usr/local/lib/node_modules, meaning that for that environment the import statement in cypress/support/index.js should be
import "/usr/local/lib/node_modules/cypress-ntlm-auth/dist/commands";

Which option to use is up to you. The first option is platform agnostic but requires the extra step of the local install (a Docker container can be prepared with all the global installs already in place). The second option removes the requirement of the local install, but the import path specified is not portable - it will vary between different OS variants, and also if you have multiple Node versions installed.

An example repository using method 1 above can be found here: cypress-ntlm-auth-docker

.http-mitm-proxy

The http-mitm-proxy library will create a .http-mitm-proxy folder with generated certificates. This improves performance when re-running tests using the same sites. It is recommended to add this folder to your .gitignore so the certificates don't end up in your repo.

https on localhost

The NTLM proxy will accept self-signed certificates for sites that are served from localhost. This is convenient for testing local development builds without requiring a full CA chain for the certificates, while still requiring proper certificates from external servers.

HTTPS/SSL/TLS validation

By default, the plugin will validate certs (except for localhost targets) and log any validation errors as warnings. The plugin can also be configured to a stricter mode, preventing connections to targets that do not pass the validation. See HTTPS/SSL/TLS Certificates for details.

Build instructions

Transpile

The plugin is written in TypeScript and the git repository does not include the transpiled files. Hence, if you need to build the plugin from source:

npm run build

This transpiles the sources into the dist folder, copies additional files to dist and sets permissions for the launchers.

Test

To run the unit test suite:

npm test

Credits

  • http-mitm-proxy - this proxy is used to intercept the traffic and inject the NTLM handshake. I chose this one because it includes full https support with certificate generation.
  • ntlm-client - Strong inspiration for the NTLM methods in this library.
  • ntlm-auth - Python library for NTLM authentication. Used as a reference implementation to generate NTLM headers for unit tests.
  • express-ntlm - simplified local testing of cypress-ntlm-auth, since no real Windows server was required.
  • Github Actions - makes automated testing of multiple platforms and multiple node versions so much easier.

changelog

Changelog

4.2.3 - released 2025-05-06

  • Dependency bump

4.2.2 - released 2025-05-05

  • Fix for #264: Handle <-loopback> in NO_PROXY environment variable
  • Dependency bump

4.2.1 - released 2025-02-04

  • Dependency bump
  • Added more JSdoc to source

4.2.0 - released 2024-09-09

  • Fix: Corrected parsing of encoding flags in NTLM header. Thanks @culling

4.1.7 - released 2024-04-16

  • Fix #254: Handle IPv6 loopback ::1 in NO_PROXY
  • Improved error reporting on upstream proxy settings

4.1.6 - released 2024-04-16

  • Fix #253: Improved TypeScript typings, updated docs for typings
  • Dependency bump

4.1.5 - released 2024-03-28

  • Fix #249: Corrected dependency versions

4.1.4 - released 2024-03-27

  • Fix #249: Custom status messages for other requests than NTLM handshake
  • Dependency bump

4.1.3 - released 2023-09-29

  • Fix #241: Include cookies in auth request
  • Dependency bump

4.1.2 - released 2023-03-05

  • Fix #225: Client socket reuse combined with switching protocols (http/https) caused an invalid agent to be used.
  • Dependency bump

4.1.1 - released 2022-11-04

  • Fix #220: Updated readme to reflect current file names used by Cypress
  • Added missing debug dependency
  • Dependency bump

4.1.0 - released 2022-09-21

  • Update win-sso for improved Negotiate/Kerberos support
  • Detect and reject invalid URL formats in environment variables

4.0.5 - released 2022-09-19

  • Dependency bump
  • Update cypress in test suite, adapted to v10 and typescript

4.0.4 - released 2022-09-06

  • Fix #210: Cannot call reset when NTLM host '*' is configured

4.0.3 - released 2022-09-06

  • Fix #208: Cannot set port for ntlm-proxy

4.0.2 - released 2022-05-07

  • Bump dependencies

4.0.1 - released 2022-04-23

  • Support Node 18

4.0.0 - released 2022-04-13

  • Refactored HTTPS validation. By default, the validation will only warn of errors but not break the test. See HTTPS/SSL/TLS Certificates for details.
  • Improved error logging
  • Support Node 17
  • Fixed support from 14.13.1
  • HTTPS stability improvements
  • IPv6 support. Cypress does not fully support IPv6 yet though.

3.2.6 - released 2022-02-19

  • Fix issue #194 - went back to commonjs for wider compatibility

3.2.5 - released 2022-02-10

  • Fix issue in 3.2.4 with SSL tunnels

3.2.4 - released 2022-02-09 deprecated

  • Migrated to ESM
  • Bump dependencies
  • Implemented internal tunnelling agent

3.2.3 - released 2021-06-23

  • Fix #175: Pass on custom status phrases in response

3.2.2 - released 2021-05-10

  • Bump dependencies

3.2.1 - released 2021-05-10

  • Bump dependencies

3.2.0 - released 2021-03-16

  • Fix #163: Break client connection on network error

3.1.7 - released 2021-02-12

  • Fix #161: Re-authenticate on new request after authentication failed

3.1.6 - released 2021-02-09

  • Fix #159: Support cypress with typescript specfiles

3.1.5 - released 2021-01-12

  • Fix #157: Corrected peer dependency version of Cypress, accept any version from 5.0.0 and up
  • Bump dependencies

3.1.4 - released 2021-01-02

  • Migrated to Github Actions

3.1.3 - released 2020-12-23

  • Fix #151: Remove unused dependencies
  • Migrated from tslint to ESlint

3.1.2 - released 2020-12-06

  • Fix #144: websockets were not correctly closed on ntlmReset
  • Added E2E tests to CI

3.1.1 - released 2020-10-31

  • Update http-mitm-proxy

3.1.0 - released 2020-10-23

  • Fix #138: Exported Node module API for creating, controlling and stopping multiple ntlm-proxy instances

3.0.1 - released 2020-10-21

  • Fix #139: cypress-ntlm launcher updated to support global install
  • Updated docs with Docker info

3.0.0 - released 2020-10-02

  • Support for multiple instances!
  • Rewritten launcher, ntlm-proxy is now started as part of cypress-ntlm
  • Cypress plugin config no longer needed - this means that it is now possible to launch cypress or cypress-ntlm without modifying the plugins file.
  • Return 502 if connect fails
  • Fix #129: It is now possible to specify ports for configApi and ntlmProxy using environment variables when starting ntlm-proxy
  • Alive now returns the current ports
  • Use of external ntlm-proxy now only requires setting CYPRESS_NTLM_AUTH_API environment variable
  • Fix #114: Close client sockets on reset or quit
  • Clean up socket close listeners

2.3.0 - released 2020-09-20

  • Fix #117 - Support wildcards in cy.ntlm
  • Package bumps

2.2.5 - released 2020-03-18

  • Better logging when Negotiate authentication fails

2.2.4 - released 2020-03-02

  • Improved detection of SSO usage after reset

2.2.3 - released 2020-02-19

  • Updated fix #101 - Override additional unused proxy environment variables before launching cypress to avoid conflicting configurations.

2.2.2 - released 2020-02-19

  • Fix #101 - Override unused proxy environment variables before launching cypress to avoid conflicting configurations.

2.2.1 - released 2020-02-08

  • Fix #99 - Update useSso property on each request to improve stability after ntlmReset

2.2.0 - released 2020-02-02

  • Fix #95 - Add 127.0.01 to NO_PROXY for axios compatibility
  • Better usability with corporate proxies - NO_PROXY now includes localhost and 127.0.0.1 by default to simplify configuration
  • Package bumps

2.1.0 - released 2020-01-11

  • Improvements in Negotiate authentication.
  • Unit tests for Negotiate authentication.

2.0.5 - released 2019-12-03

  • Fix #76 - SSO hosts can now be specified using wildcards.

2.0.4 - released 2019-11-28

  • Unit tests for fix of #88
  • Handled the case when server prompts for reauthentication after a host reconfiguration
  • Fixed #86: Increased startup wait time for ntlm-proxy to 15 seconds

2.0.3 - released 2019-11-13

  • Attempt to fix #80 without a forced quit. All tunnels established for HTTPS passthrough are now indexed and closed on reset or quit.
  • Moved back to original http-mitm-proxy since the required changes are now in the official release.
  • Package bumps

2.0.2 - released 2019-10-29

  • Fixed #81: Cypress 3.5.0 now supported also for localhost sites.
  • Improved responses on failed handshakes
  • Minor improvements for NodeJS 13 compatibility

2.0.1 - released 2019-10-14

  • Fixed #75: Node module API available. The ntlm-proxy and cypress can now be started as a function call in node, see the README for example code.

2.0.0 - released 2019-10-12

  • Fixed #73: Single sign on is here! This is a big improvement in usability and security (no password required) for use cases where authentication only needs a single user, and that user is the same as the account running the tests. Naturally this only works on Windows OSs test clients.

1.3.2 - released 2019-08-28

  • Fix #58: Refactored NTLM library to typescript
  • Fix #71: Reuse actual NTLM type 1 message when calculating MIC
  • Package bump

1.3.1 - released 2019-08-02

  • Package bump due to security issue

1.3.0 - released 2019-07-30

  • Implemented support for SERVER_TIMESTAMP and MIC of NTLM protocol
  • Improved unit tests for NTLM headers
  • Bumped dependencies
  • Fix #60: NTLM version can now be set in the cy.ntlm call. Defaults to NTLMv2.
  • Fix #62, #64 and #65: Implemented full NTLM handshake. Authentication is only initiated when the server sends a 401 challenge response which indicates that NTLM authentication is supported (previous versions started the handshake proactively). This should resolve the issues seen by some users for:
    • CORS preflight messages (#65)
    • when the server repeats the challenge after first authentication (#64)
    • subsites within a host that does not use NTLM authentication (#62)

1.2.1 - released 2019-07-13

  • Made workstation field more consistent in NTLM messages. Fixes authentication issues with some NTLMv2 hosts.

1.2.0 - released 2019-06-29

  • Implemented internal NTLM library based on node-ntlm-client
  • Unit tests of NTLM headers
  • Fixed #55: Authentication of users from another domain than the NTLM target

1.1.1 - released 2019-06-22

  • Improved documentation of debug logging
  • Added more verbose logging of NTLM headers with environment variable DEBUG_NTLM_HEADERS=1
  • Removed duplicate agent removal

1.1.0 - released 2019-06-13

  • Fixed #50: Support for NTLMv1 and NTLMv2 through new NTLM library
  • Chrome network probing no longer logged as errors
  • Bumped dependencies

1.0.7 - released 2019-06-07

  • Added prepare script to ensure that the latest build is always included on publish
  • Fixed #46, cy.ntlmReset now works as intended
  • Replaced git reference of http-mitm-proxy dependency with a scoped package to simplify installation procedure. Will revert to the original library when it is released to npm
  • Bumped dependencies

1.0.6 - released 2019-06-03

  • Patch for 1.0.5, the release did not include the latest build

1.0.5 - released 2019-06-03

  • Updated node-http-mitm-proxy for better handling of https tunnel closing

1.0.4 - released 2019-05-29

  • Patch for 1.0.3, the release did not include the latest build

1.0.3 - released 2019-05-29

  • Fix issue #40, direct tunnels are now properly closed when client closes connection.
  • Removes also non-NTLM agents on proxy shutdown

1.0.2 - released 2019-05-24

  • Use custom version of node-http-mitm-proxy to resolve issue with delayed 304 responses in Cypress

1.0.1 - released 2019-05-23

  • Replaced eslint with tslint due to move to TypeScript
  • Fixed linter errors
  • Updated dependencies, removed unused dependencies
  • More stable startup procedure - if an old ntlm-proxy instance is detected, cypress-ntlm will wait a bit for it to quit before polling for the new instance
  • Upstream proxies: HTTP_PROXY covers also SSL traffic (HTTPS_PROXY only overrides it)
  • Check if cypress is installed on launch
  • Updated dependencies
  • Lowest supported version of nodejs is now 8.9.3 (since Cypress updated its supported version)

1.0.0 - released 2019-05-11

  • BREAKING CHANGE: The import files for cypress plugin and cypress command have been relocated due to the TypeScript rewrite.
    • Update your import path in cypress/plugins/index.js: change import 'cypress-ntlm-auth/src/plugin' to import 'cypress-ntlm-auth/dist/plugin'
    • Update your import path in cypress/support/index.js: change import 'cypress-ntlm-auth/src/commands' to import 'cypress-ntlm-auth/dist/commands'
  • Rewritten in TypeScript
  • Applied dependency injection to simplify unit testing
  • Improved unit testing
  • Added manual duration tests to validate that there are no apparent memory leaks
  • Fixed issue #28: Plain GET call to proxy causes infinite loop
  • Updated dependencies

0.9.4 - released 2019-05-08

  • Fixed issue #34: cypress-ntlm now waits up to 5 seconds for ntlm-proxy to start before giving up

0.9.3 - released 2019-04-30

  • Fixed issue #32: ntlm-proxy now respects the NODE_TLS_REJECT_UNAUTHORIZED environment variable
  • Added manual duration tests
  • Minor adjustment to logging format

0.9.2 - released 2019-03-05

  • Fixed issue #23: proxying sites on default ports when cy.ntlm was called without the port number.
  • Updated dependencies

0.9.1 - released 2019-02-14

  • Bumped versions of dependencies, now using official version of http-mitm-proxy again
  • Added LGTM checking

0.9.0 - released 2019-02-08

  • Enabled automated unit tests for Windows, OS X and Linux with multiple node versions with Travis-CI
  • Improved handling of sockets (used when proxying HTTPS sites) - the ECONNRESET error was not raised on early versions of node and it occurs more commonly on other platforms (Windows). The automated unit tests therefore required that these errors were handled.
  • Uses custom version of http-mitm-proxy with improved socket handling (see above) while waiting for a fixed release

0.8.1 - released 2019-01-26

  • Unit test refactoring
  • Cleanup after lint

0.8.0 - released 2019-01-25

  • Upstream proxy support
  • Further improvements to unit tests

0.7.2 - released 2019-01-23

  • Filter out confusing debug logs from cy.ntlm and cy.ntlmReset calls

0.7.1 - released 2019-01-23

  • Corrected input validation on cy.ntlm command
  • Unit tests for HTTPS

0.7.0 - released 2019-01-22

  • More complete input validation for arguments to cy.ntlm command and better error reporting
  • Corrected docs regarding domain and workstation arguments
  • More unit tests

0.6.0 - released 2019-01-17

  • Fixed issue #11 - Requests other then GET are not properly send
  • Improved examples in README for Windows users
  • More robust handling of invalid states during NTLM handshake
  • Validation that NTLM handshake is fully complete
  • The Chrome browser sends three odd requests during startup to detect network behavior. These were logged as errors since they are connecting to non-existent hosts. Those errors are now filtered with understandable debug messages.

0.5.0 - released 2019-01-10

  • Changed termination handling for common handling also on Windows. This means that the ntlm-proxy is no longer terminated from the signals when cypress exits - instead a separate binary ntlm-proxy-exit is provided that will send the quit command to the ntlm-proxy. This can then be executed directly after cypress exits, see updated README.
  • Improved handling of hosts on standard ports (80/443)
  • Improved command example comments
  • Changed debug prefix to cypress:plugin:ntlm-auth

0.4.0 - released 2019-01-07

  • Replaced platform-folders with appdata-path to reduce build complexity on Windows platform (no node-gyp tool-chain required)
  • Added startup validation of HTTP_PROXY environment variable to detect invalid startup

0.3.3 - released 2019-01-06

  • Improved unit tests
  • Code cleanup with eslint
  • Minor fixes to NTLM handshake error handling

0.3.2 - released 2018-12-27

  • Don't show internal communication in Cypress test log
  • Documentation layout

0.3.1 - released 2018-12-27

  • Removed unused files
  • Minor documentation improvements (layout, spelling)

0.3.0 - released 2018-12-27

  • Added graceful termination of the ntlm-proxy process when Cypress exits
  • Documentation improvements

0.2.0 - released 2018-12-25

  • Added support for NTLM hosts with https
  • Fixed race condition between new and old proxy instance on startup
  • Documentation improvements

0.1.2 - released 2018-12-23

  • Improved cleanup of agents
  • Documentation improvements

0.1.1 - released 2018-12-23

  • Fixed startup issue
  • Added unit tests for portsFile

0.1.0 - released 2018-12-23

  • Initial release