regex - ADFS 声明规则中的正则表达式负前瞻
问题描述
我需要向不匹配特定 LDAP 属性的每个人授予声明。我想使用带有负面展望的正则表达式来执行这个“not”子句
c1:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value =~ "^(?!Test User).*$"]
=> issue(Type = "http://goofyclaim", Value = "youre not a tester");
我的测试用户似乎并不满意上述规则。正则表达式有问题吗?还是 ADFS4.0 不支持它。我在 ADFS 事件日志中看不到任何错误。
这是 win2012r2 AD 域上的 win2016srv。
作为参考,这条规则确实有效:
c1:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value =~ "(?i)^Test User1"]
=> issue(Type = "http://somethignelseentreily", Value = "imispellwhendriving");
解决方案
首先我需要为 REGEXP_NOT_MATCH使用(在这里找到ADFS 规则语言终端)
!~
接下来,我必须通过在 ^ 标识符中不区分大小写来稍微重构正则表达式模式修饰符
c1:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", Value !~ "^(?i)Test User"]
=> issue(Type = "http://somethignelseentreily", Value = "imispellwhendriving");
推荐阅读
- haskell - 等效于 OCaml 中的 haskell TypeError
- dax - 计算过去 30 天(不包括今天)的平均值。达克斯
- python - python-scrapy 项目返回 url 列表,并在 url 中抓取内容
- java - 如何检查 map.get(1) Java 的空集合
- excel - 从一组标签中获取特定文本的第一次出现
- 使用 VBA 的标签
- c# - 有什么方法可以限制 Unity3D 中面板的触摸输入?
- python - 如何在使用 to_html 将 pandas 数据框转换为 html 时隐藏列名
- python - 按键长度对字典进行排序。蟒蛇 3.6
- php - Jquery - 错误 414:请求 URI 太大
- atomikos - 带有 Atomikos 事务管理器的 EhCache 3