【发布时间】:2020-10-13 18:06:56
【问题描述】:
如何在 ADFS 中将 AD 属性迭代为声明规则?
更具体地说,我想检查用户的 proxyAddresses 是否包含预先确定的域,如果是,则将该电子邮件作为名称 ID 返回,否则返回用户的主电子邮件。
【问题讨论】:
标签: adfs claims-authentication
如何在 ADFS 中将 AD 属性迭代为声明规则?
更具体地说,我想检查用户的 proxyAddresses 是否包含预先确定的域,如果是,则将该电子邮件作为名称 ID 返回,否则返回用户的主电子邮件。
【问题讨论】:
标签: adfs claims-authentication
您将在声明规则中使用regex 来检查域,如果存在,则发出 NameID 声明。
然后使用“NOT EXISTS”规则。
比如:
NOT EXISTS([Type == "http://contoso.com/NAMID"])
=> add(Type = "http://contoso.com/hasNAMEID", Value = "No");
Sample Rule 2:
c1:[Type == "http://contoso.com/hasNameID"] &&
c2:[Type == "http://contoso.com/email"]
=> issue(Type="http://contoso.com/email", Value=c2.value);
使用正常的电子邮件声明类型等。
在写完这篇文章大约 10 分钟后,我在more detail 中找到了这个显示解决方案的示例。
【讨论】:
我昨天玩了一下,结果如下,这似乎可行,但可能不是最干净的方式?
规则 #1:
Proxy-Addresses 和 User-Principal-Name 的常规属性声明
规则 #2:
c:[Type == "fake/proxyAddresses", Value =~ "subdomain.example.com$"]
=> issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Value = RegExReplace(c.Value, "smtp:", ""));
规则 #3:
NOT EXISTS([Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"])
=> add(Type = "fake/UseUPN", Value = "Yes");
规则 #4:
c1:[Type == "fake/UseUPN"]
&& c2:[Type == "fake/UPN"]
=> issue(Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Value = c2.Value);
【讨论】: