【问题标题】:Issue a constant attribute in a claim在声明中发出常量属性
【发布时间】:2013-04-29 19:18:31
【问题描述】:

我们有一个规则可以向我们的依赖第三方之一发布与以下内容完全匹配的属性(显然我做了一些更改):

<Attribute Name="http://example.com/#Something" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified">
    <AttributeValue xsi:type="xsd:string">http://example.com</AttributeValue>
</Attribute>

我在 Claim Rule language 中看不到任何可以让我进行上述操作的内容 - 获取 Attribute Name 部分很容易,获取 AttributeValue 的值很容易,但添加 NameFormat 和似乎无法获得AttributeValue 的类型。

例如,这个:

=> issue(Type = "http://example.com/#Something",
         Value = "http://example.com",
         ValueType = "string");

可以带我们到这里:

<Attribute Name="http://example.com/#Something">
    <AttributeValue a:type="tn:string" xmlns:tn=" http://www.w3.org/2001/XMLSchema" xmlns:a="http://www.w3.org/2001/XMLSchema-instance">http://something.com</AttributeValue>
</Attribute>

我们还尝试使用http://www.w3.org/2001/XMLSchema#string 替换ValueType,结果非常相似。我没有看到任何可以添加NameFormat 的内容,而且添加到AttributeValue 的信息肯定比我们需要的要多得多。

有没有办法只发出持续索赔?这些值没有任何变化;我希望能够将 XML 放到某个地方并将其集成到整个 SAML 消息中。

【问题讨论】:

    标签: saml adfs2.0 adfs


    【解决方案1】:

    有点晚了,希望对其他人有所帮助。

    下面的例子有帮助吗?

    c:[Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"] 
    => issue( 
    Type = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", 
    Issuer = c.Issuer, 
    OriginalIssuer = c.OriginalIssuer, 
    Value = c.Value, 
    ValueType = c.ValueType, 
    Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/attributename"] = "urn:oasis:names:tc:SAML:2.0:attrname-format:uri"); 
    

    关键部分是使用由 URI http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/attributename 标识的 NameFormat 操作属性。 http://blogs.msdn.com/b/card/archive/2010/06/21/a-quick-walkthrough-setting-up-ad-fs-saml-federation-with-a-shibboleth-sp.aspx 有更多关于名称格式的详细信息。

    您可以跳过条件检查并按如下方式发出声明

    => issue( 
        Type = "http://example.com/#Something", 
        Value = "http://example.com", 
        Properties["http://schemas.xmlsoap.org/ws/2005/05/identity/claimproperties/attributename"] = "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"); 
    

    【讨论】:

    • 效果很好 :-) 此外,如果您需要发送多个常量,它们将在单独的声明规则中发送。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-05-17
    • 1970-01-01
    • 2015-06-16
    • 2013-06-08
    • 1970-01-01
    • 2023-03-08
    • 2017-04-06
    相关资源
    最近更新 更多