@equinor/fusion-framework-module-msal-node 1.0.1 → 1.0.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/CHANGELOG.md +30 -0
- package/README.md +168 -69
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/libsecret.md +136 -0
- package/package.json +1 -1
- package/src/version.ts +1 -1
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0.
|
|
1
|
+
export declare const version = "1.0.2";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
This CLI enables secure authentication and persistent token caching by storing credentials in your system's keychain. It uses [`@azure/msal-node`](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node) for authentication, which relies on the [`keytar`](https://github.com/atom/node-keytar) module for secure credential storage.
|
|
2
|
+
|
|
3
|
+
> **What is `libsecret`?**
|
|
4
|
+
> [`libsecret`](https://wiki.gnome.org/Projects/Libsecret) is a library for storing and retrieving passwords and secrets. On Linux, `keytar` depends on `libsecret` to access the system keyring.
|
|
5
|
+
|
|
6
|
+
> **Common Issue: `Cannot find module '../build/Release/keytar.node'`**
|
|
7
|
+
> This error occurs when the `keytar` native module isn't properly built or installed. It can happen on any platform (Windows, macOS, Linux) and usually indicates missing build tools or failed native compilation.
|
|
8
|
+
|
|
9
|
+
## Platform Requirements
|
|
10
|
+
|
|
11
|
+
- **Windows:** No additional dependencies. `keytar` uses the Windows Credential Manager.
|
|
12
|
+
- **macOS:** No additional dependencies. `keytar` uses the macOS Keychain. If you encounter unusual issues (rare), you can optionally try installing `libsecret`:
|
|
13
|
+
```bash
|
|
14
|
+
brew install libsecret
|
|
15
|
+
```
|
|
16
|
+
- **Linux:** You must install `libsecret` for secure credential storage. See below for instructions.
|
|
17
|
+
|
|
18
|
+
## Windows Installation
|
|
19
|
+
|
|
20
|
+
While Windows doesn't require `libsecret`, you may encounter `keytar` native module issues. Ensure you have the necessary build tools:
|
|
21
|
+
|
|
22
|
+
### Prerequisites
|
|
23
|
+
- **Visual Studio Build Tools** or **Visual Studio Community** with C++ workload
|
|
24
|
+
- **Python** (for node-gyp)
|
|
25
|
+
- **Node.js** with npm/yarn
|
|
26
|
+
|
|
27
|
+
### Installation Steps
|
|
28
|
+
1. Install Visual Studio Build Tools:
|
|
29
|
+
- Download from [Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/)
|
|
30
|
+
- Select "C++ build tools" workload
|
|
31
|
+
- Or install via command line:
|
|
32
|
+
```bash
|
|
33
|
+
# Using winget
|
|
34
|
+
winget install Microsoft.VisualStudio.2022.BuildTools
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
2. Install Python (if not already installed):
|
|
38
|
+
```bash
|
|
39
|
+
# Using winget
|
|
40
|
+
winget install Python.Python.3.11
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
3. Rebuild keytar:
|
|
44
|
+
```bash
|
|
45
|
+
npm rebuild keytar
|
|
46
|
+
# or
|
|
47
|
+
yarn rebuild keytar
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Linux Installation
|
|
51
|
+
Install the `libsecret` library based on your distribution:
|
|
52
|
+
|
|
53
|
+
- **Ubuntu/Debian**:
|
|
54
|
+
```bash
|
|
55
|
+
sudo apt-get update
|
|
56
|
+
sudo apt-get install -y libsecret-1-0 libsecret-1-dev
|
|
57
|
+
```
|
|
58
|
+
> Both runtime and development packages are required for building native modules.
|
|
59
|
+
- **Fedora**:
|
|
60
|
+
```bash
|
|
61
|
+
sudo dnf install -y libsecret libsecret-devel
|
|
62
|
+
```
|
|
63
|
+
> Install both runtime and development packages if you plan to build native modules.
|
|
64
|
+
- **Arch Linux**:
|
|
65
|
+
```bash
|
|
66
|
+
sudo pacman -S --noconfirm libsecret
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Verifying Installation
|
|
70
|
+
After installing `libsecret`, rebuild `keytar` to ensure it links correctly:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm rebuild keytar
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
You can verify that `keytar` is working by running your CLI and checking for credential storage warnings. Alternatively, you can test with a simple script:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
const keytar = require('keytar');
|
|
80
|
+
keytar.setPassword('test-service', 'test-account', 'test-password')
|
|
81
|
+
.then(() => keytar.getPassword('test-service', 'test-account'))
|
|
82
|
+
.then(console.log)
|
|
83
|
+
.catch(console.error);
|
|
84
|
+
```
|
|
85
|
+
If you see errors related to `keytar` or `libsecret`, see troubleshooting below.
|
|
86
|
+
|
|
87
|
+
## Troubleshooting
|
|
88
|
+
|
|
89
|
+
### Common Issues
|
|
90
|
+
|
|
91
|
+
#### `Cannot find module '../build/Release/keytar.node'`
|
|
92
|
+
This error occurs on all platforms when the `keytar` native module isn't properly built.
|
|
93
|
+
|
|
94
|
+
**Windows:**
|
|
95
|
+
- Ensure Visual Studio Build Tools are installed with C++ workload
|
|
96
|
+
- Install Python for node-gyp
|
|
97
|
+
- Rebuild keytar: `npm rebuild keytar` or `yarn rebuild keytar`
|
|
98
|
+
|
|
99
|
+
**macOS:**
|
|
100
|
+
- Ensure Xcode Command Line Tools are installed: `xcode-select --install`
|
|
101
|
+
- Rebuild keytar: `npm rebuild keytar`
|
|
102
|
+
|
|
103
|
+
**Linux:**
|
|
104
|
+
- Install libsecret development packages (see Linux Installation section)
|
|
105
|
+
- Rebuild keytar: `npm rebuild keytar`
|
|
106
|
+
|
|
107
|
+
#### Missing `libsecret` errors (Linux only)
|
|
108
|
+
- Ensure you have installed both the runtime and development packages (e.g., `libsecret-1-0` and `libsecret-1-dev` on Ubuntu/Debian).
|
|
109
|
+
|
|
110
|
+
#### General Solutions
|
|
111
|
+
- **Rebuild keytar:**
|
|
112
|
+
```bash
|
|
113
|
+
npm rebuild keytar
|
|
114
|
+
# or
|
|
115
|
+
yarn rebuild keytar
|
|
116
|
+
```
|
|
117
|
+
- **Clean install:**
|
|
118
|
+
```bash
|
|
119
|
+
rm -rf node_modules package-lock.json
|
|
120
|
+
npm install
|
|
121
|
+
# or
|
|
122
|
+
rm -rf node_modules yarn.lock
|
|
123
|
+
yarn install
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Still having issues?
|
|
127
|
+
- **Windows:** Check that Visual Studio Build Tools are properly installed and Python is in your PATH
|
|
128
|
+
- **macOS:** Verify Xcode Command Line Tools are installed and up to date
|
|
129
|
+
- **Linux:** Ensure your system keyring (e.g., GNOME Keyring or KWallet) is running and unlocked. On some headless or minimal Linux environments, you may need to start or configure the keyring daemon manually.
|
|
130
|
+
- See the [`keytar` troubleshooting guide](https://github.com/atom/node-keytar#troubleshooting).
|
|
131
|
+
- Consult your distribution's documentation for keyring setup.
|
|
132
|
+
|
|
133
|
+
## Resources
|
|
134
|
+
- [`keytar` documentation](https://github.com/atom/node-keytar)
|
|
135
|
+
- [`libsecret` project page](https://wiki.gnome.org/Projects/Libsecret)
|
|
136
|
+
- [@azure/msal-node](https://github.com/AzureAD/microsoft-authentication-library-for-js/tree/dev/lib/msal-node)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-module-msal-node",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Fusion Framework module for secure Azure AD authentication in Node.js using MSAL. Supports interactive, silent, and token-only authentication modes with encrypted token storage.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '1.0.
|
|
2
|
+
export const version = '1.0.2';
|