ASP.NET標(biāo)識的IUserSecurityStampStore<TUser>接口是什么?查看ASP.NET標(biāo)識(ASP.NET中的新成員關(guān)系實(shí)現(xiàn)),我在實(shí)現(xiàn)自己的接口時遇到了這個接口UserStore://Microsoft.AspNet.Identity.Core.dllnamespace Microsoft.AspNet.Identity{
public interface IUserSecurityStampStore<TUser> :
{
// Methods
Task<string> GetSecurityStampAsync(TUser user);
Task SetSecurityStampAsync(TUser user, string stamp);
}}IUserSecurityStampStore在默認(rèn)情況下實(shí)現(xiàn)。EntityFramework.UserStore<TUser>從本質(zhì)上獲取并設(shè)置TUser.SecurityStamp財產(chǎn)。經(jīng)過進(jìn)一步的挖掘,似乎SecurityStamp是Guid中的關(guān)鍵點(diǎn)新生成的UserManager(例如,更改密碼)。除了這個,我不能破譯更多的代碼,因?yàn)槲艺跈z查這段代碼反射器..幾乎所有的符號和異步信息都被優(yōu)化了。此外,谷歌對此也沒有多大幫助。問題如下:什么是SecurityStamp在ASP.NET標(biāo)識中,它用于什么?是否SecurityStamp在創(chuàng)建身份驗(yàn)證cookie時扮演什么角色?是否需要采取任何安全措施或預(yù)防措施?例如,不要將此值向下發(fā)送給客戶端?這里有源代碼:https://github.com/aspnet/Identity/https://github.com/aspnet/Security/
3 回答

瀟瀟雨雨
TA貢獻(xiàn)1833條經(jīng)驗(yàn) 獲得超4個贊
更新為2.0.0。SecurityStamp
OnValidateIdentity
CookieMiddleware
SecurityStamp
refreshInterval
app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie, LoginPath = new PathString("/Account/Login"), Provider = new CookieAuthenticationProvider { // Enables the application to validate the security stamp when the user logs in. // This is a security feature which is used when you change a password or add an external login to your account. OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>( validateInterval: TimeSpan.FromMinutes(30), regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager)) }});
UserManager.UpdateSecurityStampAsync(userId);
- 3 回答
- 0 關(guān)注
- 667 瀏覽
添加回答
舉報
0/150
提交
取消