归档
This commit is contained in:
13
oauth2/server.php
Normal file
13
oauth2/server.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
include '../includes/common.php';
|
||||
|
||||
/** 配置 */
|
||||
$storage = new OAuth2\Storage\Pdo(array('dsn' => 'mysql:dbname='.$dbconfig['dbname'].';host='.$dbconfig['host'], 'username' => $dbconfig['user'], 'password' => $dbconfig['pwd']));
|
||||
// 通过存储对象或对象数组存储的oauth2服务器类
|
||||
$server = new OAuth2\Server($storage);
|
||||
// 授权码 有效期只有30秒
|
||||
$server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage));
|
||||
// 客户端证书
|
||||
$server->addGrantType(new OAuth2\GrantType\ClientCredentials($storage));
|
||||
// 用户凭据
|
||||
$server->addGrantType(new OAuth2\GrantType\UserCredentials($storage));
|
||||
Reference in New Issue
Block a user