Merge in 'release/5.0' changes
This commit is contained in:
commit
0f32327ea0
|
|
@ -1,5 +1,4 @@
|
||||||
import * as Msal from '@azure/msal-browser';
|
import * as Msal from '@azure/msal-browser';
|
||||||
import { StringDict } from '@azure/msal-common';
|
|
||||||
|
|
||||||
interface AccessTokenRequestOptions {
|
interface AccessTokenRequestOptions {
|
||||||
scopes: string[];
|
scopes: string[];
|
||||||
|
|
@ -13,7 +12,7 @@ interface AccessTokenResult {
|
||||||
|
|
||||||
interface AccessToken {
|
interface AccessToken {
|
||||||
value: string;
|
value: string;
|
||||||
expires: Date;
|
expires: Date | null;
|
||||||
grantedScopes: string[];
|
grantedScopes: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,7 +35,7 @@ interface AuthenticationResult {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AuthorizeService {
|
interface AuthorizeService {
|
||||||
getUser(): Promise<StringDict | undefined>;
|
getUser(): Promise<object | undefined>;
|
||||||
getAccessToken(request?: AccessTokenRequestOptions): Promise<AccessTokenResult>;
|
getAccessToken(request?: AccessTokenRequestOptions): Promise<AccessTokenResult>;
|
||||||
signIn(state: any): Promise<AuthenticationResult>;
|
signIn(state: any): Promise<AuthenticationResult>;
|
||||||
completeSignIn(state: any): Promise<AuthenticationResult>;
|
completeSignIn(state: any): Promise<AuthenticationResult>;
|
||||||
|
|
@ -52,7 +51,7 @@ interface AuthorizeServiceConfiguration extends Msal.Configuration {
|
||||||
|
|
||||||
class MsalAuthorizeService implements AuthorizeService {
|
class MsalAuthorizeService implements AuthorizeService {
|
||||||
private readonly _msalApplication: Msal.PublicClientApplication;
|
private readonly _msalApplication: Msal.PublicClientApplication;
|
||||||
private _account: Msal.AccountInfo | undefined;
|
private _account: Msal.AccountInfo | undefined | null;
|
||||||
private _redirectCallback: Promise<AuthenticationResult | null> | undefined;
|
private _redirectCallback: Promise<AuthenticationResult | null> | undefined;
|
||||||
private _requestedScopes: string[] | undefined;
|
private _requestedScopes: string[] | undefined;
|
||||||
|
|
||||||
|
|
@ -178,10 +177,10 @@ class MsalAuthorizeService implements AuthorizeService {
|
||||||
if (!account) {
|
if (!account) {
|
||||||
return this.error("No account to get tokens for.");
|
return this.error("No account to get tokens for.");
|
||||||
}
|
}
|
||||||
const silentRequest = {
|
const silentRequest : Msal.SilentRequest = {
|
||||||
redirectUri: request.redirectUri,
|
redirectUri: request.redirectUri,
|
||||||
account: account,
|
account: account,
|
||||||
scopes: request.scopes.concat(request.extraScopesToConsent || [])
|
scopes: request?.scopes?.concat(request.extraScopesToConsent || []) || []
|
||||||
};
|
};
|
||||||
await this._msalApplication.acquireTokenSilent(silentRequest);
|
await this._msalApplication.acquireTokenSilent(silentRequest);
|
||||||
}
|
}
|
||||||
|
|
@ -198,9 +197,9 @@ class MsalAuthorizeService implements AuthorizeService {
|
||||||
async signInCore(request: Msal.AuthorizationUrlRequest): Promise<Msal.AuthenticationResult | Msal.AuthError | undefined> {
|
async signInCore(request: Msal.AuthorizationUrlRequest): Promise<Msal.AuthenticationResult | Msal.AuthError | undefined> {
|
||||||
const loginMode = this._settings.loginMode.toLowerCase();
|
const loginMode = this._settings.loginMode.toLowerCase();
|
||||||
if (loginMode === 'redirect') {
|
if (loginMode === 'redirect') {
|
||||||
return this.signInWithRedirect(request);
|
return this.signInWithRedirect(<Msal.RedirectRequest> request);
|
||||||
} else {
|
} else {
|
||||||
return this.signInWithPopup(request);
|
return this.signInWithPopup(<Msal.PopupRequest> request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,6 @@
|
||||||
"webpack-cli": "^3.3.10"
|
"webpack-cli": "^3.3.10"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"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