配置 SimpleSAMLphp 1.10
可将 SimpleSAMLphp 1.10 配置为 ArcGIS Online 中企业登录的身份提供者。配置过程涉及两个主要步骤:将企业级身份提供者注册到 ArcGIS Online,以及将 ArcGIS Online 注册到企业级身份提供者。
步骤 1:将 SimpleSAMLphp 作为企业级身份提供者注册到 ArcGIS Online
- 在 SimpleSAMLphp IdP 中配置身份验证源。
- 创建身份验证源。
SimpleSAMLphp 支持对来自各种身份验证源的用户进行身份验证,如 LDAP 服务器、SQL Server 中的用户、活动目录域等。以下示例显示了如何在 SimpleSAMLphp IdP 中将 Apache Directory Server 配置为身份验证源。
可在 <SimpleSAML_HOME>/config/authsources.php 文件中对身份验证源进行配置。要配置 LDAP 服务器,请打开 config/authsources.php 文件并以如下格式添加基于 LDAP 的身份验证源。
'example-ldapApacheDS' => array( 'ldap:LDAP', /* The hostname of the LDAP server. */ 'hostname' => 'host:port', /* Whether SSL/TLS should be used when contacting the LDAP server. */ 'enable_tls' => TRUE, /* * Which attributes should be retrieved from the LDAP server. * This can be an array of attribute names, or NULL, in which case * all attributes are fetched. */ 'attributes' => NULL, /* * The pattern which should be used to create the users DN given the username. * %username% in this pattern will be replaced with the users username. * * This option is not used if the search.enable option is set to TRUE. */ 'dnpattern' => 'uid=%username%,ou=users,ou=system', /* * As an alternative to specifying a pattern for the users DN, it is possible to * search for the username in a set of attributes. This is enabled by this option. */ 'search.enable' => FALSE, /* * The DN which will be used as a base for the search. * This can be a single string, in which case only that DN is searched, or an * array of strings, in which case they will be searched in the order given. */ 'search.base' => 'ou=users,ou=system', /* * The attribute(s) the username should match against. * * This is an array with one or more attribute names. Any of the attributes in * the array may match the value the username. */ 'search.attributes' => array('uid', 'mail'), /* * The username & password the simpleSAMLphp should bind to before searching. If * this is left as NULL, no bind will be performed before searching. */ 'search.username' => 'uid=admin,ou=system', 'search.password' => 'password', ),ArcGIS Online 支持企业登录的 givenName 和 email address 属性从企业级身份提供者流入 ArcGIS Online。当用户使用企业登录帐户进行登录时,如果 ArcGIS Online 收到名为 givenname 和 email 或 mail 的属性(无论哪种),则 ArcGIS Online 将使用从身份提供者接收的值来填充用户帐户的全称和电子邮件地址。
建议您将电子邮件地址从企业级身份提供者传递到 ArcGIS Online。如果用户日后成为管理员,此操作将很有帮助。帐户中存在电子邮件地址的用户拥有接收所有管理活动的相关通知以及向其他用户发送加入组织的邀请的权利。
- 将上面创建的身份验证源配置为 SimpleSAMLphp IdP 中的身份验证模块。
打开 metadata/ saml20-idp-hosted.php 文件并添加要使用的身份验证源。
/* * Authentication source to use. Must be one that is configured in * 'config/authsources.php'. */ 'auth' => 'example-ldapApacheDS',
- 创建身份验证源。
- 配置 SimpleSAMLphp IdP 支持的名称标识符格式。
打开 < SimpleSAML_HOME >/metadata/saml20-idp-hosted.php 文件并添加以下片段。在以下示例中,SimpleSAMLphp IdP 在对用户进行身份验证后将 uid 作为 NameID 传递给 ArcGIS Online。
'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', 'authproc' => array( 3 => array( 'class' => 'saml:AttributeNameID', 'attribute' => 'uid', 'Format' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', ), ), - 注册 ArcGIS Online 组织的 SimpleSAMLphp 身份提供者。
- 验证您是否登录以及是否是组织的管理员。
- 单击站点顶部的我的组织按钮。将打开组织页面。
- 单击编辑设置按钮。
- 单击页面左侧的安全性链接。
- 在企业登录部分,单击设置身份提供者按钮。
- 在随即打开的窗口中输入身份提供者的名称。
- 要为身份提供者提供元数据信息,可选择以下三个选项之一:
URL - 如果 SimpleSAMLphp 联合身份验证元数据的 URL 可供访问,请选择此选项。通常是 https://<simpleSAML-server>/<saml-app-name>/saml2/idp/metadata.php。
文件 - 如果无法访问 URL,请选择此选项。将元数据从 URL 保存为 XML 文件,并使用文件选项将此文件上传至 ArcGIS Online。
参数 - 如果 URL 或文件无法访问,请选择此选项。手动输入值并提供所需参数:登录 URL、绑定类型和证书。请联系 SimpleSAMLphp 管理员获取这些参数。
步骤 2:将 ArcGIS Online 作为受信服务提供者注册到 SimpleSAMLphp
- 通过配置 <SimpleSAMLphp_HOME>/metatadata/saml20-sp-remote.php 文件,使用 SimpleSAML 将 ArcGIS Online 配置为受信任的服务提供者。
- 获取 ArcGIS Online 组织的元数据 XML 文件。
要获取元数据文件,请以管理员身份登录组织,并打开组织页面。单击编辑设置按钮并单击安全性选项卡,然后在企业登录部分中单击获取服务提供者按钮。
- 将上述步骤中获得的 XML 文件转换为 PHP 格式。
SimpleSAMLphp 要求以 PHP 格式提供服务提供者的元数据信息。SimpleSAMLPHP 提供了一个从 XML 到 PHP 的内置元数据转换器,默认情况下此转换器可作为 simpleSAMLphp 安装中的 https://<simpleSAML-server>/<saml-app-name>/admin/metadata-converter.php。使用转换器将 XML 转换为 PHP。
- 打开 metatadata/saml20-sp-remote.php 文件,并添加在步骤 2.1.b 中以 PHP 格式创建的服务提供者配置。
以下示例是在元数据文件中添加的服务提供者配置。
/* The following is an AGOL organization service provider */ $metadata['citygis.maps.arcgis.com'] = array ( 'entityid' => ' citygis.maps.arcgis.com', 'name' => array ( 'en' => 'citygis ', ), 'description' => array ( 'en' => 'citygis ', ), 'OrganizationName' => array ( 'en' => 'citygis ', ), 'OrganizationDisplayName' => array ( 'en' => 'citygis ', ), 'url' => array ( 'en' => 'https://citygis.maps.arcgis.com', ), 'OrganizationURL' => array ( 'en' => 'https://citygis.maps.arcgis.com', ), 'contacts' => array ( ), 'metadata-set' => 'saml20-sp-remote', 'AssertionConsumerService' => array ( 0 => array ( 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', 'Location' => 'https://citygis.maps.arcgis.com/sharing/rest/oauth2/saml/signin', 'index' => 1, ), 1 => array ( 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://citygis.maps.arcgis.com/sharing/rest/oauth2/saml/signin', 'index' => 2, ), ), 'SingleLogoutService' => array ( ), );
- 获取 ArcGIS Online 组织的元数据 XML 文件。
- 对验证用户身份之后将作为 NameID 从 SimpleSAMLphp IdP 传递到 ArcGIS Online 的属性进行配置。
在上一步中添加的服务提供者配置的末尾添加属性。
在以下示例中,SimpleSAMLphp IdP 在对用户进行身份验证后将 uid 作为 NameID 传递给 ArcGIS Online。(将 citygis.maps.arcgis.com 替换为贵组织的 URL。)
/* The following is a remote AGOL organization service provider */ $metadata['citygis.maps.arcgis.com'] = array ( 'entityid' => ' citygis.maps.arcgis.com', 'name' => array ( 'en' => 'citygis ', ), 'description' => array ( 'en' => 'citygis ', ), 'OrganizationName' => array ( 'en' => 'citygis ', ), 'OrganizationDisplayName' => array ( 'en' => 'citygis ', ), 'url' => array ( 'en' => 'https://citygis.maps.arcgis.com', ), 'OrganizationURL' => array ( 'en' => 'https://citygis.maps.arcgis.com', ), 'contacts' => array ( ), 'metadata-set' => 'saml20-sp-remote', 'AssertionConsumerService' => array ( 0 => array ( 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', 'Location' => 'https://citygis.maps.arcgis.com/sharing/rest/oauth2/saml/signin', 'index' => 1, ), 1 => array ( 'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', 'Location' => 'https://citygis.maps.arcgis.com/sharing/rest/oauth2/saml/signin', 'index' => 2, ), ), 'SingleLogoutService' => array ( ), 'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', 'simplesaml.nameidattribute' => 'uid', ); /* The following indicates whether to send all the attributes received from the authentication source to the service provider or not. If true, it will send, otherwise it will not send all the attributes*/ 'simplesaml.attributes' => true,