ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

如何将IDP返回的属性映射到SimpleSAMLphp中的友好名称?

2019-08-29 11:41:46  阅读:207  来源: 互联网

标签:saml-2-0 php simplesamlphp


我已成功配置simpleSAMLphp,以便通过Test Shib IDP(https://www.testshib.org/)进行身份验证.

Test Shib返回以下属性:

enter image description here

> urn:oid:0.9.2342.19200300.100.1.1
> urn:oid:1.3.6.1.4.1.5923.1.1.1.1
> urn:oid:1.3.6.1.4.1.5923.1.1.1.6
> urn:oid:2.5.4.4
> urn:oid:1.3.6.1.4.1.5923.1.1.1.9
> urn:oid:2.5.4.42
> urn:oid:1.3.6.1.4.1.5923.1.1.1.7
> urn:oid:2.5.4.3
> urn:oid:1.3.6.1.4.1.5923.1.1.1.10
> urn:oid:2.5.4.20

我想将这些属性映射到友好名称.任何人都可以给我一些指示如何做到这一点?

authsources.php中的default-sp示例具有以下内容:

/*
 * The attributes parameter must contain an array of desired attributes by the SP.
 * The attributes can be expressed as an array of names or as an associative array
 * in the form of 'friendlyName' => 'name'.
 * The metadata will then be created as follows:
 * <md:RequestedAttribute FriendlyName="friendlyName" Name="name" />
 */
 /*'attributes' => array(
   'attrname' => 'urn:oid:x.x.x.x',
 ),*/

但是设定

'attributes' => array('myTestValue' => 'urn:oid:0.9.2342.19200300.100.1.1'),

没有效果.

非常感谢任何帮助!

解决方法:

假设SimpleSAMLPHP 1.6及更高版本,您可以简单地使用oid2name属性映射中的构建来为您进行映射.

‘authproc’=>阵列(
    50 =>阵列(
        ‘class’=> ‘核心:AttributeMap’,
        ‘oid2name’,
    )
)

要添加到Luke的答案,您只需在以下位置添加authproc过滤器:

>全局在config.php中
>在SP上:仅针对authsources.php中的SP
>在SP上:仅适用于saml20-idp-remote或shib13-idp-remote中的一个远程IdP
>在IdP上:仅针对saml20-idp-hosted或shib13-idp托管中的一个托管IdP
>在IdP上:仅适用于saml20-sp-remote或shib13-sp-remote中的一个远程SP

取自https://simplesamlphp.org/docs/stable/simplesamlphp-authproc

您可以在此处找到的源中看到其他AttributeMaps,例如oid2urn和oid2feide:

https://github.com/simplesamlphp/simplesamlphp/tree/master/attributemap

标签:saml-2-0,php,simplesamlphp
来源: https://codeday.me/bug/20190829/1760380.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有