departmentofhealth/yii2-dohclient
Composer 安装命令:
composer require departmentofhealth/yii2-dohclient
包简介
doh oauth2 client
关键字:
README 文档
README
การติดตั้ง
สามารถติดตั้งผ่าน composer โดยรันคำสั่ง
php composer require --prefer-dist departmentofhealth/yii2-dohclient "*"
หรือเพิ่มคำสั่งนี้
"departmentofhealth/yii2-dohclient": "*"
ที่ไฟล์ composer.json ในส่วนของ require
ลงทะเบียนเข้าใช้งาน DOH SSO
- ลงทะเบียนเข้าใช้งานที่ http://sso.anamai.moph.go.th
- กรอกข้อมูลส่วนตัว
- สร้าง Application และกรอก redirect url จะได้ clientID, clientSecret
การใช้งานร่วมกับ yii2-user
ตั้งค่า authClientCollection ที่ main.php ใสส่วนของ components
... 'authClientCollection' => [ 'class' => \yii\authclient\Collection::className(), 'httpClient' => [ 'transport' => 'yii\httpclient\CurlTransport', ], 'clients' => [ 'doh' => [ 'class' => 'departmentofhealth\yii2\dohclient\DohClientDektrium', 'clientId' => '<clientID>', 'clientSecret' => '<ClientSecret>', ], ], ], ...
ทำการ override view yii2-user และเรียกใช้งาน widget ที่หน้า login
<?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(); ?>
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2017-02-20