From 4f6e6783992bbb97e4f1901a134cc07a317ed539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Drza=C5=82?= Date: Thu, 24 Jan 2019 19:00:28 +0100 Subject: [PATCH 001/131] Allowing for using email in addition to username --- .../Quickstart/Account/AccountController.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs index f31c5126a..41eedfc0b 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs @@ -5,6 +5,7 @@ // Modified by Jan Škoruba using System; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; using IdentityModel; @@ -105,10 +106,24 @@ public async Task Login(LoginInputModel model, string button) if (ModelState.IsValid) { - var result = await _signInManager.PasswordSignInAsync(model.Username, model.Password, model.RememberLogin, lockoutOnFailure: true); + var userName = model.Username; + var emailVerifier = new EmailAddressAttribute(); + // if supplied username is a valid email then try to find match as an email first + // remember to have RequireUniqueEmail set to true (by default it is) for this search to work + if (emailVerifier.IsValid(userName)) + { + var emailUser = await _userManager.FindByEmailAsync(userName); + // if match found then replace the email with actual username and proceed + if (emailUser != default(UserIdentity)) + { + userName = emailUser.UserName; + } + } + + var result = await _signInManager.PasswordSignInAsync(userName, model.Password, model.RememberLogin, lockoutOnFailure: true); if (result.Succeeded) { - var user = await _userManager.FindByNameAsync(model.Username); + var user = await _userManager.FindByNameAsync(userName); await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)); if (context != null) From 45f362890918428a434093a91a01aa3939601b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Drza=C5=82?= Date: Thu, 24 Jan 2019 19:14:03 +0100 Subject: [PATCH 002/131] One request less when user supplies email instead of username --- .../Quickstart/Account/AccountController.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs index 41eedfc0b..397b18e12 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs @@ -106,24 +106,29 @@ public async Task Login(LoginInputModel model, string button) if (ModelState.IsValid) { + var user = default(UserIdentity); var userName = model.Username; var emailVerifier = new EmailAddressAttribute(); // if supplied username is a valid email then try to find match as an email first // remember to have RequireUniqueEmail set to true (by default it is) for this search to work if (emailVerifier.IsValid(userName)) { - var emailUser = await _userManager.FindByEmailAsync(userName); + user = await _userManager.FindByEmailAsync(userName); // if match found then replace the email with actual username and proceed - if (emailUser != default(UserIdentity)) + if (user != default(UserIdentity)) { - userName = emailUser.UserName; + userName = user.UserName; } } var result = await _signInManager.PasswordSignInAsync(userName, model.Password, model.RememberLogin, lockoutOnFailure: true); if (result.Succeeded) { - var user = await _userManager.FindByNameAsync(userName); + if (user == default(UserIdentity)) + { + user = await _userManager.FindByNameAsync(userName); + } + await _events.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)); if (context != null) From 9061299c1e875e1c1d041ba38b781d6972327d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Drza=C5=82?= Date: Thu, 24 Jan 2019 19:17:13 +0100 Subject: [PATCH 003/131] Added clarifying comment --- .../Quickstart/Account/AccountController.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs index 397b18e12..ef4d6041b 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs @@ -124,6 +124,8 @@ public async Task Login(LoginInputModel model, string button) var result = await _signInManager.PasswordSignInAsync(userName, model.Password, model.RememberLogin, lockoutOnFailure: true); if (result.Succeeded) { + // this means we've succeeded with login but it was not email + // so we need to find the user by username if (user == default(UserIdentity)) { user = await _userManager.FindByNameAsync(userName); From bf6b5e7e561aa7b06c3364a856508a8366b47cac Mon Sep 17 00:00:00 2001 From: janskoruba Date: Sat, 26 Jan 2019 13:41:59 +0100 Subject: [PATCH 004/131] Add some initial views for profile management in STS --- .../Helpers/StartupHelpers.cs | 4 + .../Quickstart/Account/AccountController.cs | 138 +++++++- .../Quickstart/Account/ExternalController.cs | 25 +- .../Account/ForgotPasswordViewModel.cs | 11 + .../Account/ResetPasswordViewModel.cs | 22 ++ .../Manage/ChangePasswordViewModel.cs | 22 ++ .../Manage/DeletePersonalDataViewModel.cs | 13 + .../Quickstart/Manage/IndexViewModel.cs | 25 ++ .../Quickstart/Manage/ManageController.cs | 312 ++++++++++++++++++ .../Quickstart/Manage/SetPasswordViewModel.cs | 18 + .../Account/AccountController.en.resx | 123 +++++++ .../Manage/ManageController.en.resx | 147 +++++++++ .../Resources/Views/Account/Login.en.resx | 3 + .../Views/Manage/ChangePassword.en.resx | 135 ++++++++ .../Views/Manage/DeletePersonalData.en.resx | 132 ++++++++ .../Views/Manage/DownloadPersonalData.en.resx | 123 +++++++ .../Resources/Views/Manage/Index.en.resx | 138 ++++++++ .../Views/Manage/PersonalData.en.resx | 135 ++++++++ .../Views/Manage/SetPassword.en.resx | 135 ++++++++ .../Services/EmailSender.cs | 23 ++ .../Views/Account/ConfirmEmail.cshtml | 10 + .../Views/Account/ForgotPassword.cshtml | 23 ++ .../Account/ForgotPasswordConfirmation.cshtml | 10 + .../Views/Account/Login.cshtml | 1 + .../Views/Account/ResetPassword.cshtml | 40 +++ .../Account/ResetPasswordConfirmation.cshtml | 8 + .../Views/Manage/ChangePassword.cshtml | 36 ++ .../Views/Manage/DeletePersonalData.cshtml | 28 ++ .../Views/Manage/DownloadPersonalData.cshtml | 8 + .../Views/Manage/Index.cshtml | 41 +++ .../Views/Manage/PersonalData.cshtml | 25 ++ .../Views/Manage/SetPassword.cshtml | 31 ++ .../Views/Manage/_StatusMessage.cshtml | 10 + .../Views/Shared/_Layout.cshtml | 139 ++++---- .../appsettings.json | 2 +- 35 files changed, 2005 insertions(+), 91 deletions(-) create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ForgotPasswordViewModel.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ResetPasswordViewModel.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ChangePasswordViewModel.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/DeletePersonalDataViewModel.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/IndexViewModel.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ManageController.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/SetPasswordViewModel.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Account/AccountController.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Manage/ManageController.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/ChangePassword.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DeletePersonalData.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DownloadPersonalData.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/Index.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/PersonalData.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/SetPassword.en.resx create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Services/EmailSender.cs create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ConfirmEmail.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPasswordConfirmation.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPassword.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPasswordConfirmation.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/ChangePassword.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DeletePersonalData.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DownloadPersonalData.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/Index.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/PersonalData.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/SetPassword.cshtml create mode 100644 src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/_StatusMessage.cshtml diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Helpers/StartupHelpers.cs b/src/Skoruba.IdentityServer4.STS.Identity/Helpers/StartupHelpers.cs index 14b35ff73..b1cfd4809 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Helpers/StartupHelpers.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Helpers/StartupHelpers.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Razor; @@ -16,6 +17,7 @@ using Microsoft.Extensions.Options; using Serilog; using Skoruba.IdentityServer4.STS.Identity.Configuration.Constants; +using Skoruba.IdentityServer4.STS.Identity.Services; using ILogger = Microsoft.Extensions.Logging.ILogger; namespace Skoruba.IdentityServer4.STS.Identity.Helpers @@ -70,6 +72,8 @@ public static void AddAuthenticationServices() .AddDefaultTokenProviders(); + services.AddSingleton(); + services.Configure(iis => { iis.AuthenticationDisplayName = "Windows"; diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs index f31c5126a..602adf99f 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs @@ -6,6 +6,7 @@ using System; using System.Linq; +using System.Text.Encodings.Web; using System.Threading.Tasks; using IdentityModel; using IdentityServer4.Events; @@ -16,7 +17,9 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.UI.Services; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Localization; using Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Entities.Identity; namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account @@ -31,6 +34,8 @@ public class AccountController : Controller private readonly IClientStore _clientStore; private readonly IAuthenticationSchemeProvider _schemeProvider; private readonly IEventService _events; + private readonly IEmailSender _emailSender; + private readonly IStringLocalizer _localizer; public AccountController( UserManager userManager, @@ -38,7 +43,9 @@ public AccountController( IIdentityServerInteractionService interaction, IClientStore clientStore, IAuthenticationSchemeProvider schemeProvider, - IEventService events) + IEventService events, + IEmailSender emailSender, + IStringLocalizer localizer) { _userManager = userManager; _signInManager = signInManager; @@ -46,6 +53,8 @@ public AccountController( _clientStore = clientStore; _schemeProvider = schemeProvider; _events = events; + _emailSender = emailSender; + _localizer = localizer; } /// @@ -96,11 +105,9 @@ public async Task Login(LoginInputModel model, string button) return Redirect(model.ReturnUrl); } - else - { - // since we don't have a valid context, then we just go back to the home page - return Redirect("~/"); - } + + // since we don't have a valid context, then we just go back to the home page + return Redirect("~/"); } if (ModelState.IsValid) @@ -129,15 +136,14 @@ public async Task Login(LoginInputModel model, string button) { return Redirect(model.ReturnUrl); } - else if (string.IsNullOrEmpty(model.ReturnUrl)) + + if (string.IsNullOrEmpty(model.ReturnUrl)) { return Redirect("~/"); } - else - { - // user might have clicked on a malicious link - should be logged - throw new Exception("invalid return URL"); - } + + // user might have clicked on a malicious link - should be logged + throw new Exception("invalid return URL"); } await _events.RaiseAsync(new UserLoginFailureEvent(model.Username, "invalid credentials")); @@ -149,7 +155,7 @@ public async Task Login(LoginInputModel model, string button) return View(vm); } - + /// /// Show logout page /// @@ -203,7 +209,113 @@ public async Task Logout(LogoutInputModel model) return View("LoggedOut", vm); } + [HttpGet] + [AllowAnonymous] + public async Task ConfirmEmail(string userId, string code) + { + if (userId == null || code == null) + { + return View("Error"); + } + var user = await _userManager.FindByIdAsync(userId); + if (user == null) + { + return View("Error"); + } + var result = await _userManager.ConfirmEmailAsync(user, code); + return View(result.Succeeded ? "ConfirmEmail" : "Error"); + } + + [HttpGet] + [AllowAnonymous] + public IActionResult ForgotPassword() + { + return View(); + } + + [HttpPost] + [AllowAnonymous] + [ValidateAntiForgeryToken] + public async Task ForgotPassword(ForgotPasswordViewModel model) + { + if (ModelState.IsValid) + { + var user = await _userManager.FindByEmailAsync(model.Email); + + if (user == null || !await _userManager.IsEmailConfirmedAsync(user)) + { + ModelState.AddModelError(string.Empty, _localizer["EmailNotFound"]); + + return View(model); + } + + var code = await _userManager.GeneratePasswordResetTokenAsync(user); + var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code }, HttpContext.Request.Scheme); + + await _emailSender.SendEmailAsync(model.Email, "Reset Password", $"Please reset your password by clicking here."); + + + return View("ForgotPasswordConfirmation"); + } + + return View(model); + } + + [HttpGet] + [AllowAnonymous] + public IActionResult ResetPassword(string code = null) + { + return code == null ? View("Error") : View(); + } + + [HttpPost] + [AllowAnonymous] + [ValidateAntiForgeryToken] + public async Task ResetPassword(ResetPasswordViewModel model) + { + if (!ModelState.IsValid) + { + return View(model); + } + var user = await _userManager.FindByEmailAsync(model.Email); + if (user == null) + { + // Don't reveal that the user does not exist + return RedirectToAction(nameof(ResetPasswordConfirmation), "Account"); + } + var result = await _userManager.ResetPasswordAsync(user, model.Code, model.Password); + if (result.Succeeded) + { + return RedirectToAction(nameof(ResetPasswordConfirmation), "Account"); + } + AddErrors(result); + + return View(); + } + + [HttpGet] + [AllowAnonymous] + public IActionResult ResetPasswordConfirmation() + { + return View(); + } + + private void AddErrors(IdentityResult result) + { + foreach (var error in result.Errors) + { + ModelState.AddModelError(string.Empty, error.Description); + } + } + + + [HttpGet] + [AllowAnonymous] + public IActionResult ForgotPasswordConfirmation() + { + return View(); + } /*****************************************/ /* helper APIs for the AccountController */ diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalController.cs index 6dbf6bf95..14681be18 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalController.cs @@ -67,21 +67,19 @@ public async Task Challenge(string provider, string returnUrl) // windows authentication needs special handling return await ProcessWindowsLoginAsync(returnUrl); } - else + + // start challenge and roundtrip the return URL and scheme + var props = new AuthenticationProperties { - // start challenge and roundtrip the return URL and scheme - var props = new AuthenticationProperties + RedirectUri = Url.Action(nameof(Callback)), + Items = { - RedirectUri = Url.Action(nameof(Callback)), - Items = - { - { "returnUrl", returnUrl }, - { "scheme", provider }, - } - }; + { "returnUrl", returnUrl }, + { "scheme", provider }, + } + }; - return Challenge(props, provider); - } + return Challenge(props, provider); } /// @@ -268,8 +266,7 @@ private async Task AutoProvisionUserAsync(string provider, string return user; } - - + private void ProcessLoginCallbackForOidc(AuthenticateResult externalResult, List localClaims, AuthenticationProperties localSignInProps) { // if the external system sent a session id claim, copy it over diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ForgotPasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ForgotPasswordViewModel.cs new file mode 100644 index 000000000..6a35a2700 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ForgotPasswordViewModel.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +{ + public class ForgotPasswordViewModel + { + [Required] + [EmailAddress] + public string Email { get; set; } + } +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ResetPasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ResetPasswordViewModel.cs new file mode 100644 index 000000000..df79a7f2e --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ResetPasswordViewModel.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +{ + public class ResetPasswordViewModel + { + [Required] + [EmailAddress] + public string Email { get; set; } + + [Required] + [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] + [DataType(DataType.Password)] + public string Password { get; set; } + + [DataType(DataType.Password)] + [Compare("Password")] + public string ConfirmPassword { get; set; } + + public string Code { get; set; } + } +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ChangePasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ChangePasswordViewModel.cs new file mode 100644 index 000000000..de5adc0b1 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ChangePasswordViewModel.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +{ + public class ChangePasswordViewModel + { + [Required] + [DataType(DataType.Password)] + public string OldPassword { get; set; } + + [Required] + [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] + [DataType(DataType.Password)] + public string NewPassword { get; set; } + + [DataType(DataType.Password)] + [Compare("NewPassword")] + public string ConfirmPassword { get; set; } + + public string StatusMessage { get; set; } + } +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/DeletePersonalDataViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/DeletePersonalDataViewModel.cs new file mode 100644 index 000000000..614545972 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/DeletePersonalDataViewModel.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +{ + public class DeletePersonalDataViewModel + { + public bool RequirePassword { get; set; } + + [DataType(DataType.Password)] + [Required] + public string Password { get; set; } + } +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/IndexViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/IndexViewModel.cs new file mode 100644 index 000000000..bb332a82b --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/IndexViewModel.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; + +namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +{ + public class IndexViewModel + { + public string Username { get; set; } + + public bool IsEmailConfirmed { get; set; } + + [Required] + [EmailAddress] + public string Email { get; set; } + + [Phone] + [Display(Name = "Phone number")] + public string PhoneNumber { get; set; } + + public string StatusMessage { get; set; } + } +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ManageController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ManageController.cs new file mode 100644 index 000000000..c47a84be2 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ManageController.cs @@ -0,0 +1,312 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Encodings.Web; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Identity.UI.Services; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; +using Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Entities.Identity; + +namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +{ + public class ManageController : Controller + { + private readonly UserManager _userManager; + private readonly SignInManager _signInManager; + private readonly IEmailSender _emailSender; + private readonly ILogger _logger; + private readonly IStringLocalizer _localizer; + + [TempData] + public string StatusMessage { get; set; } + + public ManageController(UserManager userManager, SignInManager signInManager, IEmailSender emailSender, ILogger logger, IStringLocalizer localizer) + { + _userManager = userManager; + _signInManager = signInManager; + _emailSender = emailSender; + _logger = logger; + _localizer = localizer; + } + + [HttpGet] + public async Task Index() + { + var user = await _userManager.GetUserAsync(User); + + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var model = new IndexViewModel + { + Username = user.UserName, + Email = user.Email, + PhoneNumber = user.PhoneNumber, + IsEmailConfirmed = user.EmailConfirmed, + StatusMessage = StatusMessage + }; + + return View(model); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Index(IndexViewModel model) + { + if (!ModelState.IsValid) + { + return View(model); + } + + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var email = user.Email; + if (model.Email != email) + { + var setEmailResult = await _userManager.SetEmailAsync(user, model.Email); + if (!setEmailResult.Succeeded) + { + throw new ApplicationException($"Unexpected error occurred setting email for user with ID '{user.Id}'."); + } + } + + var phoneNumber = user.PhoneNumber; + if (model.PhoneNumber != phoneNumber) + { + var setPhoneResult = await _userManager.SetPhoneNumberAsync(user, model.PhoneNumber); + if (!setPhoneResult.Succeeded) + { + throw new ApplicationException($"Unexpected error occurred setting phone number for user with ID '{user.Id}'."); + } + } + + StatusMessage = _localizer["ProfileUpdated"]; + + return RedirectToAction(nameof(Index)); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task SendVerificationEmail(IndexViewModel model) + { + if (!ModelState.IsValid) + { + return View(model); + } + + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); + var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code }, HttpContext.Request.Scheme); + + await _emailSender.SendEmailAsync(model.Email, "Confirm your email", $"Please confirm your account by clicking here."); + + StatusMessage = _localizer["VerificationSent"]; + + return RedirectToAction(nameof(Index)); + } + + [HttpGet] + public async Task ChangePassword() + { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var hasPassword = await _userManager.HasPasswordAsync(user); + if (!hasPassword) + { + return RedirectToAction(nameof(SetPassword)); + } + + var model = new ChangePasswordViewModel { StatusMessage = StatusMessage }; + return View(model); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task ChangePassword(ChangePasswordViewModel model) + { + if (!ModelState.IsValid) + { + return View(model); + } + + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var changePasswordResult = await _userManager.ChangePasswordAsync(user, model.OldPassword, model.NewPassword); + if (!changePasswordResult.Succeeded) + { + AddErrors(changePasswordResult); + return View(model); + } + + await _signInManager.RefreshSignInAsync(user); + _logger.LogInformation(_localizer["PasswordChangedLog", user.UserName]); + + StatusMessage = _localizer["PasswordChanged"]; + + return RedirectToAction(nameof(ChangePassword)); + } + + [HttpGet] + public async Task SetPassword() + { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var hasPassword = await _userManager.HasPasswordAsync(user); + + if (hasPassword) + { + return RedirectToAction(nameof(ChangePassword)); + } + + var model = new SetPasswordViewModel { StatusMessage = StatusMessage }; + return View(model); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task SetPassword(SetPasswordViewModel model) + { + if (!ModelState.IsValid) + { + return View(model); + } + + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var addPasswordResult = await _userManager.AddPasswordAsync(user, model.NewPassword); + if (!addPasswordResult.Succeeded) + { + AddErrors(addPasswordResult); + return View(model); + } + + await _signInManager.RefreshSignInAsync(user); + StatusMessage = _localizer["PasswordSet"]; + + return RedirectToAction(nameof(SetPassword)); + } + + [HttpGet] + public async Task PersonalData() + { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + return View(); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task DownloadPersonalData() + { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + _logger.LogInformation(_localizer["AskForPersonalDataLog"], _userManager.GetUserId(User)); + + var personalDataProps = typeof(UserIdentity).GetProperties().Where(prop => Attribute.IsDefined(prop, typeof(PersonalDataAttribute))); + var personalData = personalDataProps.ToDictionary(p => p.Name, p => p.GetValue(user)?.ToString() ?? "null"); + + Response.Headers.Add("Content-Disposition", "attachment; filename=PersonalData.json"); + return new FileContentResult(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(personalData)), "text/json"); + } + + [HttpGet] + public async Task DeletePersonalData() + { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + var deletePersonalDataViewModel = new DeletePersonalDataViewModel + { + RequirePassword = await _userManager.HasPasswordAsync(user) + }; + + return View(deletePersonalDataViewModel); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task DeletePersonalData(DeletePersonalDataViewModel deletePersonalDataViewModel) + { + var user = await _userManager.GetUserAsync(User); + if (user == null) + { + return NotFound(_localizer["UserNotFound", _userManager.GetUserId(User)]); + } + + deletePersonalDataViewModel.RequirePassword = await _userManager.HasPasswordAsync(user); + if (deletePersonalDataViewModel.RequirePassword) + { + if (!await _userManager.CheckPasswordAsync(user, deletePersonalDataViewModel.Password)) + { + ModelState.AddModelError(string.Empty, _localizer["PasswordNotCorrect"]); + return View(deletePersonalDataViewModel); + } + } + + var result = await _userManager.DeleteAsync(user); + var userId = await _userManager.GetUserIdAsync(user); + if (!result.Succeeded) + { + throw new InvalidOperationException($"Unexpected error occurred deleting user with ID '{userId}'."); + } + + await _signInManager.SignOutAsync(); + + _logger.LogInformation(_localizer["DeletePersonalData"], userId); + + return Redirect("~/"); + } + + + 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/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/SetPasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/SetPasswordViewModel.cs new file mode 100644 index 000000000..6e86783f1 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/SetPasswordViewModel.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; + +namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +{ + public class SetPasswordViewModel + { + [Required] + [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] + [DataType(DataType.Password)] + public string NewPassword { get; set; } + + [DataType(DataType.Password)] + [Compare("NewPassword")] + public string ConfirmPassword { get; set; } + + public string StatusMessage { get; set; } + } +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Account/AccountController.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Account/AccountController.en.resx new file mode 100644 index 000000000..60a369aff --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Account/AccountController.en.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + The user does not exist or is not confirmed + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Manage/ManageController.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Manage/ManageController.en.resx new file mode 100644 index 000000000..cdd5f8513 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Manage/ManageController.en.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + User with ID '{0}' asked for their personal data. + + + User with ID '{0}' deleted themselves. + + + Your password has been changed. + + + User {0} changed their password successfully. + + + Password not correct. + + + Your password has been set. + + + Your profile has been updated + + + Unable to load user with ID {0}. + + + Verification email sent. Please check your email. + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Account/Login.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Account/Login.en.resx index 229b87538..89e1293a6 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Account/Login.en.resx +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Account/Login.en.resx @@ -123,6 +123,9 @@ External Login + + Forgot password + Invalid login request diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/ChangePassword.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/ChangePassword.en.resx new file mode 100644 index 000000000..9cb33bd67 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/ChangePassword.en.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Confirm Password + + + New Password + + + Old Password + + + Change password + + + Update Password + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DeletePersonalData.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DeletePersonalData.en.resx new file mode 100644 index 000000000..3c58ac13f --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DeletePersonalData.en.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Deleting this data will permanently remove your account, and this cannot be recovered. + + + Delete data and close my account + + + Password + + + Delete Personal Data + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DownloadPersonalData.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DownloadPersonalData.en.resx new file mode 100644 index 000000000..e30627773 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/DownloadPersonalData.en.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Download Your Data + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/Index.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/Index.en.resx new file mode 100644 index 000000000..6777407bf --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/Index.en.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Email + + + Phone Number + + + Save + + + Send verification email + + + Profile + + + UserName + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/PersonalData.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/PersonalData.en.resx new file mode 100644 index 000000000..e2ae84719 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/PersonalData.en.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Delete + + + Download + + + Your account contains personal data that you have given us. This page allows you to download or delete that data. + + + Personal Data + + + Deleting this data will permanently remove your account, and this cannot be recovered. + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/SetPassword.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/SetPassword.en.resx new file mode 100644 index 000000000..d309fb12c --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Views/Manage/SetPassword.en.resx @@ -0,0 +1,135 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Confirm Password + + + You do not have a local username/password for this site. Add a local account so you can log in without an external login. + + + New Password + + + Set Password + + + Set password + + \ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Services/EmailSender.cs b/src/Skoruba.IdentityServer4.STS.Identity/Services/EmailSender.cs new file mode 100644 index 000000000..fdfeb995b --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Services/EmailSender.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity.UI.Services; +using Microsoft.Extensions.Logging; + +namespace Skoruba.IdentityServer4.STS.Identity.Services +{ + public class EmailSender : IEmailSender + { + private readonly ILogger _logger; + + public EmailSender(ILogger logger) + { + _logger = logger; + } + + public Task SendEmailAsync(string email, string subject, string htmlMessage) + { + _logger.LogInformation($"Email: {email}, subject: {subject}, message: {htmlMessage}"); + + return Task.FromResult(0); + } + } +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ConfirmEmail.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ConfirmEmail.cshtml new file mode 100644 index 000000000..824f606d8 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ConfirmEmail.cshtml @@ -0,0 +1,10 @@ +@{ + ViewData["Title"] = "Confirm email"; +} + +

@ViewData["Title"]

+
+

+ Thank you for confirming your email. +

+
diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml new file mode 100644 index 000000000..394b5be08 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml @@ -0,0 +1,23 @@ +@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Account.ForgotPasswordViewModel +@{ + ViewData["Title"] = "Forgot your password?"; +} + +

@ViewData["Title"]

+

Enter your email.

+ +@await Html.PartialAsync("_ValidationSummary") + +
+
+
+
+
+ + + +
+ +
+
+
\ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPasswordConfirmation.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPasswordConfirmation.cshtml new file mode 100644 index 000000000..3c0be5ca4 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPasswordConfirmation.cshtml @@ -0,0 +1,10 @@ +@{ + ViewData["Title"] = "Forgot password confirmation"; +} + +

@ViewData["Title"]

+ + + diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml index 8290cc7fe..2288190f2 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml @@ -66,6 +66,7 @@
+ @Localizer["Forgot"]
diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPassword.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPassword.cshtml new file mode 100644 index 000000000..bf77a165b --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPassword.cshtml @@ -0,0 +1,40 @@ +@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Account.ResetPasswordViewModel +@{ + ViewData["Title"] = "Reset password"; +} + +

@ViewData["Title"]

+ +@await Html.PartialAsync("_ValidationSummary") + +
+

Reset your password.

+
+ +
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+
+ +
+
+
diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPasswordConfirmation.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPasswordConfirmation.cshtml new file mode 100644 index 000000000..d0edc5fd6 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ResetPasswordConfirmation.cshtml @@ -0,0 +1,8 @@ +@{ + ViewData["Title"] = "Reset password confirmation"; +} + +

@ViewData["Title"]

+

+ Your password has been reset. Please click here to log in. +

\ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/ChangePassword.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/ChangePassword.cshtml new file mode 100644 index 000000000..939613a75 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/ChangePassword.cshtml @@ -0,0 +1,36 @@ +@inject IViewLocalizer Localizer +@using Microsoft.AspNetCore.Mvc.Localization +@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage.ChangePasswordViewModel +@{ + ViewData["Title"] = Localizer["Title"]; +} + +

@ViewData["Title"]

+ +@await Html.PartialAsync("_ValidationSummary") + +@await Html.PartialAsync("_StatusMessage", Model.StatusMessage) + +
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+ +
+
+
diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DeletePersonalData.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DeletePersonalData.cshtml new file mode 100644 index 000000000..57797c651 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DeletePersonalData.cshtml @@ -0,0 +1,28 @@ +@inject IViewLocalizer Localizer +@using Microsoft.AspNetCore.Mvc.Localization +@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage.DeletePersonalDataViewModel +@{ + ViewData["Title"] = Localizer["Title"]; +} + +

@ViewData["Title"]

+ + + +
+
+
+ @if (Model.RequirePassword) + { +
+ + + +
+ } + +
+
\ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DownloadPersonalData.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DownloadPersonalData.cshtml new file mode 100644 index 000000000..6655a7279 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/DownloadPersonalData.cshtml @@ -0,0 +1,8 @@ +@inject IViewLocalizer Localizer +@using Microsoft.AspNetCore.Mvc.Localization + +@{ + ViewData["Title"] = Localizer["Title"]; +} + +

@ViewData["Title"]

\ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/Index.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/Index.cshtml new file mode 100644 index 000000000..b9a8a6113 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/Index.cshtml @@ -0,0 +1,41 @@ +@inject IViewLocalizer Localizer +@using Microsoft.AspNetCore.Mvc.Localization +@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage.IndexViewModel + +

@Localizer["Title"]

+ +@await Html.PartialAsync("_ValidationSummary") + +@await Html.PartialAsync("_StatusMessage", Model.StatusMessage) +
+
+
+
+ + +
+
+ + + @if (Model.IsEmailConfirmed) + { +
+ +
+ } + else + { + + + } + +
+
+ + + +
+ +
+
+
\ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/PersonalData.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/PersonalData.cshtml new file mode 100644 index 000000000..c7b41a563 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/PersonalData.cshtml @@ -0,0 +1,25 @@ +@inject IViewLocalizer Localizer +@using Microsoft.AspNetCore.Mvc.Localization + +@{ + ViewData["Title"] = Localizer["Title"]; +} + +

@ViewData["Title"]

+ +
+
+ +
+ +
+ + +
+
\ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/SetPassword.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/SetPassword.cshtml new file mode 100644 index 000000000..45ddd79b0 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/SetPassword.cshtml @@ -0,0 +1,31 @@ +@inject IViewLocalizer Localizer +@using Microsoft.AspNetCore.Mvc.Localization +@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage.SetPasswordViewModel +@{ + ViewData["Title"] = Localizer["Title"]; +} + +

Set your password

+@await Html.PartialAsync("_StatusMessage", Model.StatusMessage) + +

+ @Localizer["Info"] +

+
+
+
+
+
+ + + +
+
+ + + +
+ +
+
+
\ No newline at end of file diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/_StatusMessage.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/_StatusMessage.cshtml new file mode 100644 index 000000000..092bf1741 --- /dev/null +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Manage/_StatusMessage.cshtml @@ -0,0 +1,10 @@ +@model string + +@if (!String.IsNullOrEmpty(Model)) +{ + var statusMessageClass = Model.StartsWith("Error") ? "danger" : "success"; + +} diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Shared/_Layout.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Shared/_Layout.cshtml index c20122aed..c09d036e0 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Views/Shared/_Layout.cshtml +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Shared/_Layout.cshtml @@ -2,84 +2,97 @@ @using Microsoft.AspNetCore.Mvc.Localization @inject IViewLocalizer Localizer @{ - string name = null; - if (!true.Equals(ViewData["signed-out"])) - { - name = Context.User?.GetDisplayName(); - } + string name = null; + if (!true.Equals(ViewData["signed-out"])) + { + name = Context.User?.GetDisplayName(); + } } - - - - @Localizer["PageTitle"] - - + + + + @Localizer["PageTitle"] + + - - - - - - - - + + + + + + + + - @RenderSection("styles", required: false) + @RenderSection("styles", required: false) - - - - - - - +
+ @RenderBody() - @RenderSection("scripts", required: false) +
+
+
+ @Localizer["Footer"] + @Localizer["FooterCopyright"] +
+
+ @await Html.PartialAsync("Common/SelectLanguage") +
+
+
+
+ + + + + + + + + @RenderSection("scripts", required: false) diff --git a/src/Skoruba.IdentityServer4.STS.Identity/appsettings.json b/src/Skoruba.IdentityServer4.STS.Identity/appsettings.json index dbde81225..7a6098758 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/appsettings.json +++ b/src/Skoruba.IdentityServer4.STS.Identity/appsettings.json @@ -3,7 +3,7 @@ "AdminConnection": "Server=(localdb)\\mssqllocaldb;Database=IdentityServer4Admin;Trusted_Connection=True;MultipleActiveResultSets=true" }, "Serilog": { - "MinimumLevel": "Error", + "MinimumLevel": "Information", "WriteTo": [ { "Name": "File", From d9bda8bf9f4684ff00671e090095ea52100746c3 Mon Sep 17 00:00:00 2001 From: janskoruba Date: Sat, 26 Jan 2019 14:05:42 +0100 Subject: [PATCH 005/131] Reorganize the STS project strukture - move files from Quickstart folder into separated folders. --- .../Account => Configuration}/AccountOptions.cs | 2 +- .../Consent => Configuration}/ConsentOptions.cs | 2 +- .../Account => Controllers}/AccountController.cs | 5 ++++- .../Consent => Controllers}/ConsentController.cs | 7 +++++-- .../Device => Controllers}/DeviceController.cs | 7 +++++-- .../Diagnostics => Controllers}/DiagnosticsController.cs | 4 +++- .../Account => Controllers}/ExternalController.cs | 4 +++- .../Grants => Controllers}/GrantsController.cs | 4 +++- .../{Quickstart/Home => Controllers}/HomeController.cs | 4 +++- .../Manage => Controllers}/ManageController.cs | 4 ++-- .../{Quickstart => Helpers}/Extensions.cs | 2 +- .../{Quickstart => Helpers}/SecurityHeadersAttribute.cs | 2 +- .../Account => Controllers}/AccountController.en.resx | 0 .../Manage => Controllers}/ManageController.en.resx | 0 .../Account/ExternalProvider.cs | 2 +- .../Account/ForgotPasswordViewModel.cs | 2 +- .../Account/LoggedOutViewModel.cs | 2 +- .../{Quickstart => ViewModels}/Account/LoginInputModel.cs | 2 +- .../{Quickstart => ViewModels}/Account/LoginViewModel.cs | 2 +- .../Account/LogoutInputModel.cs | 2 +- .../{Quickstart => ViewModels}/Account/LogoutViewModel.cs | 2 +- .../Account/RedirectViewModel.cs | 2 +- .../Account/ResetPasswordViewModel.cs | 2 +- .../Consent/ConsentInputModel.cs | 2 +- .../Consent/ConsentViewModel.cs | 2 +- .../Consent/ProcessConsentResult.cs | 2 +- .../{Quickstart => ViewModels}/Consent/ScopeViewModel.cs | 2 +- .../Device/DeviceAuthorizationInputModel.cs | 4 ++-- .../Device/DeviceAuthorizationViewModel.cs | 4 ++-- .../Diagnostics/DiagnosticsViewModel.cs | 2 +- .../{Quickstart => ViewModels}/Grants/GrantsViewModel.cs | 2 +- .../{Quickstart => ViewModels}/Home/ErrorViewModel.cs | 2 +- .../Manage/ChangePasswordViewModel.cs | 2 +- .../Manage/DeletePersonalDataViewModel.cs | 2 +- .../{Quickstart => ViewModels}/Manage/IndexViewModel.cs | 8 ++------ .../Manage/SetPasswordViewModel.cs | 2 +- .../Views/Account/ForgotPassword.cshtml | 2 +- .../Views/Account/LoggedOut.cshtml | 2 +- .../Views/Account/Login.cshtml | 2 +- .../Views/Account/Logout.cshtml | 2 +- .../Views/Account/ResetPassword.cshtml | 2 +- .../Views/Consent/Index.cshtml | 2 +- .../Views/Device/UserCodeConfirmation.cshtml | 2 +- .../Views/Diagnostics/Index.cshtml | 2 +- .../Views/Grants/Index.cshtml | 3 +-- .../Views/Manage/ChangePassword.cshtml | 2 +- .../Views/Manage/DeletePersonalData.cshtml | 2 +- .../Views/Manage/Index.cshtml | 2 +- .../Views/Manage/SetPassword.cshtml | 2 +- .../Views/Shared/Error.cshtml | 2 +- .../Views/Shared/Redirect.cshtml | 2 +- .../Views/Shared/_ScopeListItem.cshtml | 2 +- 52 files changed, 73 insertions(+), 61 deletions(-) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Account => Configuration}/AccountOptions.cs (94%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Consent => Configuration}/ConsentOptions.cs (92%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Account => Controllers}/AccountController.cs (98%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Consent => Controllers}/ConsentController.cs (97%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Device => Controllers}/DeviceController.cs (96%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Diagnostics => Controllers}/DiagnosticsController.cs (85%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Account => Controllers}/ExternalController.cs (98%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Grants => Controllers}/GrantsController.cs (94%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Home => Controllers}/HomeController.cs (91%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart/Manage => Controllers}/ManageController.cs (98%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => Helpers}/Extensions.cs (94%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => Helpers}/SecurityHeadersAttribute.cs (97%) rename src/Skoruba.IdentityServer4.STS.Identity/Resources/{Quickstart/Account => Controllers}/AccountController.en.resx (100%) rename src/Skoruba.IdentityServer4.STS.Identity/Resources/{Quickstart/Manage => Controllers}/ManageController.en.resx (100%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/ExternalProvider.cs (87%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/ForgotPasswordViewModel.cs (75%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/LoggedOutViewModel.cs (92%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/LoginInputModel.cs (90%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/LoginViewModel.cs (94%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/LogoutInputModel.cs (85%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/LogoutViewModel.cs (86%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/RedirectViewModel.cs (85%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Account/ResetPasswordViewModel.cs (90%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Consent/ConsentInputModel.cs (90%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Consent/ConsentViewModel.cs (92%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Consent/ProcessConsentResult.cs (91%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Consent/ScopeViewModel.cs (90%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Device/DeviceAuthorizationInputModel.cs (76%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Device/DeviceAuthorizationViewModel.cs (78%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Diagnostics/DiagnosticsViewModel.cs (94%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Grants/GrantsViewModel.cs (93%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Home/ErrorViewModel.cs (86%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Manage/ChangePasswordViewModel.cs (90%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Manage/DeletePersonalDataViewModel.cs (80%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Manage/IndexViewModel.cs (65%) rename src/Skoruba.IdentityServer4.STS.Identity/{Quickstart => ViewModels}/Manage/SetPasswordViewModel.cs (88%) diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountOptions.cs b/src/Skoruba.IdentityServer4.STS.Identity/Configuration/AccountOptions.cs similarity index 94% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountOptions.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Configuration/AccountOptions.cs index 5dc790506..f3ee14afb 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountOptions.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Configuration/AccountOptions.cs @@ -6,7 +6,7 @@ using System; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.Configuration { public class AccountOptions { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentOptions.cs b/src/Skoruba.IdentityServer4.STS.Identity/Configuration/ConsentOptions.cs similarity index 92% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentOptions.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Configuration/ConsentOptions.cs index de2ceac7a..af8ac4fec 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentOptions.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Configuration/ConsentOptions.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan Škoruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent +namespace Skoruba.IdentityServer4.STS.Identity.Configuration { public class ConsentOptions { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/AccountController.cs similarity index 98% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/AccountController.cs index 602adf99f..d5928fe75 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/AccountController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/AccountController.cs @@ -21,8 +21,11 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Localization; using Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Entities.Identity; +using Skoruba.IdentityServer4.STS.Identity.Configuration; +using Skoruba.IdentityServer4.STS.Identity.Helpers; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Account; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { [SecurityHeaders] [AllowAnonymous] diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/ConsentController.cs similarity index 97% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/ConsentController.cs index 517f7d2b6..6ee3ad7ce 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/ConsentController.cs @@ -14,9 +14,12 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Skoruba.IdentityServer4.STS.Identity.Quickstart.Account; +using Skoruba.IdentityServer4.STS.Identity.Configuration; +using Skoruba.IdentityServer4.STS.Identity.Helpers; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Account; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { /// /// This controller processes the consent UI diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/DeviceController.cs similarity index 96% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/DeviceController.cs index 33ee0359d..ec84eea39 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/DeviceController.cs @@ -15,9 +15,12 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; -using Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent; +using Skoruba.IdentityServer4.STS.Identity.Configuration; +using Skoruba.IdentityServer4.STS.Identity.Helpers; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Device; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Device +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { [Authorize] [SecurityHeaders] diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Diagnostics/DiagnosticsController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/DiagnosticsController.cs similarity index 85% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Diagnostics/DiagnosticsController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/DiagnosticsController.cs index b92aa70d7..355f6fad1 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Diagnostics/DiagnosticsController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/DiagnosticsController.cs @@ -9,8 +9,10 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Skoruba.IdentityServer4.STS.Identity.Helpers; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Diagnostics; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Diagnostics +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { [SecurityHeaders] [Authorize] diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/ExternalController.cs similarity index 98% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/ExternalController.cs index 14681be18..303317003 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/ExternalController.cs @@ -20,8 +20,10 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Entities.Identity; +using Skoruba.IdentityServer4.STS.Identity.Configuration; +using Skoruba.IdentityServer4.STS.Identity.Helpers; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { [SecurityHeaders] [AllowAnonymous] diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Grants/GrantsController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/GrantsController.cs similarity index 94% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Grants/GrantsController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/GrantsController.cs index 56c690afe..aef46f3b2 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Grants/GrantsController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/GrantsController.cs @@ -11,8 +11,10 @@ using IdentityServer4.Stores; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Skoruba.IdentityServer4.STS.Identity.Helpers; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Grants; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Grants +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { /// /// This sample controller allows a user to revoke grants given to clients diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Home/HomeController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/HomeController.cs similarity index 91% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Home/HomeController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/HomeController.cs index 5d20527e2..5d0d2936d 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Home/HomeController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/HomeController.cs @@ -10,8 +10,10 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; +using Skoruba.IdentityServer4.STS.Identity.Helpers; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Home; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Home +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { [SecurityHeaders] public class HomeController : Controller diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ManageController.cs b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/ManageController.cs similarity index 98% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ManageController.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Controllers/ManageController.cs index c47a84be2..19499dc87 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ManageController.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Controllers/ManageController.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.Encodings.Web; @@ -11,8 +10,9 @@ using Microsoft.Extensions.Logging; using Newtonsoft.Json; using Skoruba.IdentityServer4.Admin.EntityFramework.Identity.Entities.Identity; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Manage; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +namespace Skoruba.IdentityServer4.STS.Identity.Controllers { public class ManageController : Controller { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Extensions.cs b/src/Skoruba.IdentityServer4.STS.Identity/Helpers/Extensions.cs similarity index 94% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Extensions.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Helpers/Extensions.cs index 27540ea7b..239b53d46 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Extensions.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Helpers/Extensions.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; using IdentityServer4.Stores; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart +namespace Skoruba.IdentityServer4.STS.Identity.Helpers { public static class Extensions { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/SecurityHeadersAttribute.cs b/src/Skoruba.IdentityServer4.STS.Identity/Helpers/SecurityHeadersAttribute.cs similarity index 97% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/SecurityHeadersAttribute.cs rename to src/Skoruba.IdentityServer4.STS.Identity/Helpers/SecurityHeadersAttribute.cs index e143c23be..780280685 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/SecurityHeadersAttribute.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/Helpers/SecurityHeadersAttribute.cs @@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart +namespace Skoruba.IdentityServer4.STS.Identity.Helpers { public class SecurityHeadersAttribute : ActionFilterAttribute { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Account/AccountController.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Controllers/AccountController.en.resx similarity index 100% rename from src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Account/AccountController.en.resx rename to src/Skoruba.IdentityServer4.STS.Identity/Resources/Controllers/AccountController.en.resx diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Manage/ManageController.en.resx b/src/Skoruba.IdentityServer4.STS.Identity/Resources/Controllers/ManageController.en.resx similarity index 100% rename from src/Skoruba.IdentityServer4.STS.Identity/Resources/Quickstart/Manage/ManageController.en.resx rename to src/Skoruba.IdentityServer4.STS.Identity/Resources/Controllers/ManageController.en.resx diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalProvider.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ExternalProvider.cs similarity index 87% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalProvider.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ExternalProvider.cs index 647303dff..46c2c1f2b 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ExternalProvider.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ExternalProvider.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Samples // Modified by Jan Škoruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class ExternalProvider { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ForgotPasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ForgotPasswordViewModel.cs similarity index 75% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ForgotPasswordViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ForgotPasswordViewModel.cs index 6a35a2700..66fecfbae 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ForgotPasswordViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ForgotPasswordViewModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class ForgotPasswordViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoggedOutViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoggedOutViewModel.cs similarity index 92% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoggedOutViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoggedOutViewModel.cs index d00c95cc8..7fc2d600c 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoggedOutViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoggedOutViewModel.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan Škoruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class LoggedOutViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoginInputModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoginInputModel.cs similarity index 90% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoginInputModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoginInputModel.cs index b5bf4e01c..8f64052e6 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoginInputModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoginInputModel.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class LoginInputModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoginViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoginViewModel.cs similarity index 94% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoginViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoginViewModel.cs index dbc69a9e9..1b9b776fa 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LoginViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LoginViewModel.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Linq; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class LoginViewModel : LoginInputModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LogoutInputModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LogoutInputModel.cs similarity index 85% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LogoutInputModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LogoutInputModel.cs index dfe8c80be..4a8bb612e 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LogoutInputModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LogoutInputModel.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan Škoruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class LogoutInputModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LogoutViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LogoutViewModel.cs similarity index 86% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LogoutViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LogoutViewModel.cs index 8b6307184..c83263c01 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/LogoutViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/LogoutViewModel.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan Škoruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class LogoutViewModel : LogoutInputModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/RedirectViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/RedirectViewModel.cs similarity index 85% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/RedirectViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/RedirectViewModel.cs index aa0af4a37..f9acc3cf8 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/RedirectViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/RedirectViewModel.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan �koruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class RedirectViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ResetPasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ResetPasswordViewModel.cs similarity index 90% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ResetPasswordViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ResetPasswordViewModel.cs index df79a7f2e..cd39c757d 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Account/ResetPasswordViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Account/ResetPasswordViewModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Account +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Account { public class ResetPasswordViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentInputModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ConsentInputModel.cs similarity index 90% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentInputModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ConsentInputModel.cs index f2a838574..939687d35 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentInputModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ConsentInputModel.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent { public class ConsentInputModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ConsentViewModel.cs similarity index 92% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ConsentViewModel.cs index 6408db722..b43ad0824 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ConsentViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ConsentViewModel.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent { public class ConsentViewModel : ConsentInputModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ProcessConsentResult.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ProcessConsentResult.cs similarity index 91% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ProcessConsentResult.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ProcessConsentResult.cs index b03e172f4..18c5879b9 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ProcessConsentResult.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ProcessConsentResult.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan �koruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent { public class ProcessConsentResult { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ScopeViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ScopeViewModel.cs similarity index 90% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ScopeViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ScopeViewModel.cs index 6eed2c907..133a4e3aa 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Consent/ScopeViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Consent/ScopeViewModel.cs @@ -4,7 +4,7 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan Škoruba -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent { public class ScopeViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceAuthorizationInputModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Device/DeviceAuthorizationInputModel.cs similarity index 76% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceAuthorizationInputModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Device/DeviceAuthorizationInputModel.cs index 25173d2dc..e5c7d2b23 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceAuthorizationInputModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Device/DeviceAuthorizationInputModel.cs @@ -4,9 +4,9 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan �koruba -using Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Device +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Device { public class DeviceAuthorizationInputModel : ConsentInputModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceAuthorizationViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Device/DeviceAuthorizationViewModel.cs similarity index 78% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceAuthorizationViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Device/DeviceAuthorizationViewModel.cs index 0cdb71517..0084583ee 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Device/DeviceAuthorizationViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Device/DeviceAuthorizationViewModel.cs @@ -4,9 +4,9 @@ // Original file: https://github.com/IdentityServer/IdentityServer4.Quickstart.UI // Modified by Jan �koruba -using Skoruba.IdentityServer4.STS.Identity.Quickstart.Consent; +using Skoruba.IdentityServer4.STS.Identity.ViewModels.Consent; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Device +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Device { public class DeviceAuthorizationViewModel : ConsentViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Diagnostics/DiagnosticsViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Diagnostics/DiagnosticsViewModel.cs similarity index 94% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Diagnostics/DiagnosticsViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Diagnostics/DiagnosticsViewModel.cs index 927d5e90f..e795c5c9f 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Diagnostics/DiagnosticsViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Diagnostics/DiagnosticsViewModel.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Authentication; using Newtonsoft.Json; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Diagnostics +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Diagnostics { public class DiagnosticsViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Grants/GrantsViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Grants/GrantsViewModel.cs similarity index 93% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Grants/GrantsViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Grants/GrantsViewModel.cs index 93aa59a53..465a4721f 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Grants/GrantsViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Grants/GrantsViewModel.cs @@ -7,7 +7,7 @@ using System; using System.Collections.Generic; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Grants +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Grants { public class GrantsViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Home/ErrorViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Home/ErrorViewModel.cs similarity index 86% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Home/ErrorViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Home/ErrorViewModel.cs index 0904c15bd..0a4a45500 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Home/ErrorViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Home/ErrorViewModel.cs @@ -6,7 +6,7 @@ using IdentityServer4.Models; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Home +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Home { public class ErrorViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ChangePasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/ChangePasswordViewModel.cs similarity index 90% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ChangePasswordViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/ChangePasswordViewModel.cs index de5adc0b1..f03ddf1b8 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/ChangePasswordViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/ChangePasswordViewModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Manage { public class ChangePasswordViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/DeletePersonalDataViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/DeletePersonalDataViewModel.cs similarity index 80% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/DeletePersonalDataViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/DeletePersonalDataViewModel.cs index 614545972..3e1f16f8a 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/DeletePersonalDataViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/DeletePersonalDataViewModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Manage { public class DeletePersonalDataViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/IndexViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/IndexViewModel.cs similarity index 65% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/IndexViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/IndexViewModel.cs index bb332a82b..3e6ec0c73 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/IndexViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/IndexViewModel.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Manage { public class IndexViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/SetPasswordViewModel.cs b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/SetPasswordViewModel.cs similarity index 88% rename from src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/SetPasswordViewModel.cs rename to src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/SetPasswordViewModel.cs index 6e86783f1..94538f0c6 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Quickstart/Manage/SetPasswordViewModel.cs +++ b/src/Skoruba.IdentityServer4.STS.Identity/ViewModels/Manage/SetPasswordViewModel.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace Skoruba.IdentityServer4.STS.Identity.Quickstart.Manage +namespace Skoruba.IdentityServer4.STS.Identity.ViewModels.Manage { public class SetPasswordViewModel { diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml index 394b5be08..d912dd39a 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/ForgotPassword.cshtml @@ -1,4 +1,4 @@ -@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Account.ForgotPasswordViewModel +@model Skoruba.IdentityServer4.STS.Identity.ViewModels.Account.ForgotPasswordViewModel @{ ViewData["Title"] = "Forgot your password?"; } diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/LoggedOut.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/LoggedOut.cshtml index 197233124..6df8e74c3 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/LoggedOut.cshtml +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/LoggedOut.cshtml @@ -1,6 +1,6 @@ @using Microsoft.AspNetCore.Mvc.Localization @inject IViewLocalizer Localizer -@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Account.LoggedOutViewModel +@model Skoruba.IdentityServer4.STS.Identity.ViewModels.Account.LoggedOutViewModel @{ // set this so the layout rendering sees an anonymous user diff --git a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml index 2288190f2..6ad1c0375 100644 --- a/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml +++ b/src/Skoruba.IdentityServer4.STS.Identity/Views/Account/Login.cshtml @@ -1,6 +1,6 @@ @using Microsoft.AspNetCore.Mvc.Localization @inject IViewLocalizer Localizer -@model Skoruba.IdentityServer4.STS.Identity.Quickstart.Account.LoginViewModel +@model Skoruba.IdentityServer4.STS.Identity.ViewModels.Account.LoginViewModel