win-sso 1.0.1 → 1.1.6

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 Björn Weström
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Björn Weström
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,113 +1,113 @@
1
- # node-win-sso
2
-
3
- NTLM and Negotiate single-sign-on for Node.js
4
-
5
- ## Introduction
6
-
7
- When using web applications through popular browsers on Windows OS, the user can be logged in automatically to trusted sites that support Windows Authentication. This module allows Node.js applications to deliver a similar single-sign-on user experience, by utilizing native Win32 API calls.
8
-
9
- ## Installation
10
-
11
- Only Windows OSs are supported. The module can be installed on any Node.js platform, but the native module won't be built.
12
-
13
- ```shell
14
- npm install win-sso
15
- ```
16
-
17
- ## Usage
18
-
19
- Usage of this module requires some knowledge of the NTLM or Negotiate handshake process. There are multiple sources for this on the web, a starting point for NTLM could be:
20
-
21
- * https://www.innovation.ch/personal/ronald/ntlm.html
22
-
23
- ### Brief NTLM example
24
-
25
- 1. Client: Send http request to server (with FQDN `app.server.com`)
26
- 2. Server: Respond with 401 where the `www-authenticate` header includes NTLM
27
- 3. Client: Create WinSso instance for NTLM:
28
- `let winSso = new WinSso('NTLM', 'app.server.com', undefined);`
29
- 4. Client: Get authentication request token:
30
- `let authRequestToken = winSso.createAuthRequestHeader();`
31
- 5. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
32
- 6. Server: Respond with 401 where the `www-authenticate` header contains the server response token
33
- 7. Client: Get authentication response token:
34
- `let authResponseToken = winSso.createAuthResponseHeader(serverResponseToken);`
35
- 8. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
36
- 9. Authentication complete, the server responds to the actual request.
37
-
38
- The NTLM handshake always follows this pattern.
39
-
40
- ### Brief Negotiate example
41
-
42
- 1. Client: Send http request to server (with FQDN `app.server.com`)
43
- 2. Server: Respond with 401 where the `www-authenticate` header includes `Negotiate`
44
- 3. Client: Create WinSso instance for Negotiate:
45
- `let winSso = new WinSso('Negotiate', 'app.server.com', undefined);`
46
- 4. Client: Get authentication request token:
47
- `let authRequestToken = winSso.createAuthRequestHeader();`
48
- 5. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
49
- 6. Server: Respond with 401 where the `www-authenticate` header contains the server response token
50
- 7. Client: Validate the server response token:
51
- `let authResponseToken = winSso.createAuthResponseHeader(serverResponseToken);`
52
- 8. If the token returned from step 7 has length 0, the authentication is complete and the client may parse the response content. Otherwise, continue with step 9.
53
- 9. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
54
- 10. Server: Respond to the actual request where the `www-authenticate` header contains the server response token
55
- 11. Got to step 7
56
-
57
- The number of round trips for a Negotiate (Kerberos) handshake varies, so the number of cycles of step 8-11 could be 0, 1, 2 or more. Therefore step 7 must always be done even when the server does not responds with status code 401. This validates that authentication is indeed complete.
58
-
59
- To clarify, Negotiate actually means NTLM or Kerberos. In the past NTLM may have been more common in Negotiate scenarios, but currently Negotiate nearly always means Kerberos. The example above is for Kerberos.
60
-
61
- ### Utility methods
62
-
63
- #### osSupported(): boolean
64
-
65
- Utility method to simplify the case where an application supports multiple platforms, but single-sign-on is only supported on Windows OSs. Returns true if the platform is win32. If this returns false, all the methods below will throw.
66
-
67
- ### WinSso
68
-
69
- This class provides an interface to create and use an authentication context. Due to protocol details, one instance of this class should be created for each connection (socket) communicating with an endpoint where single-sign-on should be used. The class will free the resources it has allocated when it is destroyed, but it is still recommended to call the freeAuthContext() method when the instance will no longer be used.
70
-
71
- #### WinSso(securityPackage: string, targetHost: string | undefined, peerCert: PeerCertificate | undefined)
72
-
73
- Class constructor.
74
-
75
- * securityPackage: The name of the authentication method to use. Valid values are 'NTLM' and 'Negotiate'.
76
- * targetHost (optional): The FQDN of the target host. This is used to build a SPN string in the authentication message for enhanced security.
77
- * peerCert (optional): If the connection is http, pass undefined. If the connection is https, pass the peer certificate to add Channel Binding to the authentication message for enhanced security.
78
-
79
- #### WinSso.getUserName(): string
80
-
81
- Static method that returns the domain and username of the user executing the Node.js process, in the standard format `DOMAIN\username`. The credentials of this user will be used for single-sign-on.
82
-
83
- #### WinSso.createAuthRequest(): Buffer
84
-
85
- Returns the Authentication Request token as a buffer. For NTLM this is the NTLM type 1 message, for Negotiate this is the NegTokenInit message.
86
-
87
- #### WinSso.createAuthRequestHeader(): string
88
-
89
- Returns the Authentication Request header as a string. This is the token returned by WinSso.createAuthRequest() encoded as Base64, prefixed with the security package name. This is the expected format of the `Authorization` header in a http/https request to the target server to initiate the NTLM/Negotiate handshake.
90
-
91
- #### WinSso.createAuthResponse(inTokenHeader: string): Buffer
92
-
93
- Returns the Authentication Response token as a buffer. For NTLM this is the NTLM type 3 message, for Negotiate this is the NegTokenResp message. May be an empty Buffer if Negotiate handshake is complete.
94
-
95
- * inTokenHeader: The content of the 'www-authenticate' header in the response to the Authentication Request.
96
-
97
- This method throws if the response could not be created. One such scenario is if the server requires NTLMv1, and the client settings does not permit NTLMv1.
98
-
99
- #### WinSso.createAuthResponseHeader(inTokenHeader: string): string
100
-
101
- Returns the Authentication Response header as a string. This is the token returned by WinSso.createAuthResponse() encoded as Base64, prefixed with the security package name. This is the expected format of the `Authorization` header in a http/https request to the target server to finalize the NTLM/Negotiate handshake. May be an empty string if Negotiate handshake is complete.
102
-
103
- * inTokenHeader: The content of the 'www-authenticate' header in the response to the Authentication Request.
104
-
105
- This method throws if the response could not be created. One such scenario is if the server requires NTLMv1, and the client settings does not permit NTLMv1.
106
-
107
- #### WinSso.freeAuthContext()
108
-
109
- Releases all allocated resources for the authorization context. Resources are also released when the instance is destroyed, but it is still recommended to call this method when the context is no longer required, such as when an error ocurred or when the socket was closed.
110
-
111
- ### Credits
112
-
113
- The idea of implementation is based on the work of @snowytoxa, who presented the concept of retrieving NTLM tokens for the current user without any admin privileges in 2014. The source for his project [selfhash](https://github.com/snowytoxa/selfhash/) shortened the development time significantly.
1
+ # node-win-sso
2
+
3
+ NTLM and Negotiate single-sign-on for Node.js
4
+
5
+ ## Introduction
6
+
7
+ When using web applications through popular browsers on Windows OS, the user can be logged in automatically to trusted sites that support Windows Authentication. This module allows Node.js applications to deliver a similar single-sign-on user experience, by utilizing native Win32 API calls.
8
+
9
+ ## Installation
10
+
11
+ Only Windows OSs are supported. The module can be installed on any Node.js platform, but the native module won't be built.
12
+
13
+ ```shell
14
+ npm install win-sso
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ Usage of this module requires some knowledge of the NTLM or Negotiate handshake process. There are multiple sources for this on the web, a starting point for NTLM could be:
20
+
21
+ * https://www.innovation.ch/personal/ronald/ntlm.html
22
+
23
+ ### Brief NTLM example
24
+
25
+ 1. Client: Send http request to server (with FQDN `app.server.com`)
26
+ 2. Server: Respond with 401 where the `www-authenticate` header includes NTLM
27
+ 3. Client: Create WinSso instance for NTLM:
28
+ `let winSso = new WinSso('NTLM', 'app.server.com', undefined);`
29
+ 4. Client: Get authentication request token:
30
+ `let authRequestToken = winSso.createAuthRequestHeader();`
31
+ 5. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
32
+ 6. Server: Respond with 401 where the `www-authenticate` header contains the server response token
33
+ 7. Client: Get authentication response token:
34
+ `let authResponseToken = winSso.createAuthResponseHeader(serverResponseToken);`
35
+ 8. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
36
+ 9. Authentication complete, the server responds to the actual request.
37
+
38
+ The NTLM handshake always follows this pattern.
39
+
40
+ ### Brief Negotiate example
41
+
42
+ 1. Client: Send http request to server (with FQDN `app.server.com`)
43
+ 2. Server: Respond with 401 where the `www-authenticate` header includes `Negotiate`
44
+ 3. Client: Create WinSso instance for Negotiate:
45
+ `let winSso = new WinSso('Negotiate', 'app.server.com', undefined);`
46
+ 4. Client: Get authentication request token:
47
+ `let authRequestToken = winSso.createAuthRequestHeader();`
48
+ 5. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
49
+ 6. Server: Respond with 401 where the `www-authenticate` header contains the server response token
50
+ 7. Client: Validate the server response token:
51
+ `let authResponseToken = winSso.createAuthResponseHeader(serverResponseToken);`
52
+ 8. If the token returned from step 7 has length 0, the authentication is complete and the client may parse the response content. Otherwise, continue with step 9.
53
+ 9. Client: Resend the http request to the server, setting the `authorization` header to the value of the token
54
+ 10. Server: Respond to the actual request where the `www-authenticate` header contains the server response token
55
+ 11. Got to step 7
56
+
57
+ The number of round trips for a Negotiate (Kerberos) handshake varies, so the number of cycles of step 8-11 could be 0, 1, 2 or more. Therefore step 7 must always be done even when the server does not responds with status code 401. This validates that authentication is indeed complete.
58
+
59
+ To clarify, Negotiate actually means NTLM or Kerberos. In the past NTLM may have been more common in Negotiate scenarios, but currently Negotiate nearly always means Kerberos. The example above is for Kerberos.
60
+
61
+ ### Utility methods
62
+
63
+ #### osSupported(): boolean
64
+
65
+ Utility method to simplify the case where an application supports multiple platforms, but single-sign-on is only supported on Windows OSs. Returns true if the platform is win32. If this returns false, all the methods below will throw.
66
+
67
+ ### WinSso
68
+
69
+ This class provides an interface to create and use an authentication context. Due to protocol details, one instance of this class should be created for each connection (socket) communicating with an endpoint where single-sign-on should be used. The class will free the resources it has allocated when it is destroyed, but it is still recommended to call the freeAuthContext() method when the instance will no longer be used.
70
+
71
+ #### WinSso(securityPackage: string, targetHost: string | undefined, peerCert: PeerCertificate | undefined)
72
+
73
+ Class constructor.
74
+
75
+ * securityPackage: The name of the authentication method to use. Valid values are 'NTLM' and 'Negotiate'.
76
+ * targetHost (optional): The FQDN of the target host. This is used to build a SPN string in the authentication message for enhanced security.
77
+ * peerCert (optional): If the connection is http, pass undefined. If the connection is https, pass the peer certificate to add Channel Binding to the authentication message for enhanced security.
78
+
79
+ #### WinSso.getUserName(): string
80
+
81
+ Static method that returns the domain and username of the user executing the Node.js process, in the standard format `DOMAIN\username`. The credentials of this user will be used for single-sign-on.
82
+
83
+ #### WinSso.createAuthRequest(): Buffer
84
+
85
+ Returns the Authentication Request token as a buffer. For NTLM this is the NTLM type 1 message, for Negotiate this is the NegTokenInit message.
86
+
87
+ #### WinSso.createAuthRequestHeader(): string
88
+
89
+ Returns the Authentication Request header as a string. This is the token returned by WinSso.createAuthRequest() encoded as Base64, prefixed with the security package name. This is the expected format of the `Authorization` header in a http/https request to the target server to initiate the NTLM/Negotiate handshake.
90
+
91
+ #### WinSso.createAuthResponse(inTokenHeader: string): Buffer
92
+
93
+ Returns the Authentication Response token as a buffer. For NTLM this is the NTLM type 3 message, for Negotiate this is the NegTokenResp message. May be an empty Buffer if Negotiate handshake is complete.
94
+
95
+ * inTokenHeader: The content of the 'www-authenticate' header in the response to the Authentication Request.
96
+
97
+ This method throws if the response could not be created. One such scenario is if the server requires NTLMv1, and the client settings does not permit NTLMv1.
98
+
99
+ #### WinSso.createAuthResponseHeader(inTokenHeader: string): string
100
+
101
+ Returns the Authentication Response header as a string. This is the token returned by WinSso.createAuthResponse() encoded as Base64, prefixed with the security package name. This is the expected format of the `Authorization` header in a http/https request to the target server to finalize the NTLM/Negotiate handshake. May be an empty string if Negotiate handshake is complete.
102
+
103
+ * inTokenHeader: The content of the 'www-authenticate' header in the response to the Authentication Request.
104
+
105
+ This method throws if the response could not be created. One such scenario is if the server requires NTLMv1, and the client settings does not permit NTLMv1.
106
+
107
+ #### WinSso.freeAuthContext()
108
+
109
+ Releases all allocated resources for the authorization context. Resources are also released when the instance is destroyed, but it is still recommended to call this method when the context is no longer required, such as when an error ocurred or when the socket was closed.
110
+
111
+ ### Credits
112
+
113
+ The idea of implementation is based on the work of @snowytoxa, who presented the concept of retrieving NTLM tokens for the current user without any admin privileges in 2014. The source for his project [selfhash](https://github.com/snowytoxa/selfhash/) shortened the development time significantly.
package/binding.gyp CHANGED
@@ -1,20 +1,24 @@
1
- {
2
- "targets": [
3
- {
4
- "target_name": "win-sso",
5
- "cflags!": [ "-fno-exceptions" ],
6
- "cflags_cc!": [ "-fno-exceptions" ],
7
- "sources": [ "src/node-addon/*.cc" ],
8
- "libraries": [
9
- "-lsecur32"
10
- ],
11
- "include_dirs": [
12
- "<!@(node -p \"require('node-addon-api').include\")"
13
- ],
14
- 'dependencies': [
15
- "<!(node -p \"require('node-addon-api').gyp\")"
16
- ],
17
- 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
18
- }
19
- ]
20
- }
1
+ {
2
+ "targets": [
3
+ {
4
+ "target_name": "win-sso",
5
+ "cflags!": [ "-fno-exceptions" ],
6
+ "cflags_cc!": [ "-fno-exceptions" ],
7
+ "sources": [
8
+ "src/node-addon/auth-context.cc",
9
+ "src/node-addon/exception-handler.cc",
10
+ "src/node-addon/secur32-facade.cc"
11
+ ],
12
+ "libraries": [
13
+ "-lsecur32"
14
+ ],
15
+ "include_dirs": [
16
+ "<!@(node -p \"require('node-addon-api').include\")"
17
+ ],
18
+ 'dependencies': [
19
+ "<!(node -p \"require('node-addon-api').gyp\")"
20
+ ],
21
+ 'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
22
+ }
23
+ ]
24
+ }
package/install_env.js CHANGED
@@ -1,12 +1,12 @@
1
- const os = require('os');
2
- const spawn = require('cross-spawn');
3
-
4
- if (os.platform() === 'win32') {
5
- console.log('Windows OS detected. Building native module')
6
- spawn.sync('npm', ['run', 'native_build'], {
7
- input: 'Windows OS detected. Build native module.',
8
- stdio: 'inherit'
9
- });
10
- } else {
11
- console.log('Unsupported OS detected. Native module requires Windows OS. Aborting native module build.');
12
- }
1
+ const os = require('os');
2
+ const spawn = require('cross-spawn');
3
+
4
+ if (os.platform() === 'win32') {
5
+ console.log('Windows OS detected. Building native module')
6
+ spawn.sync('npm', ['run', 'native_build'], {
7
+ input: 'Windows OS detected. Build native module.',
8
+ stdio: 'inherit'
9
+ });
10
+ } else {
11
+ console.log('Unsupported OS detected. Native module requires Windows OS. Aborting native module build.');
12
+ }
package/package.json CHANGED
@@ -1,64 +1,61 @@
1
- {
2
- "name": "win-sso",
3
- "version": "1.0.1",
4
- "description": "NTLM single-sign-on for Node.js. Only Windows OS supported.",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "build": "shx rm -rf dist && tsc",
8
- "prepare": "npm run build",
9
- "lint": "tslint --project .",
10
- "test": "mocha --require ./test/ts.hooks.js test/**/*.spec.ts",
11
- "prebuildify": "node prebuildify_env.js",
12
- "native_prebuildify": "prebuildify --napi --strip",
13
- "native_build": "node-gyp-build",
14
- "install": "node install_env.js"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/bjowes/node-win-sso.git"
19
- },
20
- "keywords": [
21
- "NTLM",
22
- "Windows Authentication",
23
- "Single sign on"
24
- ],
25
- "files": [
26
- "dist/",
27
- "install_env.js",
28
- "prebuildify_env.js",
29
- "binding.gyp",
30
- "src/",
31
- "prebuilds/"
32
- ],
33
- "author": "Björn Weström",
34
- "license": "MIT",
35
- "bugs": {
36
- "url": "https://github.com/bjowes/node-win-sso/issues"
37
- },
38
- "homepage": "https://github.com/bjowes/node-win-sso#readme",
39
- "dependencies": {
40
- "bindings": "*",
41
- "cross-spawn": "^7.0.1",
42
- "debug": "^4.1.1",
43
- "node-addon-api": "^2.0.0",
44
- "node-gyp": "^6.0.1",
45
- "node-gyp-build": "^4.2.0"
46
- },
47
- "devDependencies": {
48
- "@types/chai": "^4.2.7",
49
- "@types/debug": "^4.1.5",
50
- "@types/mocha": "^5.2.7",
51
- "@types/node": "^12.12.17",
52
- "asn1-parser": "^1.1.8",
53
- "chai": "^4.2.0",
54
- "mocha": "^6.2.2",
55
- "prebuildify": "^3.0.4",
56
- "shx": "^0.3.2",
57
- "ts-node": "^8.5.4",
58
- "tslint": "^5.20.1",
59
- "tslint-eslint-rules": "^5.4.0",
60
- "typescript": "^3.7.3",
61
- "vrsource-tslint-rules": "^6.0.0"
62
- },
63
- "gypfile": true
64
- }
1
+ {
2
+ "name": "win-sso",
3
+ "version": "1.1.6",
4
+ "description": "NTLM single-sign-on for Node.js. Only Windows OS supported.",
5
+ "main": "dist/index.js",
6
+ "scripts": {
7
+ "build": "shx rm -rf dist && tsc",
8
+ "lint": "tslint --project .",
9
+ "test": "mocha --require ./test/ts.hooks.js test/**/*.spec.ts",
10
+ "prebuildify": "node prebuildify_env.js",
11
+ "native_prebuildify": "prebuildify --napi --strip",
12
+ "native_build": "node-gyp-build",
13
+ "install": "node install_env.js"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/bjowes/node-win-sso.git"
18
+ },
19
+ "keywords": [
20
+ "NTLM",
21
+ "Windows Authentication",
22
+ "Single sign on"
23
+ ],
24
+ "files": [
25
+ "dist/",
26
+ "install_env.js",
27
+ "prebuildify_env.js",
28
+ "binding.gyp",
29
+ "src/",
30
+ "prebuilds/"
31
+ ],
32
+ "author": "Björn Weström",
33
+ "license": "MIT",
34
+ "bugs": {
35
+ "url": "https://github.com/bjowes/node-win-sso/issues"
36
+ },
37
+ "homepage": "https://github.com/bjowes/node-win-sso#readme",
38
+ "dependencies": {
39
+ "bindings": "*",
40
+ "cross-spawn": "^7.0.3",
41
+ "debug": "^4.3.1",
42
+ "node-addon-api": "^4.3.0",
43
+ "node-gyp": "^8.4.1",
44
+ "node-gyp-build": "4.3"
45
+ },
46
+ "devDependencies": {
47
+ "@types/debug": "^4.1.7",
48
+ "@types/mocha": "^9.1.0",
49
+ "@types/node": "^16.11.22",
50
+ "asn1-parser": "^1.1.8",
51
+ "mocha": "^9.2.0",
52
+ "prebuildify": "^5.0.0",
53
+ "shx": "^0.3.4",
54
+ "ts-node": "^10.5.0",
55
+ "tslint": "^6.1.3",
56
+ "tslint-eslint-rules": "^5.4.0",
57
+ "typescript": "4.5",
58
+ "vrsource-tslint-rules": "^6.0.0"
59
+ },
60
+ "gypfile": true
61
+ }
@@ -1,12 +1,12 @@
1
- const os = require('os');
2
- const spawn = require('cross-spawn');
3
-
4
- if (os.platform() === 'win32') {
5
- console.log('Windows OS detected. Prebuilding native modules')
6
- spawn.sync('npm', ['run', 'native_prebuildify'], {
7
- input: 'Windows OS detected. Prebuilding native module.',
8
- stdio: 'inherit'
9
- });
10
- } else {
11
- console.log('Unsupported OS detected. Native module requires Windows OS. Aborting prebuildify.');
12
- }
1
+ const os = require('os');
2
+ const spawn = require('cross-spawn');
3
+
4
+ if (os.platform() === 'win32') {
5
+ console.log('Windows OS detected. Prebuilding native modules')
6
+ spawn.sync('npm', ['run', 'native_prebuildify'], {
7
+ input: 'Windows OS detected. Prebuilding native module.',
8
+ stdio: 'inherit'
9
+ });
10
+ } else {
11
+ console.log('Unsupported OS detected. Native module requires Windows OS. Aborting prebuildify.');
12
+ }
Binary file
Binary file
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WinSso } from './win-sso';
2
- import { osSupported } from './os-supported';
3
-
4
- export { WinSso, osSupported };
1
+ import { WinSso } from './win-sso';
2
+ import { osSupported } from './os-supported';
3
+
4
+ export { WinSso, osSupported };