使用正则表达式的不成功发行授权规则

Unsuccessfull Issuance Authorization Rule with regex

我正在尝试在 ADFS 3.0 中制定授权规则,使用 "relying party" 以特定 "OU" 形式禁用某些用户,但没有成功。

在发行转换规则中,我配置了声明“http://schemas.microsoft.com/ws/2008/06/identity/claims/distinguishedname”以从 AD 获取专有名称。

这是一个例子:CN=John Doe,OU=XYZ,OU=ABC,DC=CONTOSO,DC=com

此规则应拒绝 XPTO OU 中用户的访问

c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/distinguishedname", Value =~ "^[^,]*,OU=XPTO.*$"]
 => issue(Type = "http://schemas.microsoft.com/authorization/claims/deny", Value = "true");

并且此规则应允许 XPTO OU 外部的所有用户访问

c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/distinguishedname", Value !~ "^[^,]*,OU=XPTO.*$"]
 => issue(Type = "http://schemas.microsoft.com/authorization/claims/permit", Value = "true");

但是,这些规则不是授予某些用户访问权限而拒绝其他用户访问权限,而是拒绝所有用户访问权限

你能解释一下这个问题吗?

好的,问题已经解决

这种方法的问题在于解释 ADFS 依赖方的发行规则工作流程的少数文档中。

我所要做的就是在发行授权规则中添加第一条规则,获取用户的 DN。

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

后来,上述规则奏效了。

所有遇到这些授权配置的一些提示:

  • 如果发出许可声明,则用户始终被允许
  • 如果没有发出许可或拒绝声明,则用户被拒绝
  • 只有一个组织单位被拒绝访问时,此方法才有效。对于其他复杂的验证,应该使用自定义属性存储