我在我的应用程序中使用 okta 作为 idp,我想配置自定义属性,例如:ID,如何在 okta 中完成?以及如何在 okta 中设置这些值?
最佳答案
以下是将自定义属性添加到 Okta 的 SAML 断言的过程:
当您测试您的应用程序时,您应该获得以下 SAML AttributeStatement 节点:
<saml2:AttributeStatement xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion">
<saml2:Attribute Name="firstName"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
>
<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string"
>Isaac</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="lastName"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
>
<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string"
>Brock</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="Email"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
>
<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string"
>isaac.brock@mailinator.com</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="userName"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
>
<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string"
>isaac@company.com</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="phone"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
>
<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string"
>+1 415 456 7893</saml2:AttributeValue>
</saml2:Attribute>
<saml2:Attribute Name="jobTitle"
NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified"
>
<saml2:AttributeValue xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="xs:string"
>Vice President</saml2:AttributeValue>
</saml2:Attribute>
</saml2:AttributeStatement>
(注意最后一个“jobTitle”属性)
我希望这有帮助!
关于spring-boot - 如何使用 saml2.0 在 okta 中配置和获取自定义属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40458134/