You do not have access to this resource.
++ Thank you for confirming your email. +
++ You've successfully authenticated with @Model.LoginProvider. + Please enter an email address for this site below and click the Register button to finish + logging in. +
+ ++ Please check your email to reset your password. +
diff --git a/samples/Identity.ExternalClaims/Pages/Account/ForgotPasswordConfirmation.cshtml.cs b/samples/Identity.ExternalClaims/Pages/Account/ForgotPasswordConfirmation.cshtml.cs new file mode 100644 index 0000000000..c6594796aa --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Account/ForgotPasswordConfirmation.cshtml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Identity.ExternalClaims.Pages.Account +{ + public class ForgotPasswordConfirmation : PageModel + { + public void OnGet() + { + + } + } +} diff --git a/samples/Identity.ExternalClaims/Pages/Account/Lockout.cshtml b/samples/Identity.ExternalClaims/Pages/Account/Lockout.cshtml new file mode 100644 index 0000000000..4eded88208 --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Account/Lockout.cshtml @@ -0,0 +1,10 @@ +@page +@model LockoutModel +@{ + ViewData["Title"] = "Locked out"; +} + +This account has been locked out, please try again later.
++ There are no external authentication services configured. See this article + for details on setting up this ASP.NET application to support logging in via external services. +
+Your login is protected with an authenticator app. Enter your authenticator code below.
++ Don't have access to your authenticator device? You can + log in with a recovery code. +
+ +@section Scripts { + @await Html.PartialAsync("_ValidationScriptsPartial") +} \ No newline at end of file diff --git a/samples/Identity.ExternalClaims/Pages/Account/LoginWith2fa.cshtml.cs b/samples/Identity.ExternalClaims/Pages/Account/LoginWith2fa.cshtml.cs new file mode 100644 index 0000000000..d4a5426000 --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Account/LoginWith2fa.cshtml.cs @@ -0,0 +1,95 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Logging; +using Identity.ExternalClaims.Data; + +namespace Identity.ExternalClaims.Pages.Account +{ + public class LoginWith2faModel : PageModel + { + private readonly SignInManager+ You have requested to log in with a recovery code. This login will not be remembered until you provide + an authenticator app code at log in or disable 2FA and log in again. +
++ + This action only disables 2FA. +
++ Disabling 2FA does not change the keys used in authenticator apps. If you wish to change the key + used in an authenticator app you should reset your authenticator keys. +
+To use an authenticator app go through the following steps:
++ Download a two-factor authenticator app like Microsoft Authenticator for + Windows Phone, + Android and + iOS or + Google Authenticator for + Android and + iOS. +
+Scan the QR Code or enter this key @Model.SharedKey into your two factor authenticator app. Spaces and casing do not matter.
++ Once you have scanned the QR code or input the key above, your two factor authentication app will provide you + with a unique code. Enter the code in the confirmation box below. +
+| @login.LoginProvider | ++ @if (Model.ShowRemoveButton) + { + + } + else + { + @: + } + | +
+ + Put these codes in a safe place. +
++ If you lose your device and don't have the recovery codes you will lose access to your account. +
+@Model.RecoveryCodes[row]@Model.RecoveryCodes[row + 1]+ + If you reset your authenticator key your authenticator app will not work until you reconfigure it. +
++ This process disables 2FA until you verify your authenticator app and will also reset your 2FA recovery codes. + If you do not complete your authenticator app configuration you may lose access to your account. +
++ You do not have a local username/password for this site. Add a local + account so you can log in without an external login. +
+You must generate a new set of recovery codes before you can log in with a recovery code.
+You can generate a new set of recovery codes.
+You should generate a new set of recovery codes.
++ Your password has been reset. Please click here to log in. +
diff --git a/samples/Identity.ExternalClaims/Pages/Account/ResetPasswordConfirmation.cshtml.cs b/samples/Identity.ExternalClaims/Pages/Account/ResetPasswordConfirmation.cshtml.cs new file mode 100644 index 0000000000..6f3340a6ab --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Account/ResetPasswordConfirmation.cshtml.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Identity.ExternalClaims.Pages.Account +{ + public class ResetPasswordConfirmationModel : PageModel + { + public void OnGet() + { + + } + } +} diff --git a/samples/Identity.ExternalClaims/Pages/Account/SignedOut.cshtml b/samples/Identity.ExternalClaims/Pages/Account/SignedOut.cshtml new file mode 100644 index 0000000000..66ee2c8595 --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Account/SignedOut.cshtml @@ -0,0 +1,10 @@ +@page +@model SignedOutModel +@{ + ViewData["Title"] = "Signed out"; +} + ++ You have successfully signed out. +
diff --git a/samples/Identity.ExternalClaims/Pages/Account/SignedOut.cshtml.cs b/samples/Identity.ExternalClaims/Pages/Account/SignedOut.cshtml.cs new file mode 100644 index 0000000000..ec39e5f35e --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Account/SignedOut.cshtml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; + +public class SignedOutModel : PageModel +{ + public IActionResult OnGet() + { + if (User.Identity.IsAuthenticated) + { + // Redirect to home page if the user is authenticated. + return RedirectToPage("/Index"); + } + + return Page(); + } +} \ No newline at end of file diff --git a/samples/Identity.ExternalClaims/Pages/Account/_ViewImports.cshtml b/samples/Identity.ExternalClaims/Pages/Account/_ViewImports.cshtml new file mode 100644 index 0000000000..8b27d69cdd --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Account/_ViewImports.cshtml @@ -0,0 +1 @@ +@using Identity.ExternalClaims.Pages.Account diff --git a/samples/Identity.ExternalClaims/Pages/Contact.cshtml b/samples/Identity.ExternalClaims/Pages/Contact.cshtml new file mode 100644 index 0000000000..b683c8216c --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Contact.cshtml @@ -0,0 +1,19 @@ +@page +@model ContactModel +@{ + ViewData["Title"] = "Contact"; +} +
+ Request ID: @Model.RequestId
+
+ Swapping to Development environment will display more detailed information about the error that occurred. +
++ Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application. +
diff --git a/samples/Identity.ExternalClaims/Pages/Error.cshtml.cs b/samples/Identity.ExternalClaims/Pages/Error.cshtml.cs new file mode 100644 index 0000000000..c55c873e8e --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Error.cshtml.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Identity.ExternalClaims.Pages +{ + public class ErrorModel : PageModel + { + public string RequestId { get; set; } + + public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + public void OnGet() + { + RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; + } + } +} diff --git a/samples/Identity.ExternalClaims/Pages/Index.cshtml b/samples/Identity.ExternalClaims/Pages/Index.cshtml new file mode 100644 index 0000000000..728fdfc943 --- /dev/null +++ b/samples/Identity.ExternalClaims/Pages/Index.cshtml @@ -0,0 +1,108 @@ +@page +@model IndexModel +@{ + ViewData["Title"] = "Home page"; +} + + + +