Update @azure/msal-browser dependency to v2.8.0 (#29226)
#### Description This PR updates the version of the MSAL.js dependency that we redistribute in our Authentication.Msal library in response to user requests and recommendation from the MSAL team. #### Technical Description This PR contains some code changes in response to some changes in type definition over in MSAL.js: - https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/2105 - https://github.com/AzureAD/microsoft-authentication-library-for-js/pull/2512 #### Customer Impact Without these changes, if users want to pick up required bug fixes in the downstream MSAL.js library, they would have to compile their own version of JavaScript dependencies and integrate them into their project. This PR allows users to consume bug fixes blocking customer login and platform support without having to put in difficult workarounds. #### Regression? - [ ] Yes - [X] No #### Risk - [ ] High - [ ] Medium - [X] Low Change contains no breaking changes and was made on recommendation of the MSAL team. Manual verification completed. #### Verification - [X] Manual (required) - [ ] Automated Verified navigating to the authorized-only fetch data page, logging in, confirming redirect, logging out, logging in again on: - Azure B2C + Blazor WASM Hosted - Azure B2C + Blazor Standalone - Azure AAD + Blazor WASM Hosted - Azure AAD + Blazor WASM Standalone #### Packaging changes reviewed? - [ ] Yes - [ ] No - [X] N/A Addresses https://github.com/dotnet/aspnetcore/issues/29010, https://github.com/dotnet/aspnetcore/issues/28969, https://github.com/dotnet/aspnetcore/issues/28956
This commit is contained in:
parent
94804f3100
commit
50b3190579
|
|
@ -1,5 +1,4 @@
|
|||
import * as Msal from '@azure/msal-browser';
|
||||
import { StringDict } from '@azure/msal-common';
|
||||
|
||||
interface AccessTokenRequestOptions {
|
||||
scopes: string[];
|
||||
|
|
@ -13,7 +12,7 @@ interface AccessTokenResult {
|
|||
|
||||
interface AccessToken {
|
||||
value: string;
|
||||
expires: Date;
|
||||
expires: Date | null;
|
||||
grantedScopes: string[];
|
||||
}
|
||||
|
||||
|
|
@ -36,7 +35,7 @@ interface AuthenticationResult {
|
|||
}
|
||||
|
||||
interface AuthorizeService {
|
||||
getUser(): Promise<StringDict | undefined>;
|
||||
getUser(): Promise<object | undefined>;
|
||||
getAccessToken(request?: AccessTokenRequestOptions): Promise<AccessTokenResult>;
|
||||
signIn(state: any): Promise<AuthenticationResult>;
|
||||
completeSignIn(state: any): Promise<AuthenticationResult>;
|
||||
|
|
@ -52,7 +51,7 @@ interface AuthorizeServiceConfiguration extends Msal.Configuration {
|
|||
|
||||
class MsalAuthorizeService implements AuthorizeService {
|
||||
private readonly _msalApplication: Msal.PublicClientApplication;
|
||||
private _account: Msal.AccountInfo | undefined;
|
||||
private _account: Msal.AccountInfo | undefined | null;
|
||||
private _redirectCallback: Promise<AuthenticationResult | null> | undefined;
|
||||
private _requestedScopes: string[] | undefined;
|
||||
|
||||
|
|
@ -178,10 +177,10 @@ class MsalAuthorizeService implements AuthorizeService {
|
|||
if (!account) {
|
||||
return this.error("No account to get tokens for.");
|
||||
}
|
||||
const silentRequest = {
|
||||
const silentRequest : Msal.SilentRequest = {
|
||||
redirectUri: request.redirectUri,
|
||||
account: account,
|
||||
scopes: request.scopes.concat(request.extraScopesToConsent || [])
|
||||
scopes: request?.scopes?.concat(request.extraScopesToConsent || []) || []
|
||||
};
|
||||
await this._msalApplication.acquireTokenSilent(silentRequest);
|
||||
}
|
||||
|
|
@ -198,9 +197,9 @@ class MsalAuthorizeService implements AuthorizeService {
|
|||
async signInCore(request: Msal.AuthorizationUrlRequest): Promise<Msal.AuthenticationResult | Msal.AuthError | undefined> {
|
||||
const loginMode = this._settings.loginMode.toLowerCase();
|
||||
if (loginMode === 'redirect') {
|
||||
return this.signInWithRedirect(request);
|
||||
return this.signInWithRedirect(<Msal.RedirectRequest> request);
|
||||
} else {
|
||||
return this.signInWithPopup(request);
|
||||
return this.signInWithPopup(<Msal.PopupRequest> request);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@
|
|||
"webpack-cli": "^3.3.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"@azure/msal-browser": "^2.0.0"
|
||||
"@azure/msal-browser": "2.8.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue