Skip to content

Commit 55e7a6d

Browse files
committed
Ported MusicStore sample (#326)
1 parent 7fc7c1f commit 55e7a6d

File tree

7 files changed

+21
-25
lines changed

7 files changed

+21
-25
lines changed

samples/MusicStore/MusicStore.Test/Mocks/SignInManagerMock.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ public SignInManagerMock(
2020
IUserClaimsPrincipalFactory<ApplicationUser> claimsFactory,
2121
IOptions<IdentityOptions> optionsAccessor,
2222
ILogger<SignInManager<ApplicationUser>> logger,
23-
IAuthenticationSchemeProvider schemes)
24-
: base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, schemes)
23+
IAuthenticationSchemeProvider schemes,
24+
IUserConfirmation<ApplicationUser> confirmation)
25+
: base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, schemes, confirmation)
2526
{
2627
}
2728

samples/MusicStore/MusicStore.Test/MusicStore.Test.csproj

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.App" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0-*" />
1110
<PackageReference Include="xunit" Version="2.4.1" />
1211
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
1312
<PrivateAssets>all</PrivateAssets>

samples/MusicStore/MusicStore.Test/TestStartup.cs

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

1010
public class TestStartup : Startup
1111
{
12-
public TestStartup(IHostingEnvironment env)
12+
public TestStartup(IWebHostEnvironment env)
1313
: base(env)
1414
{
1515
}

samples/MusicStore/MusicStore.Web/Controllers/AccountController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ public async Task<ActionResult> LogOff()
458458

459459
// TODO: Currently SignInManager.SignOut does not sign out OpenIdc and does not have a way to pass in a specific
460460
// AuthType to sign out.
461-
var appEnv = HttpContext.RequestServices.GetService<IHostingEnvironment>();
461+
var appEnv = HttpContext.RequestServices.GetService<IWebHostEnvironment>();
462462
if (appEnv.EnvironmentName.StartsWith("OpenIdConnect"))
463463
{
464464
return new SignOutResult("OpenIdConnect", new AuthenticationProperties

samples/MusicStore/MusicStore.Web/Models/SampleData.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private static async Task AddOrUpdateAsync<TEntity>(
7878
/// <returns></returns>
7979
private static async Task CreateAdminUser(IServiceProvider serviceProvider)
8080
{
81-
var env = serviceProvider.GetService<IHostingEnvironment>();
81+
var env = serviceProvider.GetService<IWebHostEnvironment>();
8282

8383
var builder = new ConfigurationBuilder()
8484
.SetBasePath(env.ContentRootPath)
Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.0</TargetFramework>
55
<UserSecretsId>aspnet-MusicStore.Web-B1796332-CD47-4D99-85BC-7F98EA978F33</UserSecretsId>
66
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
77
<RootNamespace>MusicStore</RootNamespace>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="Microsoft.AspNetCore.App" />
13-
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.*" />
14-
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.*" PrivateAssets="All" />
15-
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="2.2.*" />
16-
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="2.2.2" />
17-
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="2.2.*" />
18-
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="2.2.*" />
19-
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.2.*" />
20-
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.*" />
21-
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.*" PrivateAssets="All" />
22-
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.*" />
23-
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.2.*" />
24-
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.*" />
12+
<PackageReference Include="Microsoft.AspNetCore.Authentication.Facebook" Version="3.0.0-*" />
13+
<PackageReference Include="Microsoft.AspNetCore.Authentication.Google" Version="3.0.0-*" />
14+
<PackageReference Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="3.0.0-*" />
15+
<PackageReference Include="Microsoft.AspNetCore.Authentication.Twitter" Version="3.0.0-*" />
16+
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0-*" />
17+
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-*" />
18+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-*" />
19+
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="3.0.0-*" />
20+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0-*" />
2521
</ItemGroup>
2622

2723
</Project>

samples/MusicStore/MusicStore.Web/Startup.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class Startup
1717
{
18-
public Startup(IHostingEnvironment hostingEnvironment)
18+
public Startup(IWebHostEnvironment hostingEnvironment)
1919
{
2020
// Below code demonstrates usage of multiple configuration sources. For instance a setting say 'setting1'
2121
// is found in both the registered sources, then the later source will win. By this way a Local config
@@ -57,7 +57,7 @@ public void ConfigureServices(IServiceCollection services)
5757
services.AddLogging();
5858

5959
// Add MVC services to the services container
60-
services.AddMvc();
60+
services.AddMvc(options => options.EnableEndpointRouting = false);
6161

6262
// Add memory cache services
6363
services.AddMemoryCache();

0 commit comments

Comments
 (0)