Updated repository method names to be more explicit

This commit is contained in:
Alex Bilbie 2015-11-13 17:39:07 +00:00
parent 03e4ac7ea6
commit da8efa20cd
7 changed files with 40 additions and 35 deletions

View File

@ -22,11 +22,11 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface
/** /**
* Get an instance of Entity\AccessTokenEntity * Get an instance of Entity\AccessTokenEntity
* *
* @param string $tokenIdentifier The access token identifier * @param string $token The access token identifier
* *
* @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface * @return \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface
*/ */
public function get($tokenIdentifier); public function getAccessTokenEntityByTokenString($token);
/** /**
* Get the scopes for an access token * Get the scopes for an access token
@ -35,14 +35,14 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface
* *
* @return \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[] * @return \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface[]
*/ */
public function getScopes(AccessTokenEntityInterface $token); public function getScopeEntitiesAssociatedWithAccessToken(AccessTokenEntityInterface $token);
/** /**
* Creates a new access token * Persists a new access token to storage
* *
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessTokenEntity * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessTokenEntity
*/ */
public function create(AccessTokenEntityInterface $accessTokenEntity); public function persistNewAccessToken(AccessTokenEntityInterface $accessTokenEntity);
/** /**
* Associate a scope with an access token * Associate a scope with an access token
@ -50,12 +50,15 @@ interface AccessTokenRepositoryInterface extends RepositoryInterface
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessTokenEntityInterface * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessTokenEntityInterface
* @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface $scope * @param \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface $scope
*/ */
public function associateScope(AccessTokenEntityInterface $accessTokenEntityInterface, ScopeEntityInterface $scope); public function associateScopeWithAccessToken(
AccessTokenEntityInterface $accessTokenEntityInterface,
ScopeEntityInterface $scope
);
/** /**
* Delete an access token * Delete an access token
* *
* @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken * @param \League\OAuth2\Server\Entities\Interfaces\AccessTokenEntityInterface $accessToken
*/ */
public function delete(AccessTokenEntityInterface $accessToken); public function deleteAccessToken(AccessTokenEntityInterface $accessToken);
} }

View File

@ -25,24 +25,23 @@ interface AuthCodeRepositoryInterface extends RepositoryInterface
* *
* @return \League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface * @return \League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface
*/ */
public function get($code); public function getAuthCodeEntityByCodeString($code);
/** /**
* Create an auth code. * Persist a new authorization code
* *
* @param string $token The token ID * @param string $code The authorization code string
* @param integer $expireTime Token expire time * @param integer $expireTime Token expire time
* @param integer $sessionId Session identifier
* @param string $redirectUri Client redirect uri * @param string $redirectUri Client redirect uri
* *
* @return void * @return void
*/ */
public function create($token, $expireTime, $sessionId, $redirectUri); public function persistNewAuthCode($code, $expireTime, $redirectUri);
/** /**
* Delete an access token * Delete an access token
* *
* @param \League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface $token The access token to delete * @param \League\OAuth2\Server\Entities\Interfaces\AuthCodeEntityInterface $token The access token to delete
*/ */
public function delete(AuthCodeEntityInterface $token); public function deleteAuthCodeEntity(AuthCodeEntityInterface $token);
} }

View File

@ -26,5 +26,5 @@ interface ClientRepositoryInterface extends RepositoryInterface
* *
* @return \League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface * @return \League\OAuth2\Server\Entities\Interfaces\ClientEntityInterface
*/ */
public function get($clientIdentifier, $clientSecret = null, $redirectUri = null, $grantType = null); public function getClientEntity($clientIdentifier, $grantType, $clientSecret = null, $redirectUri = null);
} }

View File

@ -11,11 +11,13 @@
namespace League\OAuth2\Server\Storage; namespace League\OAuth2\Server\Storage;
use League\OAuth2\Server\Repositories\RepositoryInterface;
/** /**
* MacTokenInterface * MacTokenInterface
*/ */
interface MacTokenInterface extends StorageInterface interface MacTokenInterface extends RepositoryInterface
{ {
/** /**
* Create a MAC key linked to an access token * Create a MAC key linked to an access token
@ -23,12 +25,12 @@ interface MacTokenInterface extends StorageInterface
* @param string $accessToken * @param string $accessToken
* @return void * @return void
*/ */
public function create($macKey, $accessToken); public function persistMacTokenEntity($macKey, $accessToken);
/** /**
* Get a MAC key by access token * Get a MAC key by access token
* @param string $accessToken * @param string $accessToken
* @return string * @return string
*/ */
public function getByAccessToken($accessToken); public function getMacKeyByAccessTokenString($accessToken);
} }

View File

@ -11,6 +11,8 @@
namespace League\OAuth2\Server\Repositories; namespace League\OAuth2\Server\Repositories;
use League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface;
/** /**
* Refresh token interface * Refresh token interface
*/ */
@ -19,11 +21,11 @@ interface RefreshTokenRepositoryInterface extends RepositoryInterface
/** /**
* Return a new instance of \League\OAuth2\Server\Entity\RefreshTokenEntity * Return a new instance of \League\OAuth2\Server\Entity\RefreshTokenEntity
* *
* @param string $token * @param string $token Refresh token string
* *
* @return \League\OAuth2\Server\Entity\RefreshTokenEntity * @return \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface
*/ */
public function get($token); public function getRefreshTokenEntityByTokenString($token);
/** /**
* Create a new refresh token_name * Create a new refresh token_name
@ -32,16 +34,14 @@ interface RefreshTokenRepositoryInterface extends RepositoryInterface
* @param integer $expireTime * @param integer $expireTime
* @param string $accessToken * @param string $accessToken
* *
* @return \League\OAuth2\Server\Entity\RefreshTokenEntity * @return \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface
*/ */
public function create($token, $expireTime, $accessToken); public function persistNewRefreshTokenEntity($token, $expireTime, $accessToken);
/** /**
* Delete the refresh token * Delete the refresh token
* *
* @param \League\OAuth2\Server\Entity\RefreshTokenEntity $token * @param \League\OAuth2\Server\Entities\Interfaces\RefreshTokenEntityInterface $token
*
* @return void
*/ */
public function delete(RefreshTokenEntity $token); public function deleteRefreshTokenEntity(RefreshTokenEntityInterface $token);
} }

View File

@ -19,11 +19,11 @@ interface ScopeRepositoryInterface extends RepositoryInterface
/** /**
* Return information about a scope * Return information about a scope
* *
* @param string $scopeIdentifier The scope identifier * @param string $identifier The scope identifier
* @param string $grantType The grant type used in the request (default = "null") * @param string $grantType The grant type used in the request
* @param string $clientId The client sending the request (default = "null") * @param string $clientId The client sending the request
* *
* @return \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface * @return \League\OAuth2\Server\Entities\Interfaces\ScopeEntityInterface
*/ */
public function get($scopeIdentifier, $grantType = null, $clientId = null); public function getScopeEntityByIdentifier($identifier, $grantType, $clientId = null);
} }

View File

@ -1,15 +1,16 @@
<?php <?php
namespace League\OAuth2\Server\Repositories;
use League\OAuth2\Server\Entities\Interfaces\UserEntityInterface; namespace League\OAuth2\Server\Repositories;
interface UserRepositoryInterface extends RepositoryInterface interface UserRepositoryInterface extends RepositoryInterface
{ {
/** /**
* Get a user * Get a user entity
*
* @param string $username * @param string $username
* @param string $password * @param string $password
* @return UserEntityInterface *
* @return \League\OAuth2\Server\Entities\Interfaces\UserEntityInterface
*/ */
public function getByCredentials($username, $password); public function getUserEntityByUserCredentials($username, $password);
} }