我们正在实现基于 SAML2 的 SSO 解决方案,并在 SP 端使用 PicketLink。
在 IDP 方面,我们有一个不同的实现,它被配置为输出多值 memberOf
属性(这些实际上是 LDAP/AD 组成员资格。所以我们基本上在断言中得到类似的内容:
<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ... >
...
<saml:Assertion ...>
...
<saml:AttributeStatement>
<saml:Attribute FriendlyName="Role" Name="Role">
<saml:AttributeValue>authenticated</saml:AttributeValue>
</saml:Attribute>
<saml:Attribute FriendlyName="memberOf" Name="memberOf">
<saml:AttributeValue>CN=ga-A-102213-...</saml:AttributeValue>
<saml:AttributeValue>CN=g-z-MeetingPlace,...</saml:AttributeValue>
<saml:AttributeValue>CN=g-z-Serviceportal,...</saml:AttributeValue>
<saml:AttributeValue>CN=g-z-BCM...</saml:AttributeValue>
...
</saml:Attribute>
</saml:AttributeStatement>
...
</saml:Assertion>
</samlp:Response>
我的问题是,如何配置 PicketLink/JBoss 将这些 memberOf
值映射到应用程序/SP 中的特定角色?
例如,CN=g-z-MeetingPlace,...
应映射到 ROLE_MEETING
或 CN=g-z-BCM...
应映射到 ROLE_BCM
。我们可能可以编写一个登录模块来做到这一点,但对我来说,这似乎是一个非常标准的任务。但是我还没有找到配置解决方案。
最佳答案
看来我们已经找到答案了。
我们需要的是org.jboss.security.auth.spi.RoleMappingLoginModule
:
<login-module code="org.jboss.security.auth.spi.RoleMappingLoginModule"
flag="optional">
<module-option name="rolesProperties">roles.properties</module-option>
</login-module>
AD 组名称和内部应用程序角色之间的映射在 roles.properties
文件中配置:
CN\=ga-A-102213-...=SomeInternalRole
关于saml - 如何使用 PicketLink 将 SAML 断言属性值映射到 SP 中的角色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27541900/