首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >需要在AuthNRequest中添加属性..如何做到这一点?

需要在AuthNRequest中添加属性..如何做到这一点?
EN

Stack Overflow用户
提问于 2021-08-18 09:50:26
回答 2查看 44关注 0票数 1

如何使用C#中的itfoxtec-identity-saml2将此示例添加到断言中?找不到合适的方法...

代码语言:javascript
复制
<saml:AttributeStatement>
<saml:Attribute FriendlyName="SurName" Name="urn:oid:2.5.4.4" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue xsi:type="xs:string">Max</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute FriendlyName="CommonName" Name="urn:oid:2.5.4.3" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue xsi:type="xs:string">Max Mustermann</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="urn:oid:0.9.2342.19200300.100.1.1" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue xsi:type="xs:string">has</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute FriendlyName="Email" Name="urn:oid:0.9.2342.19200300.100.1.3" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
  <saml:AttributeValue xsi:type="xs:string">max@mustermann.de</saml:AttributeValue>
</saml:Attribute>  </saml:AttributeStatement>
EN

回答 2

Stack Overflow用户

发布于 2021-08-18 12:46:15

可以将更多声明/属性添加到示例IdP中发出的断言中。

用户声明的测试已添加到https://github.com/ITfoxtec/ITfoxtec.Identity.Saml2/blob/master/test/TestIdPCore/Controllers/AuthController.cs#L173

您可以添加所需的声明/属性,该声明/属性随后将在AuthnResponse断言中发出。

票数 0
EN

Stack Overflow用户

发布于 2021-08-18 13:34:00

声明仅限于在System.Security.Claims命名空间中定义的声明类型:

在ComponentsPro中,Saml实现属性是这样添加的:

代码语言:javascript
复制
 AttributeStatement attributeStatement = new AttributeStatement();
attributeStatement.Attributes.Add(new ComponentPro.Saml2.Attribute("email", SamlAttributeNameFormat.Basic, null,
                                                                             "john@test.com"));
attributeStatement.Attributes.Add(new ComponentPro.Saml2.Attribute("FirstName", SamlAttributeNameFormat.Basic, null,
                                                                             "John"));
attributeStatement.Attributes.Add(new ComponentPro.Saml2.Attribute("LastName", SamlAttributeNameFormat.Basic, null,
                                                                             "Smith"));

// Insert a custom token key to the SAML response.
attributeStatement.Attributes.Add(new ComponentPro.Saml2.Attribute("CustomTokenForVerification", SamlAttributeNameFormat.Basic, null,
                                                                             "YourEncryptedTokenHere"));

samlAssertion.Statements.Add(attributeStatement);

在Pingfederates Service Provider connections中,需要定义一些自定义属性。这看起来不是一个索赔吗?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68830123

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档