Skip to content

Commit bb22556

Browse files
committed
Merge branch 'msal-v5' of https://github.com/AzureAD/microsoft-authentication-library-for-js into avdunn/node-test-refactor
2 parents 406ebb2 + 0f4a5fc commit bb22556

47 files changed

Lines changed: 6914 additions & 5918 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Update dev dependencies [#8335](https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/8335)",
4+
"packageName": "@azure/msal-angular",
5+
"email": "joarroyo@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Add silentRefreshReason telemetry field to PerformanceEvent #8336",
4+
"packageName": "@azure/msal-browser",
5+
"email": "kshabelko@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "minor",
3+
"comment": "Add silentRefreshReason telemetry field to PerformanceEvent #8336",
4+
"packageName": "@azure/msal-common",
5+
"email": "kshabelko@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "Add interrupted_user to InteractionRequired Error list (#8322)",
4+
"packageName": "@azure/msal-common",
5+
"email": "hemoral@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

docs/errors.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ This error occurs when MSAL.js surpasses the allotted storage limit when attempt
302302

303303
- `canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve.
304304

305+
306+
### `interrupted_user`
307+
308+
- The user could not be authenticated due to an interrupted state. Please invoke an interactive API to resolve.
309+
305310
## JOSE header errors
306311

307312
### `missing_kid_error`

extensions/samples/electron-webpack/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"@vercel/webpack-asset-relocator-loader": "^1.7.3",
3939
"autoprefixer": "^10.4.13",
4040
"css-loader": "^6.7.1",
41-
"electron": "22.3.25",
41+
"electron": "^36.9.5",
4242
"eslint": "^8.27.0",
4343
"eslint-plugin-import": "^2.26.0",
4444
"fork-ts-checker-webpack-plugin": "^7.2.13",
@@ -58,4 +58,4 @@
5858
"bootstrap": "^5.0.0",
5959
"electron-squirrel-startup": "^1.0.0"
6060
}
61-
}
61+
}

lib/msal-angular/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ At a minimum, `@azure/msal-angular` will follow the [support schedule of the mai
4747

4848
| MSAL Angular version | MSAL support status | Supported Angular versions |
4949
| -------------------- | ------------------- | -------------------------- |
50-
| MSAL Angular v5 | Active development | 19, 20 |
50+
| MSAL Angular v5 | Active development | 19, 20, 21 |
5151
| MSAL Angular v4 | In maintenance | 15, 16, 17, 18, 19, 20 |
5252
| MSAL Angular v3 | In maintenance | 15, 16, 17, 18 |
5353
| MSAL Angular v2 | In maintenance | 9, 10, 11, 12, 13, 14 |

lib/msal-angular/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@
3838
]
3939
},
4040
"devDependencies": {
41-
"@angular-devkit/build-angular": "^19.2.3",
42-
"@angular/animations": "^19.2.2",
43-
"@angular/cli": "^19.2.3",
44-
"@angular/common": "^19.2.2",
45-
"@angular/compiler": "^19.2.2",
46-
"@angular/compiler-cli": "^19.2.2",
47-
"@angular/core": "^19.2.2",
48-
"@angular/forms": "^19.2.2",
49-
"@angular/platform-browser": "^19.2.2",
50-
"@angular/platform-browser-dynamic": "^19.2.2",
51-
"@angular/router": "^19.2.2",
41+
"@angular-devkit/build-angular": "^19.2.18",
42+
"@angular/animations": "^19.2.18",
43+
"@angular/cli": "^19.2.18",
44+
"@angular/common": "^19.2.18",
45+
"@angular/compiler": "^19.2.18",
46+
"@angular/compiler-cli": "^19.2.18",
47+
"@angular/core": "^19.2.18",
48+
"@angular/forms": "^19.2.18",
49+
"@angular/platform-browser": "^19.2.18",
50+
"@angular/platform-browser-dynamic": "^19.2.18",
51+
"@angular/router": "^19.2.18",
5252
"@azure/msal-browser": "^5.2.0",
5353
"@types/jasmine": "~3.6.0",
5454
"@types/jasminewd2": "~2.0.3",
@@ -73,4 +73,4 @@
7373
"@azure/msal-browser": "^5.2.0",
7474
"rxjs": "^7.0.0"
7575
}
76-
}
76+
}

lib/msal-browser/src/controllers/StandardController.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,15 @@ export class StandardController implements IController {
20442044
);
20452045

20462046
if (shouldTryToResolveSilently) {
2047+
const silentRefreshReason = `${refreshTokenError.errorCode}${
2048+
refreshTokenError.subError
2049+
? `|${refreshTokenError.subError}`
2050+
: ""
2051+
}`;
2052+
this.performanceClient.addFields(
2053+
{ silentRefreshReason },
2054+
request.correlationId
2055+
);
20472056
if (!this.activeIframeRequest) {
20482057
let _resolve: (result: boolean) => void;
20492058
// Always set the active request tracker immediately after checking it to prevent races

lib/msal-browser/test/app/PublicClientApplication.spec.ts

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5817,6 +5817,144 @@ describe("PublicClientApplication.ts Class Unit Tests", () => {
58175817
expect(silentRefreshSpy).toHaveBeenCalledTimes(0);
58185818
expect(silentIframeSpy).toHaveBeenCalledTimes(1);
58195819
});
5820+
5821+
describe("silentRefreshReason telemetry", () => {
5822+
it("adds silentRefreshReason telemetry field with errorCode when refresh token error triggers iframe fallback", (done) => {
5823+
jest.spyOn(
5824+
SilentCacheClient.prototype,
5825+
"acquireToken"
5826+
).mockRejectedValue(refreshRequiredCacheError);
5827+
jest.spyOn(
5828+
SilentRefreshClient.prototype,
5829+
"acquireToken"
5830+
).mockRejectedValue(refreshRequiredServerError);
5831+
jest.spyOn(
5832+
SilentIframeClient.prototype,
5833+
"acquireToken"
5834+
).mockResolvedValue(testTokenResponse);
5835+
5836+
const callbackId = pca.addPerformanceCallback((events) => {
5837+
expect(events[0].silentRefreshReason).toBe(
5838+
BrowserConstants.INVALID_GRANT_ERROR
5839+
);
5840+
pca.removePerformanceCallback(callbackId);
5841+
done();
5842+
});
5843+
5844+
pca.acquireTokenSilent({
5845+
scopes: ["openid"],
5846+
account: testAccount,
5847+
cacheLookupPolicy: CacheLookupPolicy.Default,
5848+
correlationId: RANDOM_TEST_GUID,
5849+
});
5850+
});
5851+
5852+
it("adds silentRefreshReason telemetry field with errorCode and subError when subError is present", (done) => {
5853+
const errorWithSubError = new ServerError(
5854+
BrowserConstants.INVALID_GRANT_ERROR,
5855+
"Refresh Token expired",
5856+
"bad_token"
5857+
);
5858+
5859+
jest.spyOn(
5860+
SilentCacheClient.prototype,
5861+
"acquireToken"
5862+
).mockRejectedValue(refreshRequiredCacheError);
5863+
jest.spyOn(
5864+
SilentRefreshClient.prototype,
5865+
"acquireToken"
5866+
).mockRejectedValue(errorWithSubError);
5867+
jest.spyOn(
5868+
SilentIframeClient.prototype,
5869+
"acquireToken"
5870+
).mockResolvedValue(testTokenResponse);
5871+
5872+
const callbackId = pca.addPerformanceCallback((events) => {
5873+
expect(events[0].silentRefreshReason).toBe(
5874+
`${BrowserConstants.INVALID_GRANT_ERROR}|bad_token`
5875+
);
5876+
pca.removePerformanceCallback(callbackId);
5877+
done();
5878+
});
5879+
5880+
pca.acquireTokenSilent({
5881+
scopes: ["openid"],
5882+
account: testAccount,
5883+
cacheLookupPolicy: CacheLookupPolicy.Default,
5884+
correlationId: RANDOM_TEST_GUID,
5885+
});
5886+
});
5887+
5888+
it("adds silentRefreshReason telemetry field with refreshTokenExpired error code", (done) => {
5889+
const refreshTokenExpiredError =
5890+
createInteractionRequiredAuthError(
5891+
InteractionRequiredAuthErrorCodes.refreshTokenExpired
5892+
);
5893+
5894+
jest.spyOn(
5895+
SilentCacheClient.prototype,
5896+
"acquireToken"
5897+
).mockRejectedValue(refreshRequiredCacheError);
5898+
jest.spyOn(
5899+
SilentRefreshClient.prototype,
5900+
"acquireToken"
5901+
).mockRejectedValue(refreshTokenExpiredError);
5902+
jest.spyOn(
5903+
SilentIframeClient.prototype,
5904+
"acquireToken"
5905+
).mockResolvedValue(testTokenResponse);
5906+
5907+
const callbackId = pca.addPerformanceCallback((events) => {
5908+
expect(events[0].silentRefreshReason).toBe(
5909+
InteractionRequiredAuthErrorCodes.refreshTokenExpired
5910+
);
5911+
pca.removePerformanceCallback(callbackId);
5912+
done();
5913+
});
5914+
5915+
pca.acquireTokenSilent({
5916+
scopes: ["openid"],
5917+
account: testAccount,
5918+
cacheLookupPolicy: CacheLookupPolicy.Default,
5919+
correlationId: RANDOM_TEST_GUID,
5920+
});
5921+
});
5922+
5923+
it("adds silentRefreshReason telemetry field with noTokensFound error code", (done) => {
5924+
const noTokensFoundError =
5925+
createInteractionRequiredAuthError(
5926+
InteractionRequiredAuthErrorCodes.noTokensFound
5927+
);
5928+
5929+
jest.spyOn(
5930+
SilentCacheClient.prototype,
5931+
"acquireToken"
5932+
).mockRejectedValue(refreshRequiredCacheError);
5933+
jest.spyOn(
5934+
SilentRefreshClient.prototype,
5935+
"acquireToken"
5936+
).mockRejectedValue(noTokensFoundError);
5937+
jest.spyOn(
5938+
SilentIframeClient.prototype,
5939+
"acquireToken"
5940+
).mockResolvedValue(testTokenResponse);
5941+
5942+
const callbackId = pca.addPerformanceCallback((events) => {
5943+
expect(events[0].silentRefreshReason).toBe(
5944+
InteractionRequiredAuthErrorCodes.noTokensFound
5945+
);
5946+
pca.removePerformanceCallback(callbackId);
5947+
done();
5948+
});
5949+
5950+
pca.acquireTokenSilent({
5951+
scopes: ["openid"],
5952+
account: testAccount,
5953+
cacheLookupPolicy: CacheLookupPolicy.Default,
5954+
correlationId: RANDOM_TEST_GUID,
5955+
});
5956+
});
5957+
});
58205958
});
58215959
});
58225960

0 commit comments

Comments
 (0)