第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

ASP.NET標(biāo)識的IUserSecurityStampStore<TUser>接口是什么?

ASP.NET標(biāo)識的IUserSecurityStampStore<TUser>接口是什么?

波斯汪 2019-10-13 12:08:59
ASP.NET標(biāo)識的IUserSecurityStampStore<TUser>接口是什么?查看ASP.NET標(biāo)識(ASP.NET中的新成員關(guān)系實現(xiàn)),我在實現(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)情況下實現(xiàn)。EntityFramework.UserStore<TUser>從本質(zhì)上獲取并設(shè)置TUser.SecurityStamp財產(chǎn)。經(jīng)過進(jìn)一步的挖掘,似乎SecurityStamp是Guid中的關(guān)鍵點新生成的UserManager(例如,更改密碼)。除了這個,我不能破譯更多的代碼,因為我正在檢查這段代碼反射器..幾乎所有的符號和異步信息都被優(yōu)化了。此外,谷歌對此也沒有多大幫助。問題如下:什么是SecurityStamp在ASP.NET標(biāo)識中,它用于什么?是否SecurityStamp在創(chuàng)建身份驗證cookie時扮演什么角色?是否需要采取任何安全措施或預(yù)防措施?例如,不要將此值向下發(fā)送給客戶端?這里有源代碼:https://github.com/aspnet/Identity/https://github.com/aspnet/Security/
查看完整描述

3 回答

?
MM們

TA貢獻(xiàn)1886條經(jīng)驗 獲得超2個贊

這意味著表示用戶憑據(jù)的當(dāng)前快照。因此,如果沒有變化,郵票將保持不變。但是,如果用戶的密碼被更改,或者登錄被刪除(取消鏈接您的Google/FB帳戶),郵票就會改變。當(dāng)出現(xiàn)這種情況時,需要自動對用戶簽名/拒絕舊cookie,這是2.0版的一個特性。

標(biāo)識還不是開源的,它目前仍在醞釀中。

更新為2.0.0。所以主要的目的是SecurityStamp就是讓所有地方都能簽字。其基本思想是,每當(dāng)用戶更改與安全有關(guān)的內(nèi)容(如密碼)時,自動使cookie中的任何現(xiàn)有標(biāo)識失效是一個好主意,因此,如果您的密碼/帳戶先前被破壞,攻擊者將不再具有訪問權(quán)限。

在2.0.0中,我們添加了以下配置來掛起OnValidateIdentity方法中的CookieMiddleware看看SecurityStamp當(dāng)曲奇變的時候拒絕它。它還會自動刷新數(shù)據(jù)庫中的用戶聲明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))
    }});

如果應(yīng)用程序想要顯式地觸發(fā)這種行為,它可以調(diào)用:

UserManager.UpdateSecurityStampAsync(userId);



查看完整回答
反對 回復(fù) 2019-10-14
?
狐的傳說

TA貢獻(xiàn)1804條經(jīng)驗 獲得超3個贊

我觀察到了令牌驗證所需的安全印章。

要回購:將數(shù)據(jù)庫中的SecurityStamp設(shè)置為null,生成一個令牌(Works,ok),驗證令牌(失敗)



查看完整回答
反對 回復(fù) 2019-10-14
?
隔江千里

TA貢獻(xiàn)1906條經(jīng)驗 獲得超10個贊

UseCookieAuthentication是棄用到現(xiàn)在為止。我設(shè)法使用

services.Configure<SecurityStampValidatorOptions>(o => 
    o.ValidationInterval = TimeSpan.FromSeconds(10));

從回復(fù)移到回答請求.


查看完整回答
反對 回復(fù) 2019-10-14
  • 3 回答
  • 0 關(guān)注
  • 541 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號