From 0a344f6cdcb2ced0229a801ec6a0ad1ac44ea8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ca=C3=B1izares=20Est=C3=A9vez?= Date: Tue, 29 Nov 2016 15:10:16 +0100 Subject: [PATCH] Improvements in identity, securice basket api, login-logout from mvc application and consume securiced basket. --- docker-compose.yml | 5 +- .../Controllers/BasketController.cs | 2 + src/Services/Basket/Basket.API/Program.cs | 1 + src/Services/Basket/Basket.API/Startup.cs | 14 +- .../Basket/Basket.API/appsettings.json | 2 +- .../Configuration/Config.cs | 6 - .../Controllers/AccountController.cs | 102 +- .../Controllers/ConsentController.cs | 1 + .../ConsentInputModel.cs | 2 +- .../ConsentViewModel.cs | 2 +- .../LoggedOutViewModel.cs | 2 +- .../AccountViewModels/LoginViewModel.cs | 11 +- .../LogoutViewModel.cs | 2 +- .../AccountViewModels/RegisterViewModel.cs | 2 + .../AccountViewModels/_LoginViewModel.cs | 20 + .../Models/LoginInputModel.cs | 18 - .../Models/LoginViewModel.cs | 20 - .../eShopOnContainers.Identity/Startup.cs | 2 +- .../Views/Account/LoggedOut.cshtml | 2 +- .../Views/Account/Login.cshtml | 123 +- .../Views/Account/Logout.cshtml | 2 +- .../Views/Account/Register.cshtml | 133 +- .../Views/Account/_Login.cshtml | 49 + .../Views/Consent/Index.cshtml | 2 +- .../Views/Consent/_ScopeListItem.cshtml | 2 +- .../Views/Shared/_Layout.cshtml | 7 +- .../bundleconfig.json | 3 +- .../wwwroot/css/site.less | 867 ++++++++ .../wwwroot/css/site.min.css | 2 +- .../wwwroot/css/sitemvc.css | 1 + .../wwwroot/css/sitemvc.min.css | 1 + .../wwwroot/fonts/Montserrat-Bold.eot | Bin 0 -> 29744 bytes .../wwwroot/fonts/Montserrat-Bold.svg | 1933 +++++++++++++++++ .../wwwroot/fonts/Montserrat-Bold.ttf | Bin 0 -> 29560 bytes .../wwwroot/fonts/Montserrat-Bold.woff | Bin 0 -> 17348 bytes .../wwwroot/fonts/Montserrat-Bold.woff2 | Bin 0 -> 12112 bytes .../wwwroot/fonts/Montserrat-Regular.eot | Bin 0 -> 29212 bytes .../wwwroot/fonts/Montserrat-Regular.svg | 1743 +++++++++++++++ .../wwwroot/fonts/Montserrat-Regular.ttf | Bin 0 -> 29016 bytes .../wwwroot/fonts/Montserrat-Regular.woff | Bin 0 -> 17284 bytes .../wwwroot/fonts/Montserrat-Regular.woff2 | Bin 0 -> 12080 bytes .../Ordering/Ordering.API/settings.json | 2 +- .../WebMVC/Controllers/AccountController.cs | 464 +--- src/Web/WebMVC/Controllers/CartController.cs | 1 + src/Web/WebMVC/Services/BasketService.cs | 20 +- src/Web/WebMVC/Startup.cs | 28 +- src/Web/WebMVC/ViewComponents/Cart.cs | 1 + .../WebMVC/Views/Shared/_LoginPartial.cshtml | 2 +- src/Web/WebMVC/appsettings.json | 4 +- .../eShopOnContainers.WebSPA/Program.cs | 1 + 50 files changed, 4912 insertions(+), 695 deletions(-) rename src/Services/Identity/eShopOnContainers.Identity/Models/{ => AccountViewModels}/ConsentInputModel.cs (88%) rename src/Services/Identity/eShopOnContainers.Identity/Models/{ => AccountViewModels}/ConsentViewModel.cs (97%) rename src/Services/Identity/eShopOnContainers.Identity/Models/{ => AccountViewModels}/LoggedOutViewModel.cs (86%) rename src/Services/Identity/eShopOnContainers.Identity/Models/{ => AccountViewModels}/LogoutViewModel.cs (81%) create mode 100644 src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/_LoginViewModel.cs delete mode 100644 src/Services/Identity/eShopOnContainers.Identity/Models/LoginInputModel.cs delete mode 100644 src/Services/Identity/eShopOnContainers.Identity/Models/LoginViewModel.cs create mode 100644 src/Services/Identity/eShopOnContainers.Identity/Views/Account/_Login.cshtml create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/css/sitemvc.css create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/css/sitemvc.min.css create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Bold.eot create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Bold.svg create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Bold.ttf create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Bold.woff create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Bold.woff2 create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Regular.eot create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Regular.svg create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Regular.ttf create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Regular.woff create mode 100644 src/Services/Identity/eShopOnContainers.Identity/wwwroot/fonts/Montserrat-Regular.woff2 diff --git a/docker-compose.yml b/docker-compose.yml index 0e490c9b9..43417ea65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,6 @@ services: ports: - "5100:80" depends_on: - - catalog.api - identity.service - basket.api @@ -31,14 +30,13 @@ services: ports: - "5104:80" depends_on: - - catalog.api - basket.api - identity.service catalog.api: image: eshop/catalog.api environment: - - ConnectionString=Server=catalog.data;Initial Catalog=CatalogData;User Id=sa;Password=Pass@word + - ConnectionString=Server=catalog.data;Database=CatalogDB;User Id=sa;Password=Pass@word expose: - "80" ports: @@ -77,6 +75,7 @@ services: image: eshop/identity environment: - Spa:http://webspa + - ConnectionString=Server=identity.data;Database=aspnet-Microsoft.eShopOnContainers.WebMVC;User Id=sa;Password=Pass@word expose: - "80" ports: diff --git a/src/Services/Basket/Basket.API/Controllers/BasketController.cs b/src/Services/Basket/Basket.API/Controllers/BasketController.cs index 25e936c4c..e613774b1 100644 --- a/src/Services/Basket/Basket.API/Controllers/BasketController.cs +++ b/src/Services/Basket/Basket.API/Controllers/BasketController.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.Services.Basket.API.Model; +using Microsoft.AspNetCore.Authorization; namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers { @@ -12,6 +13,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API.Controllers //If this is the case we should also investigate changing the serialization format used for Redis, //using a HashSet instead of a simple string. [Route("/")] + [Authorize] public class BasketController : Controller { private IBasketRepository _repository; diff --git a/src/Services/Basket/Basket.API/Program.cs b/src/Services/Basket/Basket.API/Program.cs index 712aafef8..ed9866dc2 100644 --- a/src/Services/Basket/Basket.API/Program.cs +++ b/src/Services/Basket/Basket.API/Program.cs @@ -17,6 +17,7 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup() + .UseUrls("http://localhost:5008") .Build(); host.Run(); diff --git a/src/Services/Basket/Basket.API/Startup.cs b/src/Services/Basket/Basket.API/Startup.cs index 7828cef82..070e10b86 100644 --- a/src/Services/Basket/Basket.API/Startup.cs +++ b/src/Services/Basket/Basket.API/Startup.cs @@ -47,6 +47,15 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API return ConnectionMultiplexer.Connect(ips.First().ToString()); }); + services.AddCors(options => + { + options.AddPolicy("CorsPolicy", + builder => builder.AllowAnyOrigin() + .AllowAnyMethod() + .AllowAnyHeader() + .AllowCredentials()); + }); + services.AddTransient(); } @@ -56,9 +65,12 @@ namespace Microsoft.eShopOnContainers.Services.Basket.API loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); + // Use frameworks + app.UseCors("CorsPolicy"); + app.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions { - Authority = Configuration.GetValue("IdentityUrl", "http://localhost:5000"), + Authority = "http://localhost:5000", ScopeName = "basket", RequireHttpsMetadata = false }); diff --git a/src/Services/Basket/Basket.API/appsettings.json b/src/Services/Basket/Basket.API/appsettings.json index b970542bd..4a7f5b126 100644 --- a/src/Services/Basket/Basket.API/appsettings.json +++ b/src/Services/Basket/Basket.API/appsettings.json @@ -7,6 +7,6 @@ "Microsoft": "Information" } }, - "identityUrl": "http://localhost:5105", + "identityUrl": "http://localhost:5000", "ConnectionString": "127.0.0.1" } diff --git a/src/Services/Identity/eShopOnContainers.Identity/Configuration/Config.cs b/src/Services/Identity/eShopOnContainers.Identity/Configuration/Config.cs index 21e9a7295..c7e5189e5 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Configuration/Config.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Configuration/Config.cs @@ -49,11 +49,9 @@ namespace eShopOnContainers.Identity.Configuration ClientName = "eShop SPA OpenId Client", AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, - RedirectUris = { "http://localhost:5003/callback.html" }, PostLogoutRedirectUris = { "http://localhost:5003/index.html" }, AllowedCorsOrigins = { "http://localhost:5003" }, - AllowedScopes = { StandardScopes.OpenId.Name, @@ -68,11 +66,9 @@ namespace eShopOnContainers.Identity.Configuration ClientName = "eShop Xamarin OpenId Client", AllowedGrantTypes = GrantTypes.Implicit, AllowAccessTokensViaBrowser = true, - RedirectUris = { "http://localhost:5003/callback.html" }, PostLogoutRedirectUris = { "http://localhost:5003/index.html" }, AllowedCorsOrigins = { "http://localhost:5003" }, - AllowedScopes = { StandardScopes.OpenId.Name, @@ -90,9 +86,7 @@ namespace eShopOnContainers.Identity.Configuration new Secret("secret".Sha256()) }, ClientUri = "http://localhost:2114", - AllowedGrantTypes = GrantTypes.HybridAndClientCredentials, - RedirectUris = new List { "http://localhost:2114/signin-oidc" diff --git a/src/Services/Identity/eShopOnContainers.Identity/Controllers/AccountController.cs b/src/Services/Identity/eShopOnContainers.Identity/Controllers/AccountController.cs index 1032c09b1..58f1cf52b 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Controllers/AccountController.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Controllers/AccountController.cs @@ -19,6 +19,10 @@ using IdentityServer4.Stores; using eShopOnContainers.Identity.Services; using eShopOnContainers.Identity.Models; using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Authorization; +using eShopOnContainers.Identity.Models.AccountViewModels; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Authentication; namespace IdentityServer4.Quickstart.UI.Controllers { @@ -34,6 +38,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers private readonly IIdentityServerInteractionService _interaction; private readonly IClientStore _clientStore; private readonly ILogger _logger; + private readonly UserManager _userManager; public AccountController( @@ -41,12 +46,14 @@ namespace IdentityServer4.Quickstart.UI.Controllers ILoginService loginService, IIdentityServerInteractionService interaction, IClientStore clientStore, - ILoggerFactory loggerFactory) + ILoggerFactory loggerFactory, + UserManager userManager) { _loginService = loginService; _interaction = interaction; _clientStore = clientStore; _logger = loggerFactory.CreateLogger(); + _userManager = userManager; } /// @@ -64,12 +71,6 @@ namespace IdentityServer4.Quickstart.UI.Controllers var vm = await BuildLoginViewModelAsync(returnUrl, context); - if (vm.EnableLocalLogin == false && vm.ExternalProviders.Count() == 1) - { - // only one option for logging in - return ExternalLogin(vm.ExternalProviders.First().AuthenticationScheme, returnUrl); - } - return View(vm); } @@ -78,11 +79,11 @@ namespace IdentityServer4.Quickstart.UI.Controllers /// [HttpPost] [ValidateAntiForgeryToken] - public async Task Login(LoginInputModel model) + public async Task Login(LoginViewModel model) { if (ModelState.IsValid) { - var user = await _loginService.FindByUsername(model.Username); + var user = await _loginService.FindByUsername(model.Email); // validate username/password against in-memory store if (await _loginService.ValidateCredentials(user, model.Password)) { @@ -92,7 +93,7 @@ namespace IdentityServer4.Quickstart.UI.Controllers AuthenticationProperties props = null; // only set explicit expiration here if persistent. // otherwise we reply upon expiration configured in cookie middleware. - if (model.RememberLogin) + if (model.RememberMe) { props = new AuthenticationProperties { @@ -101,7 +102,6 @@ namespace IdentityServer4.Quickstart.UI.Controllers }; }; - //await HttpContext.Authentication.SignInAsync(, user.UserName, props); await _loginService.SignIn(user); // make sure the returnUrl is still valid, and if yes - redirect back to authorize endpoint @@ -123,14 +123,6 @@ namespace IdentityServer4.Quickstart.UI.Controllers async Task BuildLoginViewModelAsync(string returnUrl, AuthorizationRequest context) { - var providers = HttpContext.Authentication.GetAuthenticationSchemes() - .Where(x => x.DisplayName != null) - .Select(x => new ExternalProvider - { - DisplayName = x.DisplayName, - AuthenticationScheme = x.AuthenticationScheme - }); - var allowLocal = true; if (context?.ClientId != null) { @@ -138,29 +130,22 @@ namespace IdentityServer4.Quickstart.UI.Controllers if (client != null) { allowLocal = client.EnableLocalLogin; - - if (client.IdentityProviderRestrictions != null && client.IdentityProviderRestrictions.Any()) - { - providers = providers.Where(provider => client.IdentityProviderRestrictions.Contains(provider.AuthenticationScheme)); - } } } return new LoginViewModel { - EnableLocalLogin = allowLocal, ReturnUrl = returnUrl, - Username = context?.LoginHint, - ExternalProviders = providers.ToArray() + Email = context?.LoginHint, }; } - async Task BuildLoginViewModelAsync(LoginInputModel model) + async Task BuildLoginViewModelAsync(LoginViewModel model) { var context = await _interaction.GetAuthorizationContextAsync(model.ReturnUrl); var vm = await BuildLoginViewModelAsync(model.ReturnUrl, context); - vm.Username = model.Username; - vm.RememberLogin = model.RememberLogin; + vm.Email = model.Email; + vm.RememberMe = model.RememberMe; return vm; } @@ -329,5 +314,62 @@ namespace IdentityServer4.Quickstart.UI.Controllers return Redirect("~/"); } + + // GET: /Account/Register + [HttpGet] + [AllowAnonymous] + public IActionResult Register(string returnUrl = null) + { + ViewData["ReturnUrl"] = returnUrl; + return View(); + } + + // + // POST: /Account/Register + [HttpPost] + [AllowAnonymous] + [ValidateAntiForgeryToken] + public async Task Register(RegisterViewModel model, string returnUrl = null) + { + ViewData["ReturnUrl"] = returnUrl; + if (ModelState.IsValid) + { + var user = new ApplicationUser + { + UserName = model.Email, + Email = model.Email, + CardHolderName = model.User.CardHolderName, + CardNumber = model.User.CardNumber, + CardType = model.User.CardType, + City = model.User.City, + Country = model.User.Country, + Expiration = model.User.Expiration, + LastName = model.User.LastName, + Name = model.User.Name, + Street = model.User.Street, + State = model.User.State, + ZipCode = model.User.ZipCode, + PhoneNumber = model.User.PhoneNumber, + SecurityNumber = model.User.SecurityNumber + }; + var result = await _userManager.CreateAsync(user, model.Password); + if (result.Errors.Count() > 0) + { + AddErrors(result); + // If we got this far, something failed, redisplay form + return View(model); + } + } + + return RedirectToAction("index", "home"); + } + + private void AddErrors(IdentityResult result) + { + foreach (var error in result.Errors) + { + ModelState.AddModelError(string.Empty, error.Description); + } + } } } \ No newline at end of file diff --git a/src/Services/Identity/eShopOnContainers.Identity/Controllers/ConsentController.cs b/src/Services/Identity/eShopOnContainers.Identity/Controllers/ConsentController.cs index e242f3a4f..0aec38c0e 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Controllers/ConsentController.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Controllers/ConsentController.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using IdentityServer4.Models; using IdentityServer4.Stores; using IdentityServer4.Quickstart.UI.Models; +using eShopOnContainers.Identity.Models.AccountViewModels; namespace IdentityServer4.Quickstart.UI.Controllers { diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/ConsentInputModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/ConsentInputModel.cs similarity index 88% rename from src/Services/Identity/eShopOnContainers.Identity/Models/ConsentInputModel.cs rename to src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/ConsentInputModel.cs index 7d327c553..033488e49 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/ConsentInputModel.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/ConsentInputModel.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; -namespace IdentityServer4.Quickstart.UI.Models +namespace eShopOnContainers.Identity.Models.AccountViewModels { public class ConsentInputModel { diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/ConsentViewModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/ConsentViewModel.cs similarity index 97% rename from src/Services/Identity/eShopOnContainers.Identity/Models/ConsentViewModel.cs rename to src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/ConsentViewModel.cs index 826454da2..3b9eb0891 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/ConsentViewModel.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/ConsentViewModel.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using IdentityServer4.Models; -namespace IdentityServer4.Quickstart.UI.Models +namespace eShopOnContainers.Identity.Models.AccountViewModels { public class ConsentViewModel : ConsentInputModel { diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/LoggedOutViewModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LoggedOutViewModel.cs similarity index 86% rename from src/Services/Identity/eShopOnContainers.Identity/Models/LoggedOutViewModel.cs rename to src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LoggedOutViewModel.cs index 2fa71ccf1..535710b3b 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/LoggedOutViewModel.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LoggedOutViewModel.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -namespace IdentityServer4.Quickstart.UI.Models +namespace eShopOnContainers.Identity.Models.AccountViewModels { public class LoggedOutViewModel { diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LoginViewModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LoginViewModel.cs index 44c440cc1..6e82f0315 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LoginViewModel.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LoginViewModel.cs @@ -1,8 +1,8 @@ -using System; -using System.Collections.Generic; +// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. +// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. + + using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace eShopOnContainers.Identity.Models.AccountViewModels { @@ -18,5 +18,6 @@ namespace eShopOnContainers.Identity.Models.AccountViewModels [Display(Name = "Remember me?")] public bool RememberMe { get; set; } + public string ReturnUrl { get; set; } } -} +} \ No newline at end of file diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/LogoutViewModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LogoutViewModel.cs similarity index 81% rename from src/Services/Identity/eShopOnContainers.Identity/Models/LogoutViewModel.cs rename to src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LogoutViewModel.cs index 031850a7e..15c0a5e0c 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/LogoutViewModel.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/LogoutViewModel.cs @@ -2,7 +2,7 @@ // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. -namespace IdentityServer4.Quickstart.UI.Models +namespace eShopOnContainers.Identity.Models.AccountViewModels { public class LogoutViewModel { diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/RegisterViewModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/RegisterViewModel.cs index b77e97fd6..31dcb8acb 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/RegisterViewModel.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/RegisterViewModel.cs @@ -23,5 +23,7 @@ namespace eShopOnContainers.Identity.Models.AccountViewModels [Display(Name = "Confirm password")] [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")] public string ConfirmPassword { get; set; } + + public ApplicationUser User { get; set; } } } diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/_LoginViewModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/_LoginViewModel.cs new file mode 100644 index 000000000..9c4505147 --- /dev/null +++ b/src/Services/Identity/eShopOnContainers.Identity/Models/AccountViewModels/_LoginViewModel.cs @@ -0,0 +1,20 @@ +// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. +// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. + + +using System.Collections.Generic; + +namespace eShopOnContainers.Identity.Models.AccountViewModels +{ + //public class _LoginViewModel : LoginViewModel + //{ + // public bool EnableLocalLogin { get; set; } + // public IEnumerable ExternalProviders { get; set; } + //} + + //public class ExternalProvider + //{ + // public string DisplayName { get; set; } + // public string AuthenticationScheme { get; set; } + //} +} \ No newline at end of file diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/LoginInputModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/LoginInputModel.cs deleted file mode 100644 index d0db93c6a..000000000 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/LoginInputModel.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. -// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. - - -using System.ComponentModel.DataAnnotations; - -namespace IdentityServer4.Quickstart.UI.Models -{ - public class LoginInputModel - { - [Required] - public string Username { get; set; } - [Required] - public string Password { get; set; } - public bool RememberLogin { get; set; } - public string ReturnUrl { get; set; } - } -} \ No newline at end of file diff --git a/src/Services/Identity/eShopOnContainers.Identity/Models/LoginViewModel.cs b/src/Services/Identity/eShopOnContainers.Identity/Models/LoginViewModel.cs deleted file mode 100644 index 23387832b..000000000 --- a/src/Services/Identity/eShopOnContainers.Identity/Models/LoginViewModel.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. -// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. - - -using System.Collections.Generic; - -namespace IdentityServer4.Quickstart.UI.Models -{ - public class LoginViewModel : LoginInputModel - { - public bool EnableLocalLogin { get; set; } - public IEnumerable ExternalProviders { get; set; } - } - - public class ExternalProvider - { - public string DisplayName { get; set; } - public string AuthenticationScheme { get; set; } - } -} \ No newline at end of file diff --git a/src/Services/Identity/eShopOnContainers.Identity/Startup.cs b/src/Services/Identity/eShopOnContainers.Identity/Startup.cs index 50fe05010..6275d9cd8 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Startup.cs +++ b/src/Services/Identity/eShopOnContainers.Identity/Startup.cs @@ -62,7 +62,7 @@ namespace eShopOnContainers.Identity .AddInMemoryScopes(Config.GetScopes()) .AddInMemoryClients(Config.GetClients()) .AddAspNetIdentity() - .Services.AddTransient(); + .Services.AddTransient(); //Configuration Settings: services.AddOptions(); diff --git a/src/Services/Identity/eShopOnContainers.Identity/Views/Account/LoggedOut.cshtml b/src/Services/Identity/eShopOnContainers.Identity/Views/Account/LoggedOut.cshtml index b6f2990a7..070397209 100644 --- a/src/Services/Identity/eShopOnContainers.Identity/Views/Account/LoggedOut.cshtml +++ b/src/Services/Identity/eShopOnContainers.Identity/Views/Account/LoggedOut.cshtml @@ -1,4 +1,4 @@ -@model IdentityServer4.Quickstart.UI.Models.LoggedOutViewModel +@model eShopOnContainers.Identity.Models.AccountViewModels.LoggedOutViewModel