@equinor/fusion-framework-module-msal-node 3.0.2-next.0 → 4.0.0

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.
@@ -14,11 +14,50 @@ import type { AuthConfig } from './AuthConfigurator.interface.js';
14
14
  */
15
15
  export declare class AuthConfigurator extends BaseConfigBuilder<AuthConfig> {
16
16
  constructor();
17
+ /**
18
+ * Sets the authentication mode for the module.
19
+ *
20
+ * @param mode - The authentication mode: `'interactive'`, `'silent'`, or `'token_only'`.
21
+ */
17
22
  setMode(mode: AuthConfig['mode']): void;
23
+ /**
24
+ * Sets a pre-configured MSAL `PublicClientApplication` instance.
25
+ *
26
+ * Use this when you need full control over the MSAL client configuration.
27
+ * For most cases, prefer {@link AuthConfigurator.setClientConfig | setClientConfig}.
28
+ *
29
+ * @param client - The MSAL `PublicClientApplication` instance.
30
+ */
18
31
  setClient(client: AuthConfig['client']): void;
32
+ /**
33
+ * Configures the MSAL client using Azure AD tenant and client IDs.
34
+ *
35
+ * Lazily creates a `PublicClientApplication` with a secure persistence cache.
36
+ * The dynamic import avoids requiring `libsecret` in environments that do not need it.
37
+ *
38
+ * @param tenantId - Azure AD tenant (directory) ID.
39
+ * @param clientId - Azure AD application (client) ID.
40
+ */
19
41
  setClientConfig(tenantId: string, clientId: string): void;
42
+ /**
43
+ * Sets the port for the local HTTP callback server used in interactive mode.
44
+ *
45
+ * @param port - Port number for the local server.
46
+ */
20
47
  setServerPort(port: number): void;
48
+ /**
49
+ * Sets a callback invoked when the login URL is ready in interactive mode.
50
+ *
51
+ * Use this to display or log the authentication URL for the user.
52
+ *
53
+ * @param onOpen - Callback receiving the authentication URL, or `undefined` to disable.
54
+ */
21
55
  setServerOnOpen(onOpen: ((url: string) => void) | undefined): void;
56
+ /**
57
+ * Sets a pre-obtained access token for `token_only` mode.
58
+ *
59
+ * @param token - The static access token string.
60
+ */
22
61
  setAccessToken(token: string): void;
23
62
  /**
24
63
  * Prepares and finalizes the authentication configuration before validation and use.
@@ -1,3 +1,24 @@
1
+ /**
2
+ * `@equinor/fusion-framework-module-msal-node` provides Azure AD authentication
3
+ * for Node.js applications using Microsoft's MSAL library.
4
+ *
5
+ * Supports three authentication modes:
6
+ * - **interactive** — browser-based login with a local callback server (CLI tools, development)
7
+ * - **silent** — cached credential reuse without user interaction (background services)
8
+ * - **token_only** — static pre-obtained token passthrough (CI/CD, automation)
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { enableAuthModule } from '@equinor/fusion-framework-module-msal-node';
13
+ *
14
+ * enableAuthModule(configurator, (builder) => {
15
+ * builder.setMode('interactive');
16
+ * builder.setClientConfig('your-tenant-id', 'your-client-id');
17
+ * });
18
+ * ```
19
+ *
20
+ * @packageDocumentation
21
+ */
1
22
  export { AuthProvider } from './AuthProvider.js';
2
23
  export type { IAuthProvider } from './AuthProvider.interface.js';
3
24
  export type { IAuthConfigurator, AuthConfig } from './AuthConfigurator.interface.js';
@@ -1 +1 @@
1
- export declare const version = "3.0.2-next.0";
1
+ export declare const version = "4.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/fusion-framework-module-msal-node",
3
- "version": "3.0.2-next.0",
3
+ "version": "4.0.0",
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",
@@ -36,10 +36,10 @@
36
36
  "@azure/msal-node": "^5.0.2",
37
37
  "@azure/msal-node-extensions": "^5.0.2",
38
38
  "open": "^11.0.0",
39
- "@equinor/fusion-framework-module": "^5.0.7-next.0"
39
+ "@equinor/fusion-framework-module": "^6.0.0"
40
40
  },
41
41
  "devDependencies": {
42
- "typescript": "^5.8.2"
42
+ "typescript": "^5.9.3"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsc -b"
@@ -26,14 +26,36 @@ export class AuthConfigurator extends BaseConfigBuilder<AuthConfig> {
26
26
  this.setMode('interactive');
27
27
  }
28
28
 
29
+ /**
30
+ * Sets the authentication mode for the module.
31
+ *
32
+ * @param mode - The authentication mode: `'interactive'`, `'silent'`, or `'token_only'`.
33
+ */
29
34
  setMode(mode: AuthConfig['mode']) {
30
35
  this._set('mode', mode);
31
36
  }
32
37
 
38
+ /**
39
+ * Sets a pre-configured MSAL `PublicClientApplication` instance.
40
+ *
41
+ * Use this when you need full control over the MSAL client configuration.
42
+ * For most cases, prefer {@link AuthConfigurator.setClientConfig | setClientConfig}.
43
+ *
44
+ * @param client - The MSAL `PublicClientApplication` instance.
45
+ */
33
46
  setClient(client: AuthConfig['client']) {
34
47
  this._set('client', client);
35
48
  }
36
49
 
50
+ /**
51
+ * Configures the MSAL client using Azure AD tenant and client IDs.
52
+ *
53
+ * Lazily creates a `PublicClientApplication` with a secure persistence cache.
54
+ * The dynamic import avoids requiring `libsecret` in environments that do not need it.
55
+ *
56
+ * @param tenantId - Azure AD tenant (directory) ID.
57
+ * @param clientId - Azure AD application (client) ID.
58
+ */
37
59
  setClientConfig(tenantId: string, clientId: string): void {
38
60
  this._set('client', async () => {
39
61
  // Dynamically import the createAuthClient function since the client uses `libsecret``
@@ -44,14 +66,31 @@ export class AuthConfigurator extends BaseConfigBuilder<AuthConfig> {
44
66
  });
45
67
  }
46
68
 
69
+ /**
70
+ * Sets the port for the local HTTP callback server used in interactive mode.
71
+ *
72
+ * @param port - Port number for the local server.
73
+ */
47
74
  setServerPort(port: number) {
48
75
  this._set('server.port', port);
49
76
  }
50
77
 
78
+ /**
79
+ * Sets a callback invoked when the login URL is ready in interactive mode.
80
+ *
81
+ * Use this to display or log the authentication URL for the user.
82
+ *
83
+ * @param onOpen - Callback receiving the authentication URL, or `undefined` to disable.
84
+ */
51
85
  setServerOnOpen(onOpen: ((url: string) => void) | undefined) {
52
86
  this._set('server.onOpen', onOpen);
53
87
  }
54
88
 
89
+ /**
90
+ * Sets a pre-obtained access token for `token_only` mode.
91
+ *
92
+ * @param token - The static access token string.
93
+ */
55
94
  setAccessToken(token: string) {
56
95
  this._set('accessToken', token);
57
96
  }
package/src/index.ts CHANGED
@@ -1,3 +1,25 @@
1
+ /**
2
+ * `@equinor/fusion-framework-module-msal-node` provides Azure AD authentication
3
+ * for Node.js applications using Microsoft's MSAL library.
4
+ *
5
+ * Supports three authentication modes:
6
+ * - **interactive** — browser-based login with a local callback server (CLI tools, development)
7
+ * - **silent** — cached credential reuse without user interaction (background services)
8
+ * - **token_only** — static pre-obtained token passthrough (CI/CD, automation)
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { enableAuthModule } from '@equinor/fusion-framework-module-msal-node';
13
+ *
14
+ * enableAuthModule(configurator, (builder) => {
15
+ * builder.setMode('interactive');
16
+ * builder.setClientConfig('your-tenant-id', 'your-client-id');
17
+ * });
18
+ * ```
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+
1
23
  export { AuthProvider } from './AuthProvider.js';
2
24
 
3
25
  export type { IAuthProvider } from './AuthProvider.interface.js';
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- export const version = '3.0.2-next.0';
2
+ export const version = '4.0.0';