Exchange

ADFS。第三方真實聲明規則需要返回“域使用者”

  • January 11, 2022

我已經在 ADFS 中配置了 Claims Provider Trust 並且我只Email進入NameID. 我無法更改第三方聲明提供商信任,因此我必須WindowsAccountName使用我從第三方 IDP 以 NameID 收到的電子郵件地址,並將其轉發到 Outlook Web Access(本地)。

我發現當我使用以下聲明規則時,登錄有效,但前提是使用者的 UPN 和電子郵件地址匹配。如果它們之間存在差異(例如 sAMAccountName=jdoe;UPN=jdoe@contoso.com;Email=Jonathan.Doe@contoso.com ,轉發到 Exchange 的值會導致引發錯誤。

c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] == "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"]
=> issue(Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer = "AD AUTHORITY", OriginalIssuer = c.OriginalIssuer, Value = regexreplace(c.Value, "(?<user>[^\@]+)\@(.+)", "contoso\${user}"), ValueType = c.ValueType);

我如何通過他們的電子郵件地址查找使用者,並返回他們WindowsAccountNamedomain\username格式?

如果有人遇到這個問題。你需要兩條規則。

規則 #1:sAMAccountName 到 temp 這告訴 ADFS 在 ActiveDirectory 中查找並返回 UPN 或電子郵件地址匹配的任何帳戶。然後該規則將值儲存到一個臨時變數中,我們將在下一個規則中使用該變數。

c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/format"] == "urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"]
=> issue(store = "Active Directory", types = ("claims:temp/attribute1"), query = "(&(objectCategory=person)(objectClass=user)(|(userPrincipalName={0})(mail={0})));sAMAccountName;contoso\adfs_service_account", param = c.Value);

注意。contoso\adfs_service_account很重要。ADFS 需要它來自動發現域控制器。使用任何 AD 帳戶,只要它是真實帳戶即可。

規則#2:臨時到WindowsAccountName 上面的規則只返回sAMAccountName,而不是域。就我而言,我只有一個域。因此,我在下面對其進行了硬編碼。

c:[Type == "claims:temp/attribute1"] => issue(Type = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer = "AD AUTHORITY", OriginalIssuer = "https://contoso.verify.ibm.com/saml/sps/saml20ip/saml20", Value = "contoso\" + c.Value);

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