Skip To Content

配置 SimpleSAMLphp

可将 SimpleSAMLphp 1.10 及更高版本配置为 Portal for ArcGIS 中企业登录的身份提供者 (IDP)。配置过程包含两个主要步骤:将企业级 IDP 注册到 Portal for ArcGIS,以及将 Portal for ArcGIS 注册到企业级 IDP。

所需信息

当用户使用企业登录帐户进行登录时,Portal for ArcGIS 需要从 IDP 处接收某些属性信息。NameID 属性为强制属性,并且必须由您的 IDP 在 SAML 响应中发送,才能使 Portal for ArcGIS 的联合身份验证起作用。由于 Portal for ArcGIS 使用 NameID 的值唯一标识指定用户,因此建议使用常量值来唯一标识用户。IDP 中的用户登录时,Portal for ArcGIS 会在其用户存储中创建用户名为 NameID 的新用户。NameID 发送的值中允许使用的字符包括字母数字、_(下划线)、. (圆点)和 @(at 符号)。任何其他字符均会进行转义,从而在 Portal for ArcGIS 创建的用户名中包含下划线。

Portal for ArcGIS 支持企业登录帐户的 givenNameemail address 属性从企业级 IDP 流入。当用户使用企业登录帐户进行登录时,如果 Portal for ArcGIS 收到名为 givennameemailmail 的属性(无论哪种),则 Portal for ArcGIS 将使用从 IDP 处接收的值来填充用户帐户的全称和电子邮件地址。建议您从企业级 IDP 传递 email address,以便用户能够接收通知。

将 SimpleSAMLphp 作为企业级 IDP 注册到 Portal for ArcGIS

  1. 在 SimpleSAMLphp IdP 中配置身份验证源。
    1. 创建身份验证源。

      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 that should be used to create the users DN given the username.
      		 * %username% in this pattern will be replaced with the user's 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 that 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',
      	),

      Portal for ArcGIS 支持企业登录帐户的 givenNameemail address 属性从企业级 IDP 流入。当用户使用企业登录帐户进行登录时,如果 Portal for ArcGIS 收到名为 givennameemailmail 的属性(无论哪种),则 Portal for ArcGIS 将使用从 IDP 处接收的值来填充用户帐户的全称和电子邮件地址。

      建议您将电子邮件地址从企业级 IDP 传递到 Portal for ArcGIS 如果用户日后成为管理员,此操作将很有帮助。帐户中存在电子邮件地址的用户拥有接收所有管理活动的相关通知以及向其他用户发送加入组织的邀请的权利。

    2. 将上面创建的身份验证源配置为 SimpleSAMLphp IdP 中的身份验证模块。打开 metadata/ saml20-idp-hosted.php 文件并添加要使用的身份验证源。
      /*
      	 * Authentication source to use. Must be one that is configured in	 * 'config/authsources.php'.	 */
      	'auth' => 'example-ldapApacheDS',
  2. 配置 SimpleSAMLphp IDP 支持的名称标识符格式。打开 < SimpleSAML_HOME >/metadata/saml20-idp-hosted.php 文件并添加以下片段。在以下示例中,SimpleSAMLphp IDP 在对用户进行身份验证后将 uid 作为 NameID 传递给 Portal for ArcGIS
    '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',				  ),
    			),
  3. 将 SimpleSAMLphp 注册为 Portal for ArcGIS 组织的 IDP。
    1. 以组织管理员的身份登录门户网站,然后单击组织 > 编辑设置 > 安全性
    2. 企业登录帐户部分,选择一位身份提供者选项,单击设置企业登录按钮,并在随即出现的窗口中输入组织名称(例如,City of Redlands)。当用户访问门户网站时,此文本将显示为 SAML 登录选项的一部分(例如,Using your City of Redlands account)。
      注:

      您只能为门户注册一个企业级 IDP,或一个多 IDP 联合

    3. 选择用户是否可以自动在门户中添加帐户之后加入组织。选择第一个选项可以使用户通过其企业登录帐户登录组织,而不会受到管理员的任何干预。首次登录时,用户的帐户即会自动注册到该组织。第二个选项需要管理员使用命令行实用程序Python 脚本示例将必要的帐户注册到该组织。帐户注册完成后,用户即可登录组织。
      提示:

      建议您至少将一个企业帐户指定为门户的管理员并下移或删除初始管理员帐户。还建议您禁用门户网站中的创建帐户按钮和注册页面 (signup.html),这样用户便无法创建自己的帐户。有关完整说明,请参阅在门户中配置 SAML 兼容身份提供者

    4. 要为 IDP 提供元数据信息,可选择以下三个选项之一:

      URL - 如果 SimpleSAMLphp 联合身份验证元数据的 URL 可供访问,请选择此选项。通常为 https://<simpleSAML-server>/<saml-app-name>/saml2/idp/metadata.php

      注:

      如果您的企业级 IDP 包含自签名证书,则可能在尝试指定元数据的 HTTPS URL 时遇到错误。出现此类错误的原因是 Portal for ArcGIS 不能验证 IDP 的自签名证书。此外,可使用 URL 中的 HTTP(以下选项中的另一选项),或为您的 IDP 配置受信任的证书。

      文件 - 如果无法访问 URL,请选择此选项。将元数据从 URL 保存为 XML 文件,并使用文件选项将此文件上传至 Portal for ArcGIS

      参数 - 如果 URL 或联合身份验证元数据文件无法访问,请选择此选项。手动输入值并提供所需参数:以 BASE 64 格式编码的登录 URL 和证书。请联系 SimpleSAMLphp 管理员获取这些参数。

  4. 配置适用的高级设置:
    • 加密声明 - 如果 SimpleSAMLphp 将配置为加密 SAML 声明响应,请选择此选项。
    • 启用签名请求 - 选择此选项可使 Portal for ArcGIS 对发送至 SimpleSAMLphp 的 SAML 身份验证请求进行签名。
    • 实体 ID - 可更新此值以使用新的实体 ID,以便将您的门户唯一识别到 SimpleSAMLphp。
    • 向身份提供者传递注销 - 选择此选项可使 Portal for ArcGIS 使用注销 URL 注销 SimpleSAMLphp 中的用户。输入将在注销 URL 设置中使用的 URL。如果 IDP 需要对注销 URL 签名,则需选中启用签名请求
    • 登录时更新个人资料 - 如果选中此选项,则 Portal for ArcGIS将更新用户的 givenNameemail address 属性(如果自上次登入后已更改)。
    • 启用基于 SAML 的群组成员资格 - 选中此选项允许组织成员在群组创建过程中将指定基于 SAML 的群组链接到 Portal for ArcGIS 群组。
    • 注销 URL - 用于注销当前登录用户 IDP URL。注销 URL 通常是 https://idphost.domain.com/simplesaml/saml2/idp/SingleLogoutService.php。此 URL 在 IDP 元数据文件的 SingleLogoutService 元素中进行定义。元数据文件 URL 通常是 http://[simpleSAML-server]/simplesaml/saml2/idp/metadata.php

    加密声明启用签名请求设置将使用门户 keystore 中的证书 samlcert。要使用新证书,请删除 samlcert 证书,按照将证书导入到门户中的步骤创建一个具有相同别名的 (samlcert) 新证书,然后重新启动门户。

Portal for ArcGIS 作为受信服务提供者注册到 SimpleSAMLphp

  1. 通过配置 <SimpleSAMLphp_HOME>/metatadata/saml20-sp-remote.php 文件,使用 SimpleSAMLphp 将 Portal for ArcGIS 配置为受信任的服务提供者。
    1. 获取 Portal for ArcGIS 组织的元数据 XML 文件。

      要获取元数据文件,请以组织管理员身份登录,并打开组织页面。单击编辑设置按钮和安全性选项卡,然后在企业登录部分单击获取服务提供者按钮。

    2. 将在先前子步骤中获得的 XML 文件转换为 PHP 格式。

      SimpleSAMLphp 要求以 PHP 格式提供服务提供者的元数据信息。SimpleSAMLphp 提供了一个从 XML 到 PHP 的内置元数据转换器,默认情况下此转换器可作为 simpleSAMLphp 安装中的 https://<simpleSAML-server>/<saml-app-name>/admin/metadata-converter.php 提供。使用转换器将 XML 转换为 PHP。

    3. 打开 metatadata/saml20-sp-remote.php 文件,并添加在上述步骤 1.b 中以 PHP 格式创建的服务提供者配置。

      以下示例是在元数据文件中添加的服务提供者配置。

      /* The following is a Portal for ArcGIS organization service provider */
      $metadata['webadaptorhost.domain.com.webadaptorname'] = array (  'entityid' => ' webadaptorhost.domain.com.webadaptorname',  'name' =>
        array (    'en' => 'portal ',  ),  'description' =>
        array (    'en' => 'portal ',  ),  'OrganizationName' =>
        array (    'en' => 'portal ',  ),  'OrganizationDisplayName' =>
        array (    'en' => 'portal ',  ),  'url' =>
        array (    'en' => 'https://webadaptorhost.domain.com/webadaptorname',  ),  'OrganizationURL' =>
        array (    'en' => 'https://webadaptorhost.domain.com/webadaptorname',  ),  'contacts' =>
        array (  ),  'metadata-set' => 'saml20-sp-remote',  'AssertionConsumerService' =>
        array (    0 =>
          array (      'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',      'Location' => 'https://webadaptorhost.domain.com/webadaptorname/sharing/rest/oauth2/saml/signin',      'index' => 1,    ),    1 =>
          array (      'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',      'Location' => 'https://webadaptorhost.domain.com/webadaptorname/sharing/rest/oauth2/saml/signin',      'index' => 2,    ),  ),  'SingleLogoutService' =>
        array (  ),
      );
  2. 对验证用户身份之后将作为 NameID 从 SimpleSAMLphp IdP 传递到 Portal for ArcGIS 的属性进行配置。 要执行此操作,在上一步中添加的服务提供者配置的末尾添加属性。

    在以下示例中,SimpleSAMLphp IdP 在对用户进行身份验证后将 uid 作为 NameID 传递给 Portal for ArcGIS。(将 webadaptorhost.domain.com.webadaptorname 替换为您的门户的 URL。)

    'NameIDFormat'               => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', 'simplesaml.nameidattribute' => 'uid',
    /* The following indicates whether or not to send all the attributes received from the authentication source to the service provider.  If true, it will send, otherwise it will not send all the attributes*/
      'simplesaml.attributes'      => true,
    );
  3. 如果您在将 SimpleSAMLphp 作为企业级 IDP 进行注册时选择了高级设置加密声明,请将以下属性添加到您在步骤 1 中添加的服务提供者配置的末尾。
    /*
      Whether assertions sent to this SP should be encrypted. The default value is FALSE.  */
      'assertion.encryption' => true,
    );