You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow to overwrite implementation details based on the request.connection
This commit introduces three new methods to the options, providing the developer using the middleware with the ability to modify how the NTLM user data and proxy cache ID are stored. This enhancement enables the middleware to be used with a (reverse) proxy if the application can supply a unique identifier for the user.
The default behavior of storing the user data and proxy cache ID on the request.connection is maintained as the default value for the new options.
Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,7 +98,10 @@ It's not recommended, but it's possible to add NTLM-Authentication without valid
98
98
|`domaincontroller`|`null` / `string` / `array`|`null`| One or more domaincontroller(s) to handle the authentication. If `null` is specified the user is not validated. Active Directory is supported. |
99
99
|`tlsOptions`|`object`|`undefined`| An options object that will be passed to [tls.connect](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) and [tls.createSecureContext](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options). __Only required when using ldaps and the server's certificate is signed by a certificate authority not in Node's default list of CAs.__ (or use [NODE_EXTRA_CA_CERTS](https://nodejs.org/api/cli.html#cli_node_extra_ca_certs_file) environment variable)|
100
100
|`tlsOptions.ca`|`string` / `array` / `Buffer`|`undefined`| Override the trusted CA certificates provided by Node. Refer to [tls.createSecureContext](https://nodejs.org/api/tls.html#tls_tls_createsecurecontext_options)|
101
-
|`getConnectionId`|`function`|`function(request, response) { return utils.uuidv4(); }`| Function to generate custom connection IDs, based optionally on the request and response objects. |
101
+
|`getConnectionId`|`function`|`function(request, response) { return utils.uuidv4(); }`| Function to generate custom connection IDs, based optionally on the request and response objects. Used by the default implementation of `getProxyId` to keep backwards compatibility. *deprecated*|
102
+
|`getProxyId`|`function`|`function(request, response) { if (!request.connection.id) { request.connection.id = options.getConnectionId(request, response); } return request.connection.id; }`| Function to generate custom proxy cache IDs, based optionally on the request and response objects. |
103
+
|`getCachedUserData`|`function`|`function(request, response) { return request.connection.ntlm; }`| Function to return the cached NTLM user data. |
104
+
|`addCachedUserData`|`function`|`function(request, response, userData) { request.connection.ntlm = userData; }`| Function to cache the NTLM user data. |
0 commit comments