drupalauth/simplesamlphp-module-drupalauth

一个为 SimpleSAMLphp 添加对 Drupal 作为身份验证源的支持的模块。

安装次数: 193,634

依赖者: 1

建议者: 0

安全: 0

星标: 24

关注者: 7

分支: 37

开放问题: 9

类型:simplesamlphp-module

2.10.0-rc.1 2023-11-07 21:05 UTC

README

Build Status

Drupal + SimpleSAMLphp + drupalauth = 完整的 SAML 身份提供者 (IdP)

用户通过 Drupal 创建账户、管理账户并进行身份验证。SAML SP 与 SimpleSAMLphp 交互。Drupalauth 将 Drupal 与 SimpleSAMLphp 连接起来。

simpleSAMLphp 的 drupalauth 模块通过在相同服务器上对 Drupal 网站进行身份验证,简化了创建 SAML 或 Shibboleth 身份提供者 (IdP) 的过程。这使得管理员可以利用 Drupal 的用户管理和集成能力来管理身份生命周期。

注意: 此软件使用 Drupal 作为用户数据库而不是 LDAP 来建立 SAML 身份提供者 (IdP)。如果您想将您的 Drupal 网站作为连接到 SAML 或 Shibboleth IdP 的 SAML 服务提供者 (SP),请参阅 Drupal 的 simplesamlphp_auth 模块。

simpleSAMLphp 模块

此 SimpleSAMLphp 模块为本地 Drupal 网站提供身份验证源。这使得管理员可以利用 Drupal 的用户管理和集成能力来管理身份生命周期和 SimpleSAMLphp 的身份集成能力。这是一个 simpleSAMLphp 模块,而不是 Drupal 模块。只有在您想使用 Drupal 作为身份提供者的情况下才下载此模块。

Drupal 模块

如果您想使用 Drupal 作为身份提供者,您还应该安装 Drupal.org 上可用的 drupalauth4ssp。请注意,所有与 Drupal 功能相关的问题都应在此处报告。

如果您想将您的 Drupal 网站作为服务提供者连接到 SAML 或 Shibboleth IdP,请使用 Drupal 的 simplesamlphp_auth 模块。

分支和版本命名

当有多个上游依赖项时,遵循 语义化版本控制 是一项挑战。

因此,在 X.Y.Z 版本中

  • X - 主 SimpleSAMLphp 版本
  • Y - 主 Drupal 版本
  • Z - 此模块的增量版本

示例:对于 SimpleSAMLphp 版本 1.15.4,Drupal 版本 8.5.6 和此模块版本 1,我们将有标签 1.8.1。对于 Drupal 7 将是 1.7.1。

main 目前对应于 2.10.*。分支 1.7 分别对应于 Drupal 7(无 Composer 集成)。

关于 Drupal 配置的说明

禁用 discovery 缓存将阻止此模块正常工作。

请参阅此问题 #71,特别是 此评论

安装

要求

  1. 安装 Drupal 10.x
  2. 安装 simpleSAMLphp
  3. 安装 drupalauth - composer require drupalauth/simplesamlphp-module-drupalauth
  4. 配置 SimpleSAMLphp 以使用除 phpsession 之外的其他方式来存储会话,例如 SQL 或 memcache(见:在 simplesamlphp/config/config.php 中的 store.type)。
  5. 按照以下说明配置 simplesamlphp/config/authsources.php 中的身份验证源。

对 Drupal 进行身份验证但使用 SimpleSAMLphp 登录页面

这种方式的优势是 SimpleSAMLphp IdP 和 Drupal 网站之间没有明显的联系。

详细信息

将以下代码放入 simplesamlphp/config/authsources.php 中来配置身份验证源

'drupal-userpass' => array(
    'drupalauth:UserPass',

    // The filesystem path of the Drupal directory.
    'drupalroot' => '/var/www/drupal',

    // Whether to turn on debug
    'debug' => true,

    // Which attributes should be retrieved from the Drupal site.
   'attributes' => array(
       array('field_name' => 'uid', 'attribute_name' => 'uid'),
       array('field_name' => 'roles', 'attribute_name' => 'roles', 'field_property' => 'target_id'),
       array('field_name' => 'name', 'attribute_name' => 'cn'),
       array('field_name' => 'mail', 'attribute_name' => 'mail'),
       array('field_name' => 'field_first_name', 'attribute_name' => 'givenName'),
       array('field_name' => 'field_last_name', 'attribute_name' => 'sn'),
       array('field_name' => 'field_organization', 'attribute_name' => 'ou', 'field_property' => 'target_id'),
   ),
),

保持 'attributes' 为空或未设置以获取所有可用字段值。在这种情况下,属性名称将是 "$field_name:$property_name"。

对 Drupal 进行身份验证但使用 Drupal 登录页面

这种方式的优势是 SimpleSAMLphp IdP 会话与 Drupal 会话相关联。这允许已经登录到 Drupal 网站的用户在导航到使用 IdP 的 SAML SP 时无需再次进行身份验证。

详细信息

将以下代码放入 simplesamlphp/config/authsources.php 中来配置身份验证源

'drupal-userpass' => array('drupalauth:External',

 // The filesystem path of the Drupal directory.
 'drupalroot' => '/var/www/drupal',

 // Whether to turn on debug
 'debug' => true,

 // the URL of the Drupal logout page
 'drupal_logout_url' => 'https://www.example.com/drupal/user/logout',

 // the URL of the Drupal login page
 'drupal_login_url' => 'https://www.example.com/drupal/user/login',

 // Which attributes should be retrieved from the Drupal site.
    'attributes' => array(
        array('field_name' => 'uid', 'attribute_name' => 'uid'),
        array('field_name' => 'roles', 'attribute_name' => 'roles', 'field_property' => 'target_id'),
        array('field_name' => 'name', 'attribute_name' => 'cn'),
        array('field_name' => 'mail', 'attribute_name' => 'mail'),
        array('field_name' => 'field_first_name', 'attribute_name' => 'givenName'),
        array('field_name' => 'field_last_name', 'attribute_name' => 'sn'),
        array('field_name' => 'field_organization', 'attribute_name' => 'ou', 'field_property' => 'target_id'),
    ),
),