@equinor/fusion-framework-module-msal 6.0.0 → 6.0.1
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 +8 -0
- package/dist/esm/v2/create-proxy-provider.js +17 -6
- package/dist/esm/v2/create-proxy-provider.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/v2/create-proxy-provider.ts +19 -6
- package/src/version.ts +1 -1
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.
|
|
1
|
+
export declare const version = "6.0.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-module-msal",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "Microsoft Authentication Library (MSAL) integration module for Fusion Framework",
|
|
5
5
|
"main": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"typescript": "^5.8.2",
|
|
45
45
|
"zod": "^4.1.8",
|
|
46
46
|
"@equinor/fusion-framework-module": "^5.0.5",
|
|
47
|
-
"@equinor/fusion-framework-module-telemetry": "^4.
|
|
47
|
+
"@equinor/fusion-framework-module-telemetry": "^4.6.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
50
|
"@types/semver": "^7.5.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"typescript": "^5.8.2",
|
|
53
53
|
"zod": "^4.1.8",
|
|
54
54
|
"@equinor/fusion-framework-module": "^5.0.5",
|
|
55
|
-
"@equinor/fusion-framework-module-telemetry": "^4.
|
|
55
|
+
"@equinor/fusion-framework-module-telemetry": "^4.6.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@equinor/fusion-framework-module-telemetry": {
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import type { IMsalProvider } from '../MsalProvider.interface';
|
|
2
2
|
import type { IMsalProvider as IMsalProvider_v2 } from './MsalProvider.interface';
|
|
3
3
|
import type { AccountInfo as AccountInfo_v2 } from './types';
|
|
4
|
+
import type { AcquireTokenOptions } from '../MsalClient.interface';
|
|
4
5
|
import { createProxyClient } from './create-proxy-client';
|
|
5
6
|
import { mapAccountInfo } from './map-account-info';
|
|
6
7
|
import { MsalModuleVersion } from '../static';
|
|
7
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Checks if a request is in MSAL v4 format.
|
|
11
|
+
*
|
|
12
|
+
* @param req - The request object to check
|
|
13
|
+
* @returns True if the request is in v4 format (has a `request` property with `scopes` and `account`)
|
|
14
|
+
*/
|
|
15
|
+
function isRequestV4(req: unknown): req is AcquireTokenOptions {
|
|
16
|
+
if (typeof req !== 'object' || req === null) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const requestV4 = req as AcquireTokenOptions;
|
|
20
|
+
return 'request' in requestV4;
|
|
21
|
+
}
|
|
22
|
+
|
|
8
23
|
/**
|
|
9
24
|
* Creates a proxy provider for MSAL v2 compatibility.
|
|
10
25
|
*
|
|
@@ -74,9 +89,8 @@ export function createProxyProvider(provider: IMsalProvider): IMsalProvider_v2 {
|
|
|
74
89
|
scopes: string[];
|
|
75
90
|
account?: AccountInfo_v2;
|
|
76
91
|
}) => {
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
});
|
|
92
|
+
const request = isRequestV4(req) ? req : { scopes: req.scopes, account: req.account };
|
|
93
|
+
const result = await target.acquireToken(request as AcquireTokenOptions);
|
|
80
94
|
|
|
81
95
|
// Convert null to undefined for v2 compatibility
|
|
82
96
|
return result || undefined;
|
|
@@ -89,9 +103,8 @@ export function createProxyProvider(provider: IMsalProvider): IMsalProvider_v2 {
|
|
|
89
103
|
scopes: string[];
|
|
90
104
|
account?: AccountInfo_v2;
|
|
91
105
|
}) => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
106
|
+
const request = isRequestV4(req) ? req : { scopes: req.scopes, account: req.account };
|
|
107
|
+
return await target.acquireAccessToken(request as AcquireTokenOptions);
|
|
95
108
|
};
|
|
96
109
|
return acquireAccessToken;
|
|
97
110
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '6.0.
|
|
2
|
+
export const version = '6.0.1';
|