簡體   English   中英

新的WindowsIdentity()返回錯誤“ KDC不支持所請求的加密類型。”

[英]new WindowsIdentity() returns error “The encryption type requested is not supported by the KDC.”

我試圖通過創建WindowsPrincipal對象,然后在其上調用IsInRole()從用戶所屬的Active Directory中獲取組。 但是,嘗試像這樣創建WindowsPrincipal對象:

WindowsIdentity winID = new WindowsIdentity("jdoe");

我的程序拋出以下異常:

“ System.Security.SecurityException:KDC不支持所請求的加密類型。”

我很茫然。 我應該從哪里開始發現正在發生的事情?

該站點說WindowsIdentity使用“用戶主體名稱”: http : //msdn.microsoft.com/en-us/library/td3046fc.aspx

這個站點定義了用戶主體名稱是什么: http : //searchexchange.techtarget.com/definition/User-Principal-Name

另外,請注意,第一個站點顯示:

該構造函數僅可用於僅加入Windows Server 2003域的計算機上。 其他域類型將引發異常。

這是一個代碼復雜項目,顯示了如何查詢Active Directory: http : //www.codeproject.com/Articles/28546/Active-Directory-Roles-Provider
如果您只是嘗試獲取已登錄用戶的角色,並且您使用Windows身份驗證作為身份驗證方法(在web.config中已提供此功能),那么您所要做的就是使用可用的User對象:WindowsIdentity winID = (WindowsIdentity)User.Identity;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM