win-sso 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/os-supported.d.ts +1 -2
- package/dist/os-supported.js +1 -2
- package/dist/utils/i.win-sso-addon.d.ts +7 -0
- package/dist/utils/i.win-sso-addon.js +2 -0
- package/dist/win-sso.d.ts +13 -20
- package/dist/win-sso.js +16 -24
- package/package.json +1 -1
- package/prebuilds/win32-ia32/win-sso.node +0 -0
- package/prebuilds/win32-x64/win-sso.node +0 -0
package/dist/os-supported.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns true if the current platform is supported by the win-sso module. Only Windows OSs are supported.
|
|
3
3
|
* If false, all other methods in the module will throw.
|
|
4
|
-
*
|
|
5
|
-
* @returns {boolean} Is the os supported
|
|
4
|
+
* @returns Is the os supported
|
|
6
5
|
*/
|
|
7
6
|
export declare function osSupported(): boolean;
|
package/dist/os-supported.js
CHANGED
|
@@ -8,8 +8,7 @@ const os_1 = __importDefault(require("os"));
|
|
|
8
8
|
/**
|
|
9
9
|
* Returns true if the current platform is supported by the win-sso module. Only Windows OSs are supported.
|
|
10
10
|
* If false, all other methods in the module will throw.
|
|
11
|
-
*
|
|
12
|
-
* @returns {boolean} Is the os supported
|
|
11
|
+
* @returns Is the os supported
|
|
13
12
|
*/
|
|
14
13
|
function osSupported() {
|
|
15
14
|
return os_1.default.platform() === "win32";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface IWinSsoAddon {
|
|
2
|
+
createAuthContext(securityPackage: string, targetHost: string | undefined, applicationData: Buffer, flags: number | undefined): number;
|
|
3
|
+
freeAuthContext(authContextId: number): void;
|
|
4
|
+
getLogonUserName(): string;
|
|
5
|
+
createAuthRequest(authContextId: number): Buffer;
|
|
6
|
+
createAuthResponse(authContextId: number, inToken: Buffer): Buffer;
|
|
7
|
+
}
|
package/dist/win-sso.d.ts
CHANGED
|
@@ -10,27 +10,24 @@ export declare class WinSso {
|
|
|
10
10
|
* Creates an authentication context for SSO.
|
|
11
11
|
* This allocates memory buffers, the freeAuthContext method should be called
|
|
12
12
|
* to free them (on error or after authentication is no longer needed)
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param {PeerCertificate | undefined} peerCert The certificate of the target server
|
|
13
|
+
* @param securityPackage The name of the security package (NTLM or Negotiate)
|
|
14
|
+
* @param targetHost The FQDN hostname of the target (optional for NTLM, required for Kerberos)
|
|
15
|
+
* @param peerCert The certificate of the target server
|
|
17
16
|
* (optional, for HTTPS channel binding)
|
|
18
|
-
* @param
|
|
17
|
+
* @param flags Flags to set in the authentication context
|
|
19
18
|
* If not set, NTML defaults to no flags, while Negotiate defaults to ISC_REQ_MUTUAL_AUTH | ISC_REQ_SEQUENCE_DETECT
|
|
20
19
|
* (optional, allows customizing security features)
|
|
21
20
|
*/
|
|
22
21
|
constructor(securityPackage: string, targetHost: string | undefined, peerCert: PeerCertificate | undefined, flags: number | undefined);
|
|
23
22
|
/**
|
|
24
23
|
* Retrieves the username of the logged in user
|
|
25
|
-
*
|
|
26
|
-
* @returns {string} user name including domain
|
|
24
|
+
* @returns user name including domain
|
|
27
25
|
*/
|
|
28
26
|
static getLogonUserName(): string;
|
|
29
27
|
/**
|
|
30
28
|
* Transforms target TLS certificate into a channel binding application data buffer
|
|
31
|
-
*
|
|
32
|
-
* @
|
|
33
|
-
* @returns {Buffer} Application data buffer
|
|
29
|
+
* @param peerCert Target TLS certificate
|
|
30
|
+
* @returns Application data buffer
|
|
34
31
|
*/
|
|
35
32
|
private getChannelBindingsApplicationData;
|
|
36
33
|
/**
|
|
@@ -41,31 +38,27 @@ export declare class WinSso {
|
|
|
41
38
|
freeAuthContext(): void;
|
|
42
39
|
/**
|
|
43
40
|
* Creates an authentication request token
|
|
44
|
-
*
|
|
45
|
-
* @returns {Buffer} Raw token buffer
|
|
41
|
+
* @returns Raw token buffer
|
|
46
42
|
*/
|
|
47
43
|
createAuthRequest(): Buffer;
|
|
48
44
|
/**
|
|
49
45
|
* Creates an authentication request header
|
|
50
|
-
*
|
|
51
|
-
* @returns {string} The www-authenticate header
|
|
46
|
+
* @returns The www-authenticate header
|
|
52
47
|
*/
|
|
53
48
|
createAuthRequestHeader(): string;
|
|
54
49
|
/**
|
|
55
50
|
* Creates an authentication response token
|
|
56
|
-
*
|
|
57
|
-
* @param {string} inTokenHeader The www-authentication header received from the target
|
|
51
|
+
* @param inTokenHeader The www-authentication header received from the target
|
|
58
52
|
* in response to the authentication request
|
|
59
|
-
* @returns
|
|
53
|
+
* @returns Raw token buffer. May be empty if Negotiate handshake is complete.
|
|
60
54
|
*/
|
|
61
55
|
createAuthResponse(inTokenHeader: string): Buffer;
|
|
62
56
|
private isNtlmV1;
|
|
63
57
|
/**
|
|
64
58
|
* Creates an authentication response header
|
|
65
|
-
*
|
|
66
|
-
* @param {string} inTokenHeader The www-authentication header received from the target
|
|
59
|
+
* @param inTokenHeader The www-authentication header received from the target
|
|
67
60
|
* in response to the authentication request
|
|
68
|
-
* @returns
|
|
61
|
+
* @returns The www-authenticate header. May be an empty string if Negotiate handshake is complete.
|
|
69
62
|
*/
|
|
70
63
|
createAuthResponseHeader(inTokenHeader: string): string;
|
|
71
64
|
}
|
package/dist/win-sso.js
CHANGED
|
@@ -8,10 +8,11 @@ const debug_logger_1 = require("./utils/debug.logger");
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
let winSsoAddon;
|
|
10
10
|
try {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
11
12
|
winSsoAddon = require("node-gyp-build")(path_1.default.join(__dirname, ".."));
|
|
12
13
|
(0, debug_logger_1.debug)("Loaded win-sso native module");
|
|
13
14
|
}
|
|
14
|
-
catch (
|
|
15
|
+
catch (_a) {
|
|
15
16
|
(0, debug_logger_1.debug)("Could not load win-sso native module");
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
@@ -22,12 +23,11 @@ class WinSso {
|
|
|
22
23
|
* Creates an authentication context for SSO.
|
|
23
24
|
* This allocates memory buffers, the freeAuthContext method should be called
|
|
24
25
|
* to free them (on error or after authentication is no longer needed)
|
|
25
|
-
*
|
|
26
|
-
* @param
|
|
27
|
-
* @param
|
|
28
|
-
* @param {PeerCertificate | undefined} peerCert The certificate of the target server
|
|
26
|
+
* @param securityPackage The name of the security package (NTLM or Negotiate)
|
|
27
|
+
* @param targetHost The FQDN hostname of the target (optional for NTLM, required for Kerberos)
|
|
28
|
+
* @param peerCert The certificate of the target server
|
|
29
29
|
* (optional, for HTTPS channel binding)
|
|
30
|
-
* @param
|
|
30
|
+
* @param flags Flags to set in the authentication context
|
|
31
31
|
* If not set, NTML defaults to no flags, while Negotiate defaults to ISC_REQ_MUTUAL_AUTH | ISC_REQ_SEQUENCE_DETECT
|
|
32
32
|
* (optional, allows customizing security features)
|
|
33
33
|
*/
|
|
@@ -47,21 +47,18 @@ class WinSso {
|
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Retrieves the username of the logged in user
|
|
50
|
-
*
|
|
51
|
-
* @returns {string} user name including domain
|
|
50
|
+
* @returns user name including domain
|
|
52
51
|
*/
|
|
53
52
|
static getLogonUserName() {
|
|
54
53
|
return winSsoAddon.getLogonUserName();
|
|
55
54
|
}
|
|
56
55
|
/**
|
|
57
56
|
* Transforms target TLS certificate into a channel binding application data buffer
|
|
58
|
-
*
|
|
59
|
-
* @
|
|
60
|
-
* @returns {Buffer} Application data buffer
|
|
57
|
+
* @param peerCert Target TLS certificate
|
|
58
|
+
* @returns Application data buffer
|
|
61
59
|
*/
|
|
62
60
|
getChannelBindingsApplicationData(peerCert) {
|
|
63
|
-
const
|
|
64
|
-
const hash = cert.fingerprint256.replace(/:/g, "");
|
|
61
|
+
const hash = peerCert.fingerprint256.replace(/:/g, "");
|
|
65
62
|
const hashBuf = Buffer.from(hash, "hex");
|
|
66
63
|
const tlsServerEndPoint = "tls-server-end-point:";
|
|
67
64
|
const applicationDataBuffer = Buffer.alloc(tlsServerEndPoint.length + hashBuf.length);
|
|
@@ -79,8 +76,7 @@ class WinSso {
|
|
|
79
76
|
}
|
|
80
77
|
/**
|
|
81
78
|
* Creates an authentication request token
|
|
82
|
-
*
|
|
83
|
-
* @returns {Buffer} Raw token buffer
|
|
79
|
+
* @returns Raw token buffer
|
|
84
80
|
*/
|
|
85
81
|
createAuthRequest() {
|
|
86
82
|
const token = winSsoAddon.createAuthRequest(this.authContextId);
|
|
@@ -89,8 +85,7 @@ class WinSso {
|
|
|
89
85
|
}
|
|
90
86
|
/**
|
|
91
87
|
* Creates an authentication request header
|
|
92
|
-
*
|
|
93
|
-
* @returns {string} The www-authenticate header
|
|
88
|
+
* @returns The www-authenticate header
|
|
94
89
|
*/
|
|
95
90
|
createAuthRequestHeader() {
|
|
96
91
|
const header = this.securityPackage + " " + this.createAuthRequest().toString("base64");
|
|
@@ -98,10 +93,9 @@ class WinSso {
|
|
|
98
93
|
}
|
|
99
94
|
/**
|
|
100
95
|
* Creates an authentication response token
|
|
101
|
-
*
|
|
102
|
-
* @param {string} inTokenHeader The www-authentication header received from the target
|
|
96
|
+
* @param inTokenHeader The www-authentication header received from the target
|
|
103
97
|
* in response to the authentication request
|
|
104
|
-
* @returns
|
|
98
|
+
* @returns Raw token buffer. May be empty if Negotiate handshake is complete.
|
|
105
99
|
*/
|
|
106
100
|
createAuthResponse(inTokenHeader) {
|
|
107
101
|
(0, debug_logger_1.debug)("Received www-authentication response", inTokenHeader);
|
|
@@ -137,7 +131,6 @@ class WinSso {
|
|
|
137
131
|
throw err;
|
|
138
132
|
}
|
|
139
133
|
}
|
|
140
|
-
// eslint-disable-next-line require-jsdoc
|
|
141
134
|
isNtlmV1(type2message) {
|
|
142
135
|
if (type2message.length >= 24) {
|
|
143
136
|
const inTokenFlags = type2message.readInt32BE(20);
|
|
@@ -149,10 +142,9 @@ class WinSso {
|
|
|
149
142
|
}
|
|
150
143
|
/**
|
|
151
144
|
* Creates an authentication response header
|
|
152
|
-
*
|
|
153
|
-
* @param {string} inTokenHeader The www-authentication header received from the target
|
|
145
|
+
* @param inTokenHeader The www-authentication header received from the target
|
|
154
146
|
* in response to the authentication request
|
|
155
|
-
* @returns
|
|
147
|
+
* @returns The www-authenticate header. May be an empty string if Negotiate handshake is complete.
|
|
156
148
|
*/
|
|
157
149
|
createAuthResponseHeader(inTokenHeader) {
|
|
158
150
|
const tokenBuffer = this.createAuthResponse(inTokenHeader);
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|