Реализация интерфейсов из библиотеки

This commit is contained in:
Artem Vasilev 2024-03-04 03:18:17 +03:00
parent 5ebfb663d7
commit 3639054898
5 changed files with 157 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<?php
namespace Webmasterskaya\Component\OauthServer\Site\Repository;
use Joomla\CMS\MVC\Factory\MVCFactoryAwareTrait;
use League\OAuth2\Server\Entities\AccessTokenEntityInterface;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Entities\Traits\AccessTokenTrait;
use League\OAuth2\Server\Entities\Traits\EntityTrait;
use League\OAuth2\Server\Entities\Traits\TokenEntityTrait;
use League\OAuth2\Server\Repositories\AccessTokenRepositoryInterface;
class AccessTokenRepository implements AccessTokenRepositoryInterface
{
use AccessTokenTrait;
use EntityTrait;
use TokenEntityTrait;
use MVCFactoryAwareTrait;
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
{
// TODO: Implement getNewToken() method.
}
public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity)
{
// TODO: Implement persistNewAccessToken() method.
}
public function revokeAccessToken($tokenId)
{
// TODO: Implement revokeAccessToken() method.
}
public function isAccessTokenRevoked($tokenId)
{
// TODO: Implement isAccessTokenRevoked() method.
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Webmasterskaya\Component\OauthServer\Site\Repository;
use League\OAuth2\Server\Entities\AuthCodeEntityInterface;
use League\OAuth2\Server\Repositories\AuthCodeRepositoryInterface;
class AuthCodeRepository implements AuthCodeRepositoryInterface
{
public function getNewAuthCode()
{
// TODO: Implement getNewAuthCode() method.
}
public function persistNewAuthCode(AuthCodeEntityInterface $authCodeEntity)
{
// TODO: Implement persistNewAuthCode() method.
}
public function revokeAuthCode($codeId)
{
// TODO: Implement revokeAuthCode() method.
}
public function isAuthCodeRevoked($codeId)
{
// TODO: Implement isAuthCodeRevoked() method.
}
}

View File

@ -0,0 +1,37 @@
<?php
namespace Webmasterskaya\Component\OauthServer\Site\Repository;
use Joomla\CMS\MVC\Factory\MVCFactoryAwareTrait;
use Joomla\CMS\MVC\Factory\MVCFactoryInterface;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Repositories\ClientRepositoryInterface;
class ClientRepository implements ClientRepositoryInterface
{
use MVCFactoryAwareTrait;
public function __construct(MVCFactoryInterface $MVCFactory)
{
$this->setMVCFactory($MVCFactory);
}
/**
* @param $clientIdentifier
* @return \League\OAuth2\Server\Entities\ClientEntityInterface
* @throws \Exception
* @since version
*/
public function getClientEntity($clientIdentifier): ClientEntityInterface
{
/** @var \Webmasterskaya\Component\OauthServer\Administrator\Table\ClientTable $table */
$table = $this->getMVCFactory()->createTable('Client', 'Administrator');
$table->load(['identifier' => $clientIdentifier]);
return $table;
}
public function validateClient($clientIdentifier, $clientSecret, $grantType)
{
// TODO: Implement validateClient() method.
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace Webmasterskaya\Component\OauthServer\Site\Repository;
use League\OAuth2\Server\Entities\RefreshTokenEntityInterface;
use League\OAuth2\Server\Repositories\RefreshTokenRepositoryInterface;
class RefreshTokenRepository implements RefreshTokenRepositoryInterface
{
public function getNewRefreshToken()
{
// TODO: Implement getNewRefreshToken() method.
}
public function persistNewRefreshToken(RefreshTokenEntityInterface $refreshTokenEntity)
{
// TODO: Implement persistNewRefreshToken() method.
}
public function revokeRefreshToken($tokenId)
{
// TODO: Implement revokeRefreshToken() method.
}
public function isRefreshTokenRevoked($tokenId)
{
// TODO: Implement isRefreshTokenRevoked() method.
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Webmasterskaya\Component\OauthServer\Site\Repository;
use League\OAuth2\Server\Entities\ClientEntityInterface;
use League\OAuth2\Server\Repositories\ScopeRepositoryInterface;
class ScopeRepository implements ScopeRepositoryInterface
{
public function getScopeEntityByIdentifier($identifier)
{
// TODO: Implement getScopeEntityByIdentifier() method.
}
public function finalizeScopes(array $scopes, $grantType, ClientEntityInterface $clientEntity, $userIdentifier = null)
{
// TODO: Implement finalizeScopes() method.
}
}