silinternational/idp-pw-api-passwordstore-google

此包已被废弃,不再维护。没有建议的替代包。

使用Google作为后端密码存储组件的IdP PW API。

1.0.0 2017-06-21 17:31 UTC

This package is auto-updated.

Last update: 2020-03-13 19:52:58 UTC


README

此仓库不再维护。它已被集成到idp-pw-api中。

idp-pw-api-passwordstore-google

使用Google作为后端密码存储组件的IdP PW API。

使用方法

  1. https://console.developers.google.com/上创建一个项目。
  2. 在Google开发者控制台中,创建一个服务帐户。
  3. 勾选“提供新的私钥”和“启用G Suite域内委托”。
  4. 保存它提供的JSON文件(包含您的私钥),但不要将其存储在公共版本控制中(例如在公共GitHub仓库中)。
  5. 在Google开发者控制台中为您的项目启用“Admin SDK”API。
  6. 让相关Google Apps域的管理员访问http://admin.google.com/,在安全,高级,管理API客户端访问下,授予您的客户端ID以下范围的访问权限
    https://www.googleapis.com/auth/admin.directory.user
  7. 在Google Apps中设置一个委托管理员帐户,授权修改用户。您将使用该电子邮件地址作为环境变量的值。
  8. 请参阅local.env.dist文件,了解使用此库时需要提供哪些环境变量。

示例配置

$googlePasswordStore = new GooglePasswordStore([
    
    // Required config fields (dummy values are shown here):
    'applicationName' => 'Name of Your Application',
    'delegatedAdminEmail' => 'some_admin@yourgoogledomain.com',
    
    // You must provide one of these two fields:
    'jsonAuthConfigBase64' => '...', // A base64-encoded string of the JSON
                                     // auth file provided by Google.
    'jsonAuthFilePath' => '/somewhere/in/your/filesystem/google-auth.json',
    
    // Optional config fields (current defaults are shown here):
    'emailFieldName' => 'email',
    'employeeIdFieldName' => 'employee_id',
    'userActiveRecordClass' => '\common\models\User',
]);

有关每个字段用途的详细信息,请参阅/src/Google.php文件中的文档注释。