安全标记是根据用户的用户名和密码生成的随机值。
在一系列方法调用之后,我将安全标记的来源追溯到类的SecurityStamp
属性Microsoft.AspNet.Identity.EntityFramework.IdentityUser<TKey, TLogin, TRole, TClaim>
。
但是,我找不到设置此值的代码。我只找到了这个属性的一个设置器,那就是提供核心存储(、、等)的 EntityFrameworkIUserStore<..>
层IRoleStore<...>
。
// From Microsoft.AspNet.Identity.EntityFramework.UserStore<...>
public virtual Task SetSecurityStampAsync(TUser user, string stamp)
{
this.ThrowIfDisposed();
if (user == null)
{
throw new ArgumentNullException("user");
}
user.SecurityStamp = stamp;
return Task.FromResult<int>(0);
}
但是,我没有发现调用该SetSecurityStampAsync
方法的代码。
每当更改用户的凭据或创建新用户时,这显然会被重置。
什么代码设置了这个值?