健康部门/yii2-dohclient

doh oauth2 客户端

安装: 10

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

0.9.2 2017-02-21 04:07 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:36:56 UTC


README

安装方法

可以通过运行 composer 命令来安装

php composer require --prefer-dist departmentofhealth/yii2-dohclient "*"

或者将以下命令添加到

"departmentofhealth/yii2-dohclient": "*"

文件 composer.json 中的 require 部分

注册 DOH SSO

yii2-user 一起使用

在 main.php 中 components 部分设置 authClientCollection

...

        'authClientCollection' => [
            'class'   => \yii\authclient\Collection::className(),
            'httpClient' => [
                'transport' => 'yii\httpclient\CurlTransport',
            ],
            'clients' => [
               'doh' => [
                    'class' => 'departmentofhealth\yii2\dohclient\DohClientDektrium',
                    'clientId' => '<clientID>',
                    'clientSecret' => '<ClientSecret>',
                ],
            ],
        ],
...

重写 yii2-user 视图并在登录页面调用 widget

<?php
    $authAuthChoice = AuthChoice::begin([
        'baseAuthUrl' => ['/user/security/auth'],
        'popupMode' => false,
        'options'=>[
            'class'=>'auth-clients text-center',
        ]
    ]);
    echo 'Login with: ';
    foreach ($authAuthChoice->getClients() as $key => $client): ?>
<?= $authAuthChoice->clientLink($client,strtoupper($key));?>
<?php endforeach; ?>
<?php AuthChoice::end(); ?>