Adfs

配置 ADFS 以將 SID 作為聲明傳遞

  • March 25, 2015

我有一個系統,我們使用 ADFS 作為身份提供者來提供基於 WIF 的 .NET 應用程序的單點登錄。一切正常,我們可以根據需要傳遞所有聲明,例如,這裡是傳遞姓氏的規則:

c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", 
Issuer == "AD AUTHORITY"]  
=> issue(store = "Active Directory", 
types = ("http://example.com/identity/claims/portal/lastname"), 
query = ";sn;{0}", param = c.Value);

但是現在,我需要添加兩個我遇到問題的規則,第一個是傳遞 SID,另一個是傳遞 SAM 帳戶名(域\使用者)。它們不存在於 ADFS 聲明配置嚮導的預定義列表中,我試圖為它們編寫自定義規則,但無法使它們正常工作。

如果確實可能,您能否指出我如何提取這些屬性?

抱歉,如果我搞砸了一些命名法,我通常只在別無選擇的情況下從事程式碼方面的工作,涉足 AD :) 歡迎所有更正。

傳遞 objectguid 而不是 SID 以獲得 AD 對象的真正不可變 ID。

類似於:

c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
 => issue(store = "Active Directory", types = ("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"), query = ";objectGUID;{0}", param = c.Value);

好的,在找到此頁面後,我設法弄清楚了。我基本上使用了不正確的屬性名稱,在我的情況下,我應該使用objectSidand sAMAccountName。令我驚訝的是,後者也沒有域部分。因此,如果它對其他人有幫助,這裡是通過 SID 作為聲明的範例規則:

c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", 
Issuer == "AD AUTHORITY"]  
=> issue(store = "Active Directory", 
types = ("http://example.com/identity/claims/portal/lastname"), 
query = ";objectSid;{0}", param = c.Value);

引用自:https://serverfault.com/questions/677955