Skip to content

Commit 25da597

Browse files
authored
Merge pull request #28576 from dotnet-maestro-bot/merge/release/5.0-to-master
[automated] Merge branch 'release/5.0' => 'master'
2 parents a62e27e + b190ec0 commit 25da597

File tree

5 files changed

+30
-30
lines changed

5 files changed

+30
-30
lines changed

eng/targets/Wix.Common.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
<_GeneratedPackageVersion
2525
Condition="! $(PackageVersion.Contains('$(_PreReleaseLabel)'))">$(PackageVersion)-$(_PreReleaseLabel)$(_BuildNumberLabels)</_GeneratedPackageVersion>
2626
<!-- Insert PackageVersion into OutputName for SharedFx & TargetingPack -->
27-
<OutputName Condition="'$(OutputNamePrefix)' != '' AND '$(OutputNameSuffix)' != ''">$(OutputNamePrefix)$(_GeneratedPackageVersion)$(OutputNameSuffix)$(TargetExt)</OutputName>
28-
27+
<OutputName Condition="'$(OutputNamePrefix)' != '' AND '$(OutputNameSuffix)' != ''">$(OutputNamePrefix)$(_GeneratedPackageVersion)$(OutputNameSuffix)</OutputName>
28+
2929
<EmbedCab Condition="'$(EmbedCab)' == ''">yes</EmbedCab>
3030
<Cabinet Condition="'$(Cabinet)' == ''">$(OutputName.Replace('-', '_')).cab</Cabinet>
3131
<InstallDir>$(ProductName)</InstallDir>

src/Components/Web.JS/dist/Release/blazor.server.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Components/WebAssembly/Authentication.Msal/src/Interop/AuthenticationService.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,12 @@ class MsalAuthorizeService implements AuthorizeService {
101101
scopes: scopes
102102
};
103103

104-
const response = await this._msalApplication.acquireTokenSilent(silentRequest);
105-
return response.idTokenClaims;
104+
try {
105+
const response = await this._msalApplication.acquireTokenSilent(silentRequest);
106+
return response.idTokenClaims;
107+
} catch (e) {
108+
await this.signInCore(silentRequest);
109+
}
106110
}
107111

108112
async getAccessToken(request?: AccessTokenRequestOptions): Promise<AccessTokenResult> {
@@ -224,10 +228,9 @@ class MsalAuthorizeService implements AuthorizeService {
224228
async completeSignIn() {
225229
// Make sure that the redirect handler has completed execution before
226230
// completing sign in.
227-
await this._redirectCallback;
228-
const account = this.getAccount();
229-
if (account) {
230-
return this.success(account);
231+
var authenticationResult = await this._redirectCallback;
232+
if (authenticationResult) {
233+
return authenticationResult;
231234
}
232235
return this.operationCompleted();
233236
}
@@ -253,7 +256,7 @@ class MsalAuthorizeService implements AuthorizeService {
253256
const logoutStateId = sessionStorage.getItem(`${AuthenticationService._infrastructureKey}.LogoutState`);
254257
const updatedUrl = new URL(url);
255258
updatedUrl.search = `?state=${logoutStateId}`;
256-
const logoutState = await this.retrieveState(updatedUrl.href, /*isLogout*/ true);
259+
const logoutState = await this.retrieveState(updatedUrl.href, null, /*isLogout*/ true);
257260

258261
sessionStorage.removeItem(`${AuthenticationService._infrastructureKey}.LogoutState`);
259262

@@ -285,25 +288,22 @@ class MsalAuthorizeService implements AuthorizeService {
285288
return base64UrlIdentifier;
286289
}
287290

288-
async retrieveState<T>(url: string, isLogout: boolean = false): Promise<T | undefined> {
289-
const parsedUrl = new URL(url);
290-
const fromHash = parsedUrl.hash && parsedUrl.hash.length > 0 && new URLSearchParams(parsedUrl.hash.substring(1));
291-
let state = fromHash && fromHash.getAll('state');
292-
if (state && state.length > 1) {
291+
retrieveState<T>(url: string | null, providedState: string | null = null, isLogout: boolean = false): T | undefined {
292+
let stateFromUrl;
293+
// Parse the state key from the `search` query parameter in the URL if provided
294+
if (url) {
295+
const parsedUrl = new URL(url);
296+
stateFromUrl = parsedUrl.searchParams && parsedUrl.searchParams.getAll('state');
297+
}
298+
299+
// Chose the provided state from MSAL. Otherwise, choose the state computed from the URL
300+
const state = providedState || stateFromUrl;
301+
302+
if (!state) {
293303
return undefined;
294-
} else if (!state || state.length == 0) {
295-
state = parsedUrl.searchParams && parsedUrl.searchParams.getAll('state');
296-
if (!state || state.length !== 1) {
297-
return undefined;
298-
}
299304
}
300305

301-
// We need to calculate the state key in two different ways. The reason for it is that
302-
// msal.js doesn't support the state parameter on logout flows, which forces us to shim our own logout state.
303-
// The format then is different, as msal follows the pattern state=<<guid>>|<<user_state>> and our format
304-
// simple uses <<base64urlIdentifier>>.
305-
const appState = !isLogout ? this.getAccountState(state[0]) : state[0];
306-
const stateKey = `${AuthenticationService._infrastructureKey}.AuthorizeService.${appState}`;
306+
const stateKey = `${AuthenticationService._infrastructureKey}.AuthorizeService.${state}`;
307307
const stateString = sessionStorage.getItem(stateKey);
308308
if (stateString) {
309309
sessionStorage.removeItem(stateKey);
@@ -336,9 +336,9 @@ class MsalAuthorizeService implements AuthorizeService {
336336
}
337337

338338
private handleResult(result: Msal.AuthenticationResult | null) {
339-
if (result != null) {
339+
if (result) {
340340
this._account = result.account;
341-
return this.success(result.state);
341+
return this.success(this.retrieveState(null, result.state));
342342
} else {
343343
return this.operationCompleted();
344344
}

src/Installers/Windows/SharedFramework/SharedFramework.wixproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
8181

8282
<PropertyGroup>
83-
<PackageFileName>$(OutputName)</PackageFileName>
83+
<PackageFileName>$(OutputName)$(TargetExt)</PackageFileName>
8484
<ProductName>Microsoft ASP.NET Core $(PackageBrandingVersion) Shared Framework ($(Platform))</ProductName>
8585
<DefineConstants>$(DefineConstants);ProductName=$(ProductName)</DefineConstants>
8686
</PropertyGroup>

src/Installers/Windows/TargetingPack/TargetingPack.wixproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171

7272
<PropertyGroup>
7373
<ProductName>Microsoft ASP.NET Core $(PackageBrandingVersion) Targeting Pack ($(Platform))</ProductName>
74-
<PackageFileName>$(OutputName)</PackageFileName>
74+
<PackageFileName>$(OutputName)$(TargetExt)</PackageFileName>
7575
<DefineConstants>$(DefineConstants);ProductName=$(ProductName)</DefineConstants>
7676

7777
<!-- Suppresses building this project completely during servicing builds. -->

0 commit comments

Comments
 (0)