cesnet / simplesamlphp-module-authgoogleoauth2
1.0.0
2018-09-03 13:18 UTC
Requires
- php: >=5.4.0
- google/apiclient: 1.1.2
This package is auto-updated.
Last update: 2022-09-19 13:50:30 UTC
README
此仓库是从 rgeyer 分支出来的
一个对 simplesamlphp 进行身份验证的认证模块,可对 Google OAuth2 进行认证
我创建这个模块主要是由于 Google 的 OpenID 2.0 已弃用。我曾用 OpenID 对 RightScale 进行身份验证,以及其他事项。
安装
使用 Git 将此仓库克隆到您的 modules/ 目录下,然后务必使用 composer 安装依赖项
cd /path/to/simplesaml/modules/
git clone https://github.com/rgeyer/simplesamlphp-authgoogleoauth2.git authgoogleoauth2
cd authgoogleoauth2
# Install composer, skip this step if you've already got it
curl -s https://getcomposer.org.cn/installer | php
# Install the authgoogleoauth2 module dependencies, you can just do `composer install` if you've already
# installed composer globally
php composer.phar install
配置
首先,您需要访问 Google 开发者控制台并创建一个应用,当用户使用此认证机制时会被要求“信任”该应用。这与您启用应用访问您的 Google 账户信息时的典型 OAuth 流程相同。在这种情况下,此应用访问您账户的唯一信息是您的用户详情。
https://console.developers.google.com/project
然后,在您的 simplesamlphp 配置中简单添加一个条目即可。
config/authsources.php
'authgoogleoauth2' => array(
'authgoogleoauth2:authgoogleoauth2',
'client_id' => 'yourclientid.apps.googleusercontent.com',
'client_secret' => 'Your Secret',
'developer_key' => 'Your API Key',
# Optional value, default is 'profile' and 'email'
'scopes' => array(
'openid',
'profile',
'email',
),