Extracted constant for 2FA remember me cookie

This commit is contained in:
Scott Brady
2020-04-20 20:20:04 +01:00
parent 96d9d3bd21
commit e90778bd3d
2 changed files with 8 additions and 3 deletions

View File

@@ -44,6 +44,11 @@
/// The claim type for the ASP.NET Identity security stamp
/// </summary>
public const string SecurityStampClaimType = "AspNet.Identity.SecurityStamp";
/// <summary>
/// The default authentication type used for remembering that 2FA is not needed on next login
/// </summary>
public const string TwoFactorRememberBrowserCookie = "TwoFactorRememberBrowser";
}
}
}

View File

@@ -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;