Skip to content

Commit 8f1eedf

Browse files
author
John Luo
committed
Merge branch 'release/2.1' into release/2.2
2 parents a9b737b + 87af0c3 commit 8f1eedf

File tree

16 files changed

+282
-229
lines changed

16 files changed

+282
-229
lines changed

build/AzureIntegration.targets

Lines changed: 0 additions & 30 deletions
This file was deleted.

build/SharedFx.targets

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,28 @@
4141

4242
</Target>
4343

44+
<Target Name="BuildSiteExtension" DependsOnTargets="BuildMetapackages" Condition="'$(BuildSiteExtension)' == 'true'" >
45+
<PropertyGroup>
46+
<AzureIntegrationProjProperties>
47+
AspNetUniverseBuildOffline=true;
48+
DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);
49+
DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
50+
BuildNumber=$(BuildNumber);
51+
Configuration=$(Configuration);
52+
IsFinalBuild=$(IsFinalBuild);
53+
</AzureIntegrationProjProperties>
54+
</PropertyGroup>
55+
56+
<!-- Pack logging site extension -->
57+
<MSBuild Projects="$(RepositoryRoot)\src\SiteExtensions\LoggingBranch\LoggingBranch.csproj" Targets="Restore;Pack" Properties="$(AzureIntegrationProjProperties);PackageOutputPath=$(BuildDir)" />
58+
</Target>
59+
60+
<Target Name="GetSiteExtensionArtifactInfo" Condition="'$(BuildSiteExtension)' == 'true'" >
61+
<MSBuild Projects="$(RepositoryRoot)\src\SiteExtensions\LoggingBranch\LoggingBranch.csproj" Targets="GetArtifactInfo" Properties="PackageOutputPath=$(BuildDir);BuildNumber=$(BuildNumber);DesignTimeBuild=true;IsFinalBuild=$(IsFinalBuild)">
62+
<Output TaskParameter="TargetOutputs" ItemName="ArtifactInfo" />
63+
</MSBuild>
64+
</Target>
65+
4466
<Target Name="_BuildSharedFxProjects" DependsOnTargets="GeneratePropsFiles;ResolveCommitHash">
4567

4668
<PropertyGroup>

build/artifacts.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<PackageArtifact Include="Microsoft.AspNetCore.Authentication" Category="ship" />
4545
<PackageArtifact Include="Microsoft.AspNetCore.Authorization.Policy" Category="ship" />
4646
<PackageArtifact Include="Microsoft.AspNetCore.Authorization" Category="ship" />
47+
<PackageArtifact Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.2" Category="noship" Condition="'$(BuildSiteExtension)' == 'true'" />
4748
<PackageArtifact Include="Microsoft.AspNetCore.AzureAppServices.HostingStartup" Category="ship" />
4849
<PackageArtifact Include="Microsoft.AspNetCore.AzureAppServicesIntegration" Category="ship" />
4950
<PackageArtifact Include="Microsoft.AspNetCore.Connections.Abstractions" Category="ship" />

build/repo.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<SignedDependencyPackageDir>$(RepositoryRoot).deps\Signed\Packages\</SignedDependencyPackageDir>
1818
<SignCheckExclusionsFile>$(RepositoryRoot)eng\signcheck.exclusions.txt</SignCheckExclusionsFile>
1919
<SharedSourcesFolder>$(RepositoryRoot)src\Shared\</SharedSourcesFolder>
20+
<SharedFxArchitecture Condition="'$(SharedFxArchitecture)' == ''">$(SharedFxRid.Substring($([MSBuild]::Add($(SharedFxRid.LastIndexOf('-')), 1))))</SharedFxArchitecture>
21+
<BuildSiteExtension>false</BuildSiteExtension>
22+
<BuildSiteExtension Condition="'$(BuildSiteExtension)' == 'true' AND '$(OS)' != 'Windows_NT'">false</BuildSiteExtension>
2023
</PropertyGroup>
2124

2225
<ItemGroup>

build/repo.targets

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project>
22
<Import Project="RepositoryBuild.targets" />
33
<Import Project="PackageArchive.targets" />
4-
<Import Project="AzureIntegration.targets" />
54
<Import Project="SharedFx.targets" />
65
<Import Project="CodeSign.targets" />
76
<Import Project="Publish.targets" />
@@ -22,7 +21,7 @@
2221
<CompileDependsOn>$(CompileDependsOn);BuildProjects;PackSharedSources</CompileDependsOn>
2322
<CompileDependsOn Condition="'$(_ProjectsOnly)' != 'true'">$(CompileDependsOn);PackProjects;BuildRepositories;BuildSharedFx</CompileDependsOn>
2423
<PackageDependsOn Condition=" '$(_ProjectsOnly)' == 'true'">$(PackageDependsOn);PackProjects</PackageDependsOn>
25-
<PackageDependsOn Condition="'$(TestOnly)' != 'true' AND '$(_ProjectsOnly)' != 'true'">$(PackageDependsOn);CheckExpectedPackagesExist</PackageDependsOn>
24+
<PackageDependsOn Condition="'$(TestOnly)' != 'true' AND '$(_ProjectsOnly)' != 'true'">$(PackageDependsOn);BuildSiteExtension;CheckExpectedPackagesExist</PackageDependsOn>
2625
<PackageDependsOn Condition="'$(TestOnly)' != 'true'">$(PackageDependsOn);CodeSign</PackageDependsOn>
2726
<TestDependsOn>$(TestDependsOn);TestProjects</TestDependsOn>
2827
<TestDependsOn Condition="'$(_ProjectsOnly)' != 'true'">$(TestDependsOn);_TestRepositories</TestDependsOn>
@@ -73,7 +72,7 @@
7372
</ItemGroup>
7473
</Target>
7574

76-
<Target Name="ResolveRepoInfo" DependsOnTargets="_ResolveProjectArtifactsInfoShipped;_PrepareRepositories">
75+
<Target Name="ResolveRepoInfo" DependsOnTargets="_ResolveProjectArtifactsInfoShipped;_PrepareRepositories;GetSiteExtensionArtifactInfo">
7776
<!-- We need to pass the NETCoreApp package versions to msbuild so that it doesn't complain about us using a different one than it was restored against. -->
7877
<PropertyGroup>
7978
<DesignTimeBuildProps>$(BuildProperties);MicrosoftNETCoreAppPackageVersion=$(MicrosoftNETCoreAppPackageVersion);</DesignTimeBuildProps>

eng/PatchConfig.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Later on, this will be checked using this condition:
2828
<PropertyGroup Condition=" '$(VersionPrefix)' == '2.2.2' ">
2929
<PackagesInPatch>
3030
@aspnet/signalr;
31+
Microsoft.AspNetCore.Authentication.Google;
3132
</PackagesInPatch>
3233
</PropertyGroup>
3334

src/Razor/Razor.Design/test/IntegrationTests/Microsoft.AspNetCore.Razor.Design.Test.csproj

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313
<!-- Copy references locally so that we can use them in the test. -->
1414
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1515
<BuildVariablesGeneratedFile>$(MSBuildProjectDirectory)\obj\BuildVariables.generated.cs</BuildVariablesGeneratedFile>
16-
<CompileDependsOn>EnsureBuildVariablesGeneratedFile;$(CompileDependsOn)</CompileDependsOn>
1716
</PropertyGroup>
1817

1918
<ItemGroup>
2019
<None Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
21-
<Compile Include="$(BuildVariablesGeneratedFile)" Condition="Exists('$(BuildVariablesGeneratedFile)')" />
2220
</ItemGroup>
2321

2422
<!-- The test projects rely on these binaries being available -->
@@ -43,8 +41,31 @@
4341
<Reference Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib" />
4442
</ItemGroup>
4543

46-
<Target Name="EnsureBuildVariablesGeneratedFile">
47-
<Error Text="BuildVariables.generated.cs was not found. Run .\build /t:Prepare from the root of the repository to generate it." Condition="!Exists('$(BuildVariablesGeneratedFile)')" />
44+
<Target Name="GenerateBuildVariablesFile" BeforeTargets="BeforeBuild">
45+
<Warning Text="Some SDK tests on Windows require the project to be built once using Desktop MSBuild, but the current build is executed using .NET Core MSBuild. This may result in test failures."
46+
Condition="!Exists('$(BuildVariablesGeneratedFile)') and '$(MSBuildRuntimeType)' != 'Full' and '$(OS)' == 'Windows_NT'" />
47+
48+
<PropertyGroup>
49+
<GeneratedFileContents>
50+
// Copyright (c) .NET Foundation. All rights reserved.
51+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
52+
53+
namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
54+
{
55+
internal static partial class BuildVariables
56+
{
57+
static partial void InitializeVariables()
58+
{
59+
_msBuildPath = @"$(MSBuildBinPath)\MSBuild.exe"%3B
60+
}
61+
}
62+
}
63+
</GeneratedFileContents>
64+
</PropertyGroup>
65+
<WriteLinesToFile Lines="$(GeneratedFileContents)" File="$(BuildVariablesGeneratedFile)" Overwrite="true" WriteOnlyWhenDifferent="true" Condition="'$(MSBuildRuntimeType)' == 'Full'" />
66+
<ItemGroup>
67+
<Compile Include="$(BuildVariablesGeneratedFile)" Condition="Exists('$(BuildVariablesGeneratedFile)')" />
68+
</ItemGroup>
4869
</Target>
4970

5071
</Project>

src/Security/Authentication/Google/src/GoogleDefaults.cs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
5+
46
namespace Microsoft.AspNetCore.Authentication.Google
57
{
68
/// <summary>
@@ -17,7 +19,23 @@ public static class GoogleDefaults
1719

1820
public static readonly string TokenEndpoint = "https://www.googleapis.com/oauth2/v4/token";
1921

20-
// https://developers.google.com/+/web/people/
21-
public static readonly string UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me";
22+
public static readonly string UserInformationEndpoint;
23+
24+
private const string UseGooglePlusSwitch = "Switch.Microsoft.AspNetCore.Authentication.Google.UsePlus";
25+
26+
internal static readonly bool UseGooglePlus;
27+
28+
static GoogleDefaults()
29+
{
30+
if (AppContext.TryGetSwitch(UseGooglePlusSwitch, out UseGooglePlus) && UseGooglePlus)
31+
{
32+
// https://developers.google.com/+/web/people/
33+
UserInformationEndpoint = "https://www.googleapis.com/plus/v1/people/me";
34+
}
35+
else
36+
{
37+
UserInformationEndpoint = "https://www.googleapis.com/oauth2/v2/userinfo";
38+
}
39+
}
2240
}
2341
}

src/Security/Authentication/Google/src/GoogleOptions.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

44
using System.Security.Claims;
5-
using Microsoft.AspNetCore.Authentication;
65
using Microsoft.AspNetCore.Authentication.OAuth;
76
using Microsoft.AspNetCore.Http;
87

@@ -27,16 +26,27 @@ public GoogleOptions()
2726
Scope.Add("email");
2827

2928
ClaimActions.MapJsonKey(ClaimTypes.NameIdentifier, "id");
30-
ClaimActions.MapJsonKey(ClaimTypes.Name, "displayName");
31-
ClaimActions.MapJsonSubKey(ClaimTypes.GivenName, "name", "givenName");
32-
ClaimActions.MapJsonSubKey(ClaimTypes.Surname, "name", "familyName");
33-
ClaimActions.MapJsonKey("urn:google:profile", "url");
34-
ClaimActions.MapCustomJson(ClaimTypes.Email, GoogleHelper.GetEmail);
29+
if (GoogleDefaults.UseGooglePlus)
30+
{
31+
ClaimActions.MapJsonKey(ClaimTypes.Name, "displayName");
32+
ClaimActions.MapJsonSubKey(ClaimTypes.GivenName, "name", "givenName");
33+
ClaimActions.MapJsonSubKey(ClaimTypes.Surname, "name", "familyName");
34+
ClaimActions.MapJsonKey("urn:google:profile", "url");
35+
ClaimActions.MapCustomJson(ClaimTypes.Email, GoogleHelper.GetEmail);
36+
}
37+
else
38+
{
39+
ClaimActions.MapJsonKey(ClaimTypes.Name, "name");
40+
ClaimActions.MapJsonKey(ClaimTypes.GivenName, "given_name");
41+
ClaimActions.MapJsonKey(ClaimTypes.Surname, "family_name");
42+
ClaimActions.MapJsonKey("urn:google:profile", "link");
43+
ClaimActions.MapJsonKey(ClaimTypes.Email, "email");
44+
}
3545
}
3646

3747
/// <summary>
3848
/// access_type. Set to 'offline' to request a refresh token.
3949
/// </summary>
4050
public string AccessType { get; set; }
4151
}
42-
}
52+
}

0 commit comments

Comments
 (0)