Skip to content

Commit

Permalink
Updated docblocks and example queries in scope and client storage int…
Browse files Browse the repository at this point in the history
…erfaces
  • Loading branch information
alexbilbie committed May 9, 2013
1 parent 75894fd commit ca9760c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 42 deletions.
78 changes: 40 additions & 38 deletions src/League/OAuth2/Server/Storage/ClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,45 @@

interface ClientInterface
{
/**
* Validate a client
*
* Example SQL query:
*
* <code>
* # Client ID + redirect URI
* SELECT oauth_clients.id FROM oauth_clients LEFT JOIN client_endpoints ON client_endpoints.client_id
* = oauth_clients.id WHERE oauth_clients.id = $clientId AND client_endpoints.redirect_uri = $redirectUri
*
* # Client ID + client secret
* SELECT oauth_clients.id FROM oauth_clients WHERE oauth_clients.id = $clientId AND
* oauth_clients.secret = $clientSecret
*
* # Client ID + client secret + redirect URI
* SELECT oauth_clients.id FROM oauth_clients LEFT JOIN client_endpoints ON client_endpoints.client_id
* = oauth_clients.id WHERE oauth_clients.id = $clientId AND oauth_clients.secret = $clientSecret
* AND client_endpoints.redirect_uri = $redirectUri
* </code>
*
* Response:
*
* <code>
* Array
* (
* [client_id] => (string) The client ID
* [client secret] => (string) The client secret
* [redirect_uri] => (string) The redirect URI used in this request
* [name] => (string) The name of the client
* )
* </code>
*
* @param string $clientId The client's ID
* @param string $clientSecret The client's secret (default = "null")
* @param string $redirectUri The client's redirect URI (default = "null")
* @param string $grantType The grant type used in the request
* @return bool|array Returns false if the validation fails, array on success
*/
/**
* Validate a client
*
* Example SQL query:
*
* <code>
* # Client ID + redirect URI
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name
* FROM oauth_clients LEFT JOIN oauth_client_endpoints ON oauth_client_endpoints.client_id = oauth_clients.id
* WHERE oauth_clients.id = :clientId AND oauth_client_endpoints.redirect_uri = :redirectUri
*
* # Client ID + client secret
* SELECT oauth_clients.id, oauth_clients.secret, oauth_clients.name FROM oauth_clients WHERE
* oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret
*
* # Client ID + client secret + redirect URI
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name FROM
* oauth_clients LEFT JOIN oauth_client_endpoints ON oauth_client_endpoints.client_id = oauth_clients.id
* WHERE oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret AND
* oauth_client_endpoints.redirect_uri = :redirectUri
* </code>
*
* Response:
*
* <code>
* Array
* (
* [client_id] => (string) The client ID
* [client secret] => (string) The client secret
* [redirect_uri] => (string) The redirect URI used in this request
* [name] => (string) The name of the client
* )
* </code>
*
* @param string $clientId The client's ID
* @param string $clientSecret The client's secret (default = "null")
* @param string $redirectUri The client's redirect URI (default = "null")
* @param string $grantType The grant type used in the request
* @return bool|array Returns false if the validation fails, array on success
*/
public function getClient($clientId = null, $clientSecret = null, $redirectUri = null, $grantType = null);
}
9 changes: 5 additions & 4 deletions src/League/OAuth2/Server/Storage/ScopeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface ScopeInterface
* Example SQL query:
*
* <code>
* SELECT * FROM oauth_scopes WHERE scope = $scope
* SELECT * FROM oauth_scopes WHERE oauth_scopes.key = :scope
* </code>
*
* Response:
Expand All @@ -28,14 +28,15 @@ interface ScopeInterface
* Array
* (
* [id] => (int) The scope's ID
* [scope] => (string) The scope itself
* [key] => (string) The scope itself
* [name] => (string) The scope's name
* [description] => (string) The scope's description
* )
* </code>
*
* @param string $scope The scope
* @param string $clientId The client ID
* @param string $scope The scope
* @param string $clientId The client ID
* @param string $grantType The grant type used in the request
* @return bool|array If the scope doesn't exist return false
*/
public function getScope($scope, $clientId = null, $grantType = null);
Expand Down

0 comments on commit ca9760c

Please sign in to comment.