Browse Source

Merge pull request #28576 from dotnet-maestro-bot/merge/release/5.0-to-master

[automated] Merge branch 'release/5.0' => 'master'
William Godbe 5 years ago
parent
commit
25da5970ee

+ 2 - 2
eng/targets/Wix.Common.targets

@@ -24,8 +24,8 @@
     <_GeneratedPackageVersion
         Condition="! $(PackageVersion.Contains('$(_PreReleaseLabel)'))">$(PackageVersion)-$(_PreReleaseLabel)$(_BuildNumberLabels)</_GeneratedPackageVersion>
     <!-- Insert PackageVersion into OutputName for SharedFx & TargetingPack -->
-    <OutputName Condition="'$(OutputNamePrefix)' != '' AND '$(OutputNameSuffix)' != ''">$(OutputNamePrefix)$(_GeneratedPackageVersion)$(OutputNameSuffix)$(TargetExt)</OutputName>
-    
+    <OutputName Condition="'$(OutputNamePrefix)' != '' AND '$(OutputNameSuffix)' != ''">$(OutputNamePrefix)$(_GeneratedPackageVersion)$(OutputNameSuffix)</OutputName>
+
     <EmbedCab Condition="'$(EmbedCab)' == ''">yes</EmbedCab>
     <Cabinet Condition="'$(Cabinet)' == ''">$(OutputName.Replace('-', '_')).cab</Cabinet>
     <InstallDir>$(ProductName)</InstallDir>

File diff suppressed because it is too large
+ 0 - 0
src/Components/Web.JS/dist/Release/blazor.server.js


+ 25 - 25
src/Components/WebAssembly/Authentication.Msal/src/Interop/AuthenticationService.ts

@@ -101,8 +101,12 @@ class MsalAuthorizeService implements AuthorizeService {
             scopes: scopes
         };
 
-        const response = await this._msalApplication.acquireTokenSilent(silentRequest);
-        return response.idTokenClaims;
+        try {
+            const response = await this._msalApplication.acquireTokenSilent(silentRequest);
+            return response.idTokenClaims;
+        } catch (e) {
+            await this.signInCore(silentRequest);
+        }
     }
 
     async getAccessToken(request?: AccessTokenRequestOptions): Promise<AccessTokenResult> {
@@ -224,10 +228,9 @@ class MsalAuthorizeService implements AuthorizeService {
     async completeSignIn() {
         // Make sure that the redirect handler has completed execution before
         // completing sign in.
-        await this._redirectCallback;
-        const account = this.getAccount();
-        if (account) {
-            return this.success(account);
+        var authenticationResult = await this._redirectCallback;
+        if (authenticationResult) {
+            return authenticationResult;
         }
         return this.operationCompleted();
     }
@@ -253,7 +256,7 @@ class MsalAuthorizeService implements AuthorizeService {
         const logoutStateId = sessionStorage.getItem(`${AuthenticationService._infrastructureKey}.LogoutState`);
         const updatedUrl = new URL(url);
         updatedUrl.search = `?state=${logoutStateId}`;
-        const logoutState = await this.retrieveState(updatedUrl.href, /*isLogout*/ true);
+        const logoutState = await this.retrieveState(updatedUrl.href, null, /*isLogout*/ true);
 
         sessionStorage.removeItem(`${AuthenticationService._infrastructureKey}.LogoutState`);
 
@@ -285,25 +288,22 @@ class MsalAuthorizeService implements AuthorizeService {
         return base64UrlIdentifier;
     }
 
-    async retrieveState<T>(url: string, isLogout: boolean = false): Promise<T | undefined> {
-        const parsedUrl = new URL(url);
-        const fromHash = parsedUrl.hash && parsedUrl.hash.length > 0 && new URLSearchParams(parsedUrl.hash.substring(1));
-        let state = fromHash && fromHash.getAll('state');
-        if (state && state.length > 1) {
+    retrieveState<T>(url: string | null, providedState: string | null = null, isLogout: boolean = false): T | undefined {
+        let stateFromUrl;
+        // Parse the state key from the `search` query parameter in the URL if provided
+        if (url) {
+            const parsedUrl = new URL(url);
+            stateFromUrl = parsedUrl.searchParams && parsedUrl.searchParams.getAll('state');
+        }
+
+        // Chose  the provided state from MSAL. Otherwise, choose the state computed from the URL
+        const state = providedState || stateFromUrl;
+
+        if (!state) {
             return undefined;
-        } else if (!state || state.length == 0) {
-            state = parsedUrl.searchParams && parsedUrl.searchParams.getAll('state');
-            if (!state || state.length !== 1) {
-                return undefined;
-            }
         }
 
-        // We need to calculate the state key in two different ways. The reason for it is that
-        // msal.js doesn't support the state parameter on logout flows, which forces us to shim our own logout state.
-        // The format then is different, as msal follows the pattern state=<<guid>>|<<user_state>> and our format
-        // simple uses <<base64urlIdentifier>>.
-        const appState = !isLogout ? this.getAccountState(state[0]) : state[0];
-        const stateKey = `${AuthenticationService._infrastructureKey}.AuthorizeService.${appState}`;
+        const stateKey = `${AuthenticationService._infrastructureKey}.AuthorizeService.${state}`;
         const stateString = sessionStorage.getItem(stateKey);
         if (stateString) {
             sessionStorage.removeItem(stateKey);
@@ -336,9 +336,9 @@ class MsalAuthorizeService implements AuthorizeService {
     }
 
     private handleResult(result: Msal.AuthenticationResult | null) {
-        if (result != null) {
+        if (result) {
             this._account = result.account;
-            return this.success(result.state);
+            return this.success(this.retrieveState(null, result.state));
         } else {
             return this.operationCompleted();
         }

+ 1 - 1
src/Installers/Windows/SharedFramework/SharedFramework.wixproj

@@ -80,7 +80,7 @@
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 
   <PropertyGroup>
-    <PackageFileName>$(OutputName)</PackageFileName>
+    <PackageFileName>$(OutputName)$(TargetExt)</PackageFileName>
     <ProductName>Microsoft ASP.NET Core $(PackageBrandingVersion) Shared Framework ($(Platform))</ProductName>
     <DefineConstants>$(DefineConstants);ProductName=$(ProductName)</DefineConstants>
   </PropertyGroup>

+ 1 - 1
src/Installers/Windows/TargetingPack/TargetingPack.wixproj

@@ -71,7 +71,7 @@
 
   <PropertyGroup>
     <ProductName>Microsoft ASP.NET Core $(PackageBrandingVersion) Targeting Pack ($(Platform))</ProductName>
-    <PackageFileName>$(OutputName)</PackageFileName>
+    <PackageFileName>$(OutputName)$(TargetExt)</PackageFileName>
     <DefineConstants>$(DefineConstants);ProductName=$(ProductName)</DefineConstants>
 
     <!-- Suppresses building this project completely during servicing builds. -->

Some files were not shown because too many files changed in this diff