diff --git a/samples/MusicStore/Controllers/AccountController.cs b/samples/MusicStore/Controllers/AccountController.cs index 65c0c6c066..25e5e43013 100644 --- a/samples/MusicStore/Controllers/AccountController.cs +++ b/samples/MusicStore/Controllers/AccountController.cs @@ -1,9 +1,9 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Http.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; diff --git a/samples/MusicStore/Controllers/ManageController.cs b/samples/MusicStore/Controllers/ManageController.cs index 2faf857601..5e1ed74436 100644 --- a/samples/MusicStore/Controllers/ManageController.cs +++ b/samples/MusicStore/Controllers/ManageController.cs @@ -1,6 +1,7 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; @@ -13,16 +14,20 @@ namespace MusicStore.Controllers { public ManageController( UserManager userManager, - SignInManager signInManager) + SignInManager signInManager, + IAuthenticationSchemeProvider schemes) { UserManager = userManager; SignInManager = signInManager; + SchemeProvider = schemes; } public UserManager UserManager { get; } public SignInManager SignInManager { get; } + public IAuthenticationSchemeProvider SchemeProvider { get; } + // // GET: /Manage/Index public async Task Index(ManageMessageId? message = null) @@ -285,7 +290,8 @@ namespace MusicStore.Controllers return View("Error"); } var userLogins = await UserManager.GetLoginsAsync(user); - var otherLogins = SignInManager.GetExternalAuthenticationSchemes().Where(auth => userLogins.All(ul => auth.AuthenticationScheme != ul.LoginProvider)).ToList(); + var schemes = await SchemeProvider.GetAllSchemesAsync(); + var otherLogins = schemes.Where(auth => userLogins.All(ul => auth.Name != ul.LoginProvider)).ToList(); ViewBag.ShowRemoveButton = user.PasswordHash != null || userLogins.Count > 1; return View(new ManageLoginsViewModel { diff --git a/samples/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs b/samples/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs index 39e39a38ff..22ab6492e2 100644 --- a/samples/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs +++ b/samples/MusicStore/ForTesting/Mocks/Common/CustomStateDataFormat.cs @@ -1,5 +1,4 @@ using Microsoft.AspNetCore.Authentication; -using Microsoft.AspNetCore.Http.Authentication; using Newtonsoft.Json; namespace MusicStore.Mocks.Common diff --git a/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs b/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs index 5127bea75d..c060c779dd 100644 --- a/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs +++ b/samples/MusicStore/ForTesting/Mocks/StartupOpenIdConnectTesting.cs @@ -58,6 +58,29 @@ namespace MusicStore .AddEntityFrameworkStores() .AddDefaultTokenProviders(); + // Create an Azure Active directory application and copy paste the following + services.AddOpenIdConnectAuthentication(options => + { + options.Authority = "https://login.windows.net/[tenantName].onmicrosoft.com"; + options.ClientId = "c99497aa-3ee2-4707-b8a8-c33f51323fef"; + options.BackchannelHttpHandler = new OpenIdConnectBackChannelHttpHandler(); + options.StringDataFormat = new CustomStringDataFormat(); + options.StateDataFormat = new CustomStateDataFormat(); + options.ResponseType = OpenIdConnectResponseType.CodeIdToken; + options.UseTokenLifetime = false; + options.TokenValidationParameters.ValidateLifetime = false; + options.ProtocolValidator.RequireNonce = true; + options.ProtocolValidator.NonceLifetime = TimeSpan.FromDays(36500); + + options.Events = new OpenIdConnectEvents + { + OnMessageReceived = TestOpenIdConnectEvents.MessageReceived, + OnAuthorizationCodeReceived = TestOpenIdConnectEvents.AuthorizationCodeReceived, + OnRedirectToIdentityProvider = TestOpenIdConnectEvents.RedirectToIdentityProvider, + OnTokenValidated = TestOpenIdConnectEvents.TokenValidated, + }; + }); + services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => @@ -105,32 +128,8 @@ namespace MusicStore // Add static files to the request pipeline app.UseStaticFiles(); - // Add cookie-based authentication to the request pipeline - app.UseIdentity(); - - // Create an Azure Active directory application and copy paste the following - var options = new OpenIdConnectOptions - { - Authority = "https://login.windows.net/[tenantName].onmicrosoft.com", - ClientId = "c99497aa-3ee2-4707-b8a8-c33f51323fef", - BackchannelHttpHandler = new OpenIdConnectBackChannelHttpHandler(), - StringDataFormat = new CustomStringDataFormat(), - StateDataFormat = new CustomStateDataFormat(), - ResponseType = OpenIdConnectResponseType.CodeIdToken, - UseTokenLifetime = false, - - Events = new OpenIdConnectEvents - { - OnMessageReceived = TestOpenIdConnectEvents.MessageReceived, - OnAuthorizationCodeReceived = TestOpenIdConnectEvents.AuthorizationCodeReceived, - OnRedirectToIdentityProvider = TestOpenIdConnectEvents.RedirectToIdentityProvider, - OnTokenValidated = TestOpenIdConnectEvents.TokenValidated, - } - }; - options.TokenValidationParameters.ValidateLifetime = false; - options.ProtocolValidator.RequireNonce = true; - options.ProtocolValidator.NonceLifetime = TimeSpan.FromDays(36500); - app.UseOpenIdConnectAuthentication(options); + // Add authentication to the request pipeline + app.UseAuthentication(); // Add MVC to the request pipeline app.UseMvc(routes => diff --git a/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs b/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs index 1cea514b11..aa6c3e193c 100644 --- a/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs +++ b/samples/MusicStore/ForTesting/Mocks/StartupSocialTesting.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Caching.Memory; @@ -59,13 +60,12 @@ namespace MusicStore } // Add Identity services to the services container - services.AddIdentity(options => - { - options.Cookies.ApplicationCookie.AccessDeniedPath = new PathString("/Home/AccessDenied"); - }) + services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); + services.ConfigureApplicationCookie(options => options.AccessDeniedPath = "/Home/AccessDenied"); + services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => @@ -93,6 +93,70 @@ namespace MusicStore { options.AddPolicy("ManageStore", new AuthorizationPolicyBuilder().RequireClaim("ManageStore", "Allowed").Build()); }); + + services.AddFacebookAuthentication(options => + { + options.AppId = "[AppId]"; + options.AppSecret = "[AppSecret]"; + options.Events = new OAuthEvents() + { + OnCreatingTicket = TestFacebookEvents.OnCreatingTicket, + OnTicketReceived = TestFacebookEvents.OnTicketReceived, + OnRedirectToAuthorizationEndpoint = TestFacebookEvents.RedirectToAuthorizationEndpoint + }; + options.BackchannelHttpHandler = new FacebookMockBackChannelHttpHandler(); + options.StateDataFormat = new CustomStateDataFormat(); + options.Scope.Add("email"); + options.Scope.Add("read_friendlists"); + options.Scope.Add("user_checkins"); + }); + + services.AddGoogleAuthentication(options => + { + options.ClientId = "[ClientId]"; + options.ClientSecret = "[ClientSecret]"; + options.AccessType = "offline"; + options.Events = new OAuthEvents() + { + OnCreatingTicket = TestGoogleEvents.OnCreatingTicket, + OnTicketReceived = TestGoogleEvents.OnTicketReceived, + OnRedirectToAuthorizationEndpoint = TestGoogleEvents.RedirectToAuthorizationEndpoint + }; + options.StateDataFormat = new CustomStateDataFormat(); + options.BackchannelHttpHandler = new GoogleMockBackChannelHttpHandler(); + }); + + services.AddTwitterAuthentication(options => + { + options.ConsumerKey = "[ConsumerKey]"; + options.ConsumerSecret = "[ConsumerSecret]"; + options.Events = new TwitterEvents() + { + OnCreatingTicket = TestTwitterEvents.OnCreatingTicket, + OnTicketReceived = TestTwitterEvents.OnTicketReceived, + OnRedirectToAuthorizationEndpoint = TestTwitterEvents.RedirectToAuthorizationEndpoint + }; + options.StateDataFormat = new CustomTwitterStateDataFormat(); + options.BackchannelHttpHandler = new TwitterMockBackChannelHttpHandler(); + }); + + services.AddMicrosoftAccountAuthentication(options => + { + options.DisplayName = "MicrosoftAccount - Requires project changes"; + options.ClientId = "[ClientId]"; + options.ClientSecret = "[ClientSecret]"; + options.Events = new OAuthEvents() + { + OnCreatingTicket = TestMicrosoftAccountEvents.OnCreatingTicket, + OnTicketReceived = TestMicrosoftAccountEvents.OnTicketReceived, + OnRedirectToAuthorizationEndpoint = TestMicrosoftAccountEvents.RedirectToAuthorizationEndpoint + }; + options.BackchannelHttpHandler = new MicrosoftAccountMockBackChannelHandler(); + options.StateDataFormat = new CustomStateDataFormat(); + options.Scope.Add("wl.basic"); + options.Scope.Add("wl.signin"); + }); + } public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) @@ -114,67 +178,7 @@ namespace MusicStore app.UseStaticFiles(); // Add cookie-based authentication to the request pipeline - app.UseIdentity(); - - app.UseFacebookAuthentication(new FacebookOptions - { - AppId = "[AppId]", - AppSecret = "[AppSecret]", - Events = new OAuthEvents() - { - OnCreatingTicket = TestFacebookEvents.OnCreatingTicket, - OnTicketReceived = TestFacebookEvents.OnTicketReceived, - OnRedirectToAuthorizationEndpoint = TestFacebookEvents.RedirectToAuthorizationEndpoint - }, - BackchannelHttpHandler = new FacebookMockBackChannelHttpHandler(), - StateDataFormat = new CustomStateDataFormat(), - Scope = { "email", "read_friendlists", "user_checkins" } - }); - - app.UseGoogleAuthentication(new GoogleOptions - { - ClientId = "[ClientId]", - ClientSecret = "[ClientSecret]", - AccessType = "offline", - Events = new OAuthEvents() - { - OnCreatingTicket = TestGoogleEvents.OnCreatingTicket, - OnTicketReceived = TestGoogleEvents.OnTicketReceived, - OnRedirectToAuthorizationEndpoint = TestGoogleEvents.RedirectToAuthorizationEndpoint - }, - StateDataFormat = new CustomStateDataFormat(), - BackchannelHttpHandler = new GoogleMockBackChannelHttpHandler() - }); - - app.UseTwitterAuthentication(new TwitterOptions - { - ConsumerKey = "[ConsumerKey]", - ConsumerSecret = "[ConsumerSecret]", - Events = new TwitterEvents() - { - OnCreatingTicket = TestTwitterEvents.OnCreatingTicket, - OnTicketReceived = TestTwitterEvents.OnTicketReceived, - OnRedirectToAuthorizationEndpoint = TestTwitterEvents.RedirectToAuthorizationEndpoint - }, - StateDataFormat = new CustomTwitterStateDataFormat(), - BackchannelHttpHandler = new TwitterMockBackChannelHttpHandler() - }); - - app.UseMicrosoftAccountAuthentication(new MicrosoftAccountOptions - { - DisplayName = "MicrosoftAccount - Requires project changes", - ClientId = "[ClientId]", - ClientSecret = "[ClientSecret]", - Events = new OAuthEvents() - { - OnCreatingTicket = TestMicrosoftAccountEvents.OnCreatingTicket, - OnTicketReceived = TestMicrosoftAccountEvents.OnTicketReceived, - OnRedirectToAuthorizationEndpoint = TestMicrosoftAccountEvents.RedirectToAuthorizationEndpoint - }, - BackchannelHttpHandler = new MicrosoftAccountMockBackChannelHandler(), - StateDataFormat = new CustomStateDataFormat(), - Scope = { "wl.basic", "wl.signin" } - }); + app.UseAuthentication(); // Add MVC to the request pipeline app.UseMvc(routes => diff --git a/samples/MusicStore/Models/ManageViewModels.cs b/samples/MusicStore/Models/ManageViewModels.cs index e91224cce5..4204972ef5 100644 --- a/samples/MusicStore/Models/ManageViewModels.cs +++ b/samples/MusicStore/Models/ManageViewModels.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Http.Authentication; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc.Rendering; @@ -18,7 +18,7 @@ namespace MusicStore.Models public class ManageLoginsViewModel { public IList CurrentLogins { get; set; } - public IList OtherLogins { get; set; } + public IList OtherLogins { get; set; } } public class FactorViewModel diff --git a/samples/MusicStore/Startup.cs b/samples/MusicStore/Startup.cs index bdeff64d3c..f0152e700f 100644 --- a/samples/MusicStore/Startup.cs +++ b/samples/MusicStore/Startup.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; @@ -48,13 +49,11 @@ namespace MusicStore } // Add Identity services to the services container - services.AddIdentity(options => - { - options.Cookies.ApplicationCookie.AccessDeniedPath = "/Home/AccessDenied"; - }) + services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); + services.ConfigureApplicationCookie(options => options.AccessDeniedPath = "/Home/AccessDenied"); services.AddCors(options => { @@ -89,6 +88,45 @@ namespace MusicStore authBuilder.RequireClaim("ManageStore", "Allowed"); }); }); + + services.AddFacebookAuthentication(options => + { + options.AppId = "550624398330273"; + options.AppSecret = "10e56a291d6b618da61b1e0dae3a8954"; + }); + + services.AddGoogleAuthentication(options => + { + options.ClientId = "995291875932-0rt7417v5baevqrno24kv332b7d6d30a.apps.googleusercontent.com"; + options.ClientSecret = "J_AT57H5KH_ItmMdu0r6PfXm"; + }); + + services.AddTwitterAuthentication(options => + { + options.ConsumerKey = "lDSPIu480ocnXYZ9DumGCDw37"; + options.ConsumerSecret = "fpo0oWRNc3vsZKlZSq1PyOSoeXlJd7NnG4Rfc94xbFXsdcc3nH"; + }); + + // The MicrosoftAccount service has restrictions that prevent the use of + // http://localhost:5001/ for test applications. + // As such, here is how to change this sample to uses http://ktesting.com:5001/ instead. + + // From an admin command console first enter: + // notepad C:\Windows\System32\drivers\etc\hosts + // and add this to the file, save, and exit (and reboot?): + // 127.0.0.1 ktesting.com + + // Then you can choose to run the app as admin (see below) or add the following ACL as admin: + // netsh http add urlacl url=http://ktesting:5001/ user=[domain\user] + + // The sample app can then be run via: + // dnx . web + services.AddMicrosoftAccountAuthentication(options => + { + options.DisplayName = "MicrosoftAccount - Requires project changes"; + options.ClientId = "000000004012C08A"; + options.ClientSecret = "GaMQ2hCnqAC6EcDLnXsAeBVIJOLmeutL"; + }); } //This method is invoked when ASPNETCORE_ENVIRONMENT is 'Development' or is not defined @@ -146,46 +184,7 @@ namespace MusicStore app.UseStaticFiles(); // Add cookie-based authentication to the request pipeline - app.UseIdentity(); - - app.UseFacebookAuthentication(new FacebookOptions - { - AppId = "550624398330273", - AppSecret = "10e56a291d6b618da61b1e0dae3a8954" - }); - - app.UseGoogleAuthentication(new GoogleOptions - { - ClientId = "995291875932-0rt7417v5baevqrno24kv332b7d6d30a.apps.googleusercontent.com", - ClientSecret = "J_AT57H5KH_ItmMdu0r6PfXm" - }); - - app.UseTwitterAuthentication(new TwitterOptions - { - ConsumerKey = "lDSPIu480ocnXYZ9DumGCDw37", - ConsumerSecret = "fpo0oWRNc3vsZKlZSq1PyOSoeXlJd7NnG4Rfc94xbFXsdcc3nH" - }); - - // The MicrosoftAccount service has restrictions that prevent the use of - // http://localhost:5001/ for test applications. - // As such, here is how to change this sample to uses http://ktesting.com:5001/ instead. - - // From an admin command console first enter: - // notepad C:\Windows\System32\drivers\etc\hosts - // and add this to the file, save, and exit (and reboot?): - // 127.0.0.1 ktesting.com - - // Then you can choose to run the app as admin (see below) or add the following ACL as admin: - // netsh http add urlacl url=http://ktesting:5001/ user=[domain\user] - - // The sample app can then be run via: - // dnx . web - app.UseMicrosoftAccountAuthentication(new MicrosoftAccountOptions - { - DisplayName = "MicrosoftAccount - Requires project changes", - ClientId = "000000004012C08A", - ClientSecret = "GaMQ2hCnqAC6EcDLnXsAeBVIJOLmeutL" - }); + app.UseAuthentication(); // Add MVC to the request pipeline app.UseMvc(routes => diff --git a/samples/MusicStore/StartupOpenIdConnect.cs b/samples/MusicStore/StartupOpenIdConnect.cs index b6d48b6982..2e939ace6c 100644 --- a/samples/MusicStore/StartupOpenIdConnect.cs +++ b/samples/MusicStore/StartupOpenIdConnect.cs @@ -101,6 +101,14 @@ namespace MusicStore authBuilder.RequireClaim("ManageStore", "Allowed"); }); }); + + // Create an Azure Active directory application and copy paste the following + services.AddOpenIdConnectAuthentication(options => + { + options.Authority = "https://login.windows.net/[tenantName].onmicrosoft.com"; + options.ClientId = "[ClientId]"; + options.ResponseType = OpenIdConnectResponseType.CodeIdToken; + }); } public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) @@ -121,17 +129,6 @@ namespace MusicStore // Add static files to the request pipeline app.UseStaticFiles(); - // Add cookie-based authentication to the request pipeline - app.UseIdentity(); - - // Create an Azure Active directory application and copy paste the following - app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions - { - Authority = "https://login.windows.net/[tenantName].onmicrosoft.com", - ClientId = "[ClientId]", - ResponseType = OpenIdConnectResponseType.CodeIdToken, - }); - // Add MVC to the request pipeline app.UseMvc(routes => { diff --git a/samples/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml b/samples/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml index fa2dd99da1..56ebf814a1 100644 --- a/samples/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml +++ b/samples/MusicStore/Views/Account/_ExternalLoginsListPartial.cshtml @@ -1,9 +1,11 @@ -@model ExternalLoginListViewModel -@inject SignInManager SignInManager +@using Microsoft.AspNetCore.Authentication +@model ExternalLoginListViewModel +@inject IAuthenticationSchemeProvider SchemeProvider

Use another service to log in.


@{ - var loginProviders = SignInManager.GetExternalAuthenticationSchemes(); + var schemes = await SchemeProvider.GetAllSchemesAsync(); + var loginProviders = schemes.ToList(); if (!loginProviders.Any()) {
@@ -20,7 +22,7 @@

@foreach (var p in loginProviders) { - + }

diff --git a/samples/MusicStore/Views/Manage/ManageLogins.cshtml b/samples/MusicStore/Views/Manage/ManageLogins.cshtml index 28e03baedf..d4d26253bc 100644 --- a/samples/MusicStore/Views/Manage/ManageLogins.cshtml +++ b/samples/MusicStore/Views/Manage/ManageLogins.cshtml @@ -45,7 +45,7 @@

@foreach (var p in Model.OtherLogins) { - + }

diff --git a/test/MusicStore.Test/ManageControllerTest.cs b/test/MusicStore.Test/ManageControllerTest.cs index 57e294187d..1fc35e59b6 100644 --- a/test/MusicStore.Test/ManageControllerTest.cs +++ b/test/MusicStore.Test/ManageControllerTest.cs @@ -2,12 +2,13 @@ using System; using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; +using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Http.Features.Authentication; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using MusicStore.Models; using Xunit; @@ -23,6 +24,7 @@ namespace MusicStore.Controllers var efServiceProvider = new ServiceCollection().AddEntityFrameworkInMemoryDatabase().BuildServiceProvider(); var services = new ServiceCollection(); + services.AddSingleton(new ConfigurationBuilder().Build()); services.AddOptions(); services .AddDbContext(b => b.UseInMemoryDatabase("Scratch").UseInternalServiceProvider(efServiceProvider)); @@ -30,12 +32,12 @@ namespace MusicStore.Controllers services.AddIdentity() .AddEntityFrameworkStores(); + services.AddMvc(); + services.AddSingleton(); services.AddLogging(); - services.AddOptions(); // IHttpContextAccessor is required for SignInManager, and UserManager var context = new DefaultHttpContext(); - context.Features.Set(new HttpAuthenticationFeature() { Handler = new TestAuthHandler() }); services.AddSingleton( new HttpContextAccessor() { @@ -63,8 +65,11 @@ namespace MusicStore.Controllers var httpContext = _serviceProvider.GetRequiredService().HttpContext; httpContext.User = new ClaimsPrincipal(new ClaimsIdentity(claims)); - - var controller = new ManageController(userManager, signInManager); + httpContext.RequestServices = _serviceProvider; + + var schemeProvider = _serviceProvider.GetRequiredService(); + + var controller = new ManageController(userManager, signInManager, schemeProvider); controller.ControllerContext.HttpContext = httpContext; // Act @@ -83,38 +88,28 @@ namespace MusicStore.Controllers Assert.True(model.HasPassword); } - private class TestAuthHandler : IAuthenticationHandler + public class NoOpAuth : IAuthenticationService { - public void Authenticate(AuthenticateContext context) + public Task AuthenticateAsync(HttpContext context, string scheme) { - context.NotAuthenticated(); + return Task.FromResult(AuthenticateResult.None()); } - public Task AuthenticateAsync(AuthenticateContext context) + public Task ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties, ChallengeBehavior behavior) { - context.NotAuthenticated(); return Task.FromResult(0); } - public Task ChallengeAsync(ChallengeContext context) + public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties) { throw new NotImplementedException(); } - public void GetDescriptions(DescribeSchemesContext context) - { - throw new NotImplementedException(); - } - - public Task SignInAsync(SignInContext context) - { - throw new NotImplementedException(); - } - - public Task SignOutAsync(SignOutContext context) + public Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties) { throw new NotImplementedException(); } } + } } \ No newline at end of file diff --git a/test/MusicStore.Test/MusicStore.Test.csproj b/test/MusicStore.Test/MusicStore.Test.csproj index 8b9dc784fd..8f5185b81f 100644 --- a/test/MusicStore.Test/MusicStore.Test.csproj +++ b/test/MusicStore.Test/MusicStore.Test.csproj @@ -12,6 +12,7 @@ +