From 1ed4c274207c3795673c90dd3c7624396709813c Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Tue, 29 Jan 2013 14:23:28 +0000 Subject: [PATCH] Update ClientInterface with get() method --- src/OAuth2/Storage/ClientInterface.php | 43 ++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/OAuth2/Storage/ClientInterface.php b/src/OAuth2/Storage/ClientInterface.php index d0d7fb7d..bb339ffc 100644 --- a/src/OAuth2/Storage/ClientInterface.php +++ b/src/OAuth2/Storage/ClientInterface.php @@ -4,5 +4,44 @@ namespace OAuth2\Storage; interface ClientInterface { - -} + /** + * Validate a client + * + * Example SQL query: + * + * + * # Client ID + redirect URI + * SELECT clients.id FROM clients LEFT JOIN client_endpoints ON + * client_endpoints.client_id = clients.id WHERE clients.id = $clientId AND + * client_endpoints.redirect_uri = $redirectUri + * + * # Client ID + client secret + * SELECT clients.id FROM clients WHERE clients.id = $clientId AND + * clients.secret = $clientSecret + * + * # Client ID + client secret + redirect URI + * SELECT clients.id FROM clients LEFT JOIN client_endpoints ON + * client_endpoints.client_id = clients.id WHERE clients.id = $clientId AND + * clients.secret = $clientSecret AND client_endpoints.redirect_uri = + * $redirectUri + * + * + * Response: + * + * + * 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 + * ) + * + * + * @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") + * @return bool|array Returns false if the validation fails, array on success + */ + public function get($clientId = null, $clientSecret = null, $redirectUri = null); +} \ No newline at end of file