From e90778bd3d1ed95d6bce4e73bcab805cb1b22c91 Mon Sep 17 00:00:00 2001 From: Scott Brady Date: Mon, 20 Apr 2020 20:20:04 +0100 Subject: [PATCH] Extracted constant for 2FA remember me cookie --- src/Umbraco.Core/Constants-Web.cs | 5 +++++ src/Umbraco.Web/Security/AuthenticationManagerExtensions.cs | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Constants-Web.cs b/src/Umbraco.Core/Constants-Web.cs index 26e66c8cfc..5602b99e2d 100644 --- a/src/Umbraco.Core/Constants-Web.cs +++ b/src/Umbraco.Core/Constants-Web.cs @@ -44,6 +44,11 @@ /// The claim type for the ASP.NET Identity security stamp /// public const string SecurityStampClaimType = "AspNet.Identity.SecurityStamp"; + + /// + /// The default authentication type used for remembering that 2FA is not needed on next login + /// + public const string TwoFactorRememberBrowserCookie = "TwoFactorRememberBrowser"; } } } diff --git a/src/Umbraco.Web/Security/AuthenticationManagerExtensions.cs b/src/Umbraco.Web/Security/AuthenticationManagerExtensions.cs index 84b9fcbe0b..f809c402ae 100644 --- a/src/Umbraco.Web/Security/AuthenticationManagerExtensions.cs +++ b/src/Umbraco.Web/Security/AuthenticationManagerExtensions.cs @@ -2,9 +2,9 @@ using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; -using Microsoft.AspNet.Identity; +using Microsoft.AspNetCore.Identity; using Microsoft.Owin.Security; -using UserLoginInfo = Microsoft.AspNetCore.Identity.UserLoginInfo; +using Umbraco.Core; namespace Umbraco.Web.Security { @@ -95,7 +95,7 @@ namespace Umbraco.Web.Security { if (manager == null) throw new ArgumentNullException(nameof(manager)); - var rememberBrowserIdentity = new ClaimsIdentity(DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie); + var rememberBrowserIdentity = new ClaimsIdentity(Constants.Web.TwoFactorRememberBrowserCookie); rememberBrowserIdentity.AddClaim(new Claim(ClaimTypes.NameIdentifier, userId)); return rememberBrowserIdentity;