diff --git a/src/Identity/Extensions.Core/src/TotpSecurityStampBasedTokenProvider.cs b/src/Identity/Extensions.Core/src/TotpSecurityStampBasedTokenProvider.cs
index 117fb0752f..987092e628 100644
--- a/src/Identity/Extensions.Core/src/TotpSecurityStampBasedTokenProvider.cs
+++ b/src/Identity/Extensions.Core/src/TotpSecurityStampBasedTokenProvider.cs
@@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.Identity
{
///
- /// Represents a token provider that generates time based codes using the user's security stamp.
+ /// Represents a token provider that generates time-based codes using the user's security stamp.
///
/// The type encapsulating a user.
public abstract class TotpSecurityStampBasedTokenProvider : IUserTwoFactorTokenProvider
@@ -38,6 +38,7 @@ namespace Microsoft.AspNetCore.Identity
}
var token = await manager.CreateSecurityTokenAsync(user);
var modifier = await GetUserModifierAsync(purpose, manager, user);
+
return Rfc6238AuthenticationService.GenerateCode(token, modifier).ToString("D6", CultureInfo.InvariantCulture);
}
@@ -67,6 +68,7 @@ namespace Microsoft.AspNetCore.Identity
}
var securityToken = await manager.CreateSecurityTokenAsync(user);
var modifier = await GetUserModifierAsync(purpose, manager, user);
+
return securityToken != null && Rfc6238AuthenticationService.ValidateCode(securityToken, code, modifier);
}
@@ -87,11 +89,12 @@ namespace Microsoft.AspNetCore.Identity
throw new ArgumentNullException(nameof(manager));
}
var userId = await manager.GetUserIdAsync(user);
- return "Totp:" + purpose + ":" + userId;
+
+ return $"{Totp}:{purpose}:{userId}";
}
///
- /// Returns a flag indicating whether the token provider can generate a token suitable for two factor authentication token for
+ /// Returns a flag indicating whether the token provider can generate a token suitable for two-factor authentication token for
/// the specified .
///
/// The that can be used to retrieve user properties.
@@ -99,8 +102,8 @@ namespace Microsoft.AspNetCore.Identity
///
/// The that represents the asynchronous operation, containing the a flag indicating if a two
/// factor token could be generated by this provider for the specified .
- /// The task will return true if a two factor authentication token could be generated, otherwise false.
+ /// The task will return true if a two-factor authentication token could be generated, otherwise false.
///
public abstract Task CanGenerateTwoFactorTokenAsync(UserManager manager, TUser user);
}
-}
\ No newline at end of file
+}