![](/img/trans.png)
[英].net core 5.0 CurrentPrincipal resets value
我有一個 .net 核心 5.0 應用程序,它需要額外的證書驗證,並且基於我在 db 中獲得某些角色的證書。 我將這些作為聲明存儲在 Thread.CurrentPrincipal 或 HttpContext.User 中。 但是當調用到 Controller 時,它們都會恢復默認值。 這是 Sta ...
[英].net core 5.0 CurrentPrincipal resets value
我有一個 .net 核心 5.0 應用程序,它需要額外的證書驗證,並且基於我在 db 中獲得某些角色的證書。 我將這些作為聲明存儲在 Thread.CurrentPrincipal 或 HttpContext.User 中。 但是當調用到 Controller 時,它們都會恢復默認值。 這是 Sta ...
[英]Add ClaimsIdentity via OWIN AuthenticationManager.SignIn is not working
我確實創建了應處理Jwt Bearer令牌的自定義AuthorizeAttribute ,然后創建ClaimsIdentity 。 但是,當我再次發送請求時,無論如何我都看不到授權用戶,必須再次創建ClaimsIdentity並將用戶再次添加到CurrentPricipal 。 我做錯了什么 ...
[英]Is Thread.CurrentPrincipal reliable using OWIN authentication and Web API?
在MVC5之前,我聽說過/能夠重現過去使用異步操作時Thread.CurrentPrincipal並非總是正確設置的問題。 這是一篇討論該問題的博客文章: http : //www.hanselman.com/blog/SystemThreadingThreadCurrentPrincipal ...
[英]Setting Thread.CurrentPrincipal with async/await
下面是我試圖在異步方法中將Thread.CurrentPrincipal設置為自定義UserPrincipal對象的簡化版本,但是自定義對象在離開await后會丟失,即使它仍然在新的threadID 10上。 有沒有辦法在await中更改Thread.CurrentPrincipal並在以 ...
[英]Why Thread.CurrentPrincipal.Identity.IsAuthenticated is always false?
我有此WCF服務,並且正在嘗試在其中應用身份驗證和授權機制。 這是我第一次這樣做,我擁有的是該serviceModel web.config serviceModel標記: 我想做的事情很簡單,我不知道我是否需要我正在嘗試的所有這些標簽。 我要從客戶端添加服務引用,然后首先調用M ...
[英]CurrentPrincipal.Identity.Name is blank
我正在嘗試使用System.Threading.Thread.CurrentPrincipal.Identity.Name來獲取誰正在使用ASP.NET應用程序的登錄。 我沒有得到任何構建錯誤,但它返回一個空值。 我正在使用IIS 6,這是我的身份驗證設置: 匿名身份驗證:已禁用 ...
[英]Thread.CurrentPrincipal is reset to default GenericPrincipal
在初始化我的應用程序期間,我設置了System.Threading.Thread.CurrentPrincial 。 但是在初始化應用程序並且我想要訪問此Principal之后,CurrentPrincipal再次包含默認的GenericPrincipal。 任何人都知道我為什么會這樣做 ...
[英]Security, Thread.CurrentPrincipal, and ConfigureAwait(false)
在使用ConfigureAwait(false)的引用庫中使用Thread.CurrentPrincipal的聲明會造成任何問題,或者ExecutionContext的邏輯調用上下文的流動會在那里照顧我嗎? (到目前為止,我的閱讀和測試表明它會)。 示例WebAPI控制器操作: [Cu ...
[英]In .NET, System.Threading.Thread.CurrentPrincipal is the same for different threads
我正在尋找一些通用的方法來為不同的用戶在服務器端存儲我的JWT令牌。 我決定將這些數據存儲在Thread.CurrentPrincipal中。 但是當我測試它時,我看到,不同的客戶端可以訪問相同的線程。 模擬幾個客戶端,訪問我測試的wcf服務: 並測試了服務的方法: 我 ...
[英]Why do Thread.CurrentPrincipal.Identity and WindowsIdentity.GetCurrent() differ when impersonation is turned on?
我啟用了模擬和 Windows 身份驗證。 但是Thread.CurrentPrincipal.Identity.Name返回經過身份驗證的用戶的名稱, WindowsIdentity.GetCurrent()返回模擬身份。 這些身份不應該是一樣的嗎? 在這種情況下,代碼在哪些憑據下運行? ...