mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Все классы, отвечающие за oAuth передвинуты в компоненты API, освежён код, поправлены неймспейсы
This commit is contained in:
27
api/components/OAuth2/Storage/ScopeStorage.php
Normal file
27
api/components/OAuth2/Storage/ScopeStorage.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace api\components\OAuth2\Storage;
|
||||
|
||||
use api\components\OAuth2\Entities\ScopeEntity;
|
||||
use common\models\OauthScope;
|
||||
use League\OAuth2\Server\Storage\AbstractStorage;
|
||||
use League\OAuth2\Server\Storage\ScopeInterface;
|
||||
|
||||
class ScopeStorage extends AbstractStorage implements ScopeInterface {
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function get($scope, $grantType = null, $clientId = null) {
|
||||
/** @var OauthScope|null $row */
|
||||
$row = OauthScope::findOne($scope);
|
||||
if ($row === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$entity = new ScopeEntity($this->server);
|
||||
$entity->setId($row->id);
|
||||
|
||||
return $entity;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user