Skip to content

Commit 2a96807

Browse files
committed
Improved documentation
1 parent 2543f09 commit 2a96807

File tree

3 files changed

+351
-1
lines changed

3 files changed

+351
-1
lines changed

src/LucaDegasperi/OAuth2Server/Repositories/FluentClient.php

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,46 @@
66

77
class FluentClient implements ClientInterface
88
{
9-
9+
/**
10+
* Validate a client
11+
*
12+
* Example SQL query:
13+
*
14+
* <code>
15+
* # Client ID + redirect URI
16+
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name
17+
* FROM oauth_clients LEFT JOIN oauth_client_endpoints ON oauth_client_endpoints.client_id = oauth_clients.id
18+
* WHERE oauth_clients.id = :clientId AND oauth_client_endpoints.redirect_uri = :redirectUri
19+
*
20+
* # Client ID + client secret
21+
* SELECT oauth_clients.id, oauth_clients.secret, oauth_clients.name FROM oauth_clients WHERE
22+
* oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret
23+
*
24+
* # Client ID + client secret + redirect URI
25+
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name FROM
26+
* oauth_clients LEFT JOIN oauth_client_endpoints ON oauth_client_endpoints.client_id = oauth_clients.id
27+
* WHERE oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret AND
28+
* oauth_client_endpoints.redirect_uri = :redirectUri
29+
* </code>
30+
*
31+
* Response:
32+
*
33+
* <code>
34+
* Array
35+
* (
36+
* [client_id] => (string) The client ID
37+
* [client secret] => (string) The client secret
38+
* [redirect_uri] => (string) The redirect URI used in this request
39+
* [name] => (string) The name of the client
40+
* )
41+
* </code>
42+
*
43+
* @param string $clientId The client's ID
44+
* @param string $clientSecret The client's secret (default = "null")
45+
* @param string $redirectUri The client's redirect URI (default = "null")
46+
* @param string $grantType The grant type used in the request (default = "null")
47+
* @return bool|array Returns false if the validation fails, array on success
48+
*/
1049
public function getClient($clientId, $clientSecret = null, $redirectUri = null, $grantType = null)
1150
{
1251
$query = null;

src/LucaDegasperi/OAuth2Server/Repositories/FluentScope.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,32 @@
77
class FluentScope implements ScopeInterface
88
{
99

10+
/**
11+
* Return information about a scope
12+
*
13+
* Example SQL query:
14+
*
15+
* <code>
16+
* SELECT * FROM oauth_scopes WHERE scope = :scope
17+
* </code>
18+
*
19+
* Response:
20+
*
21+
* <code>
22+
* Array
23+
* (
24+
* [id] => (int) The scope's ID
25+
* [scope] => (string) The scope itself
26+
* [name] => (string) The scope's name
27+
* [description] => (string) The scope's description
28+
* )
29+
* </code>
30+
*
31+
* @param string $scope The scope
32+
* @param string $clientId The client ID (default = "null")
33+
* @param string $grantType The grant type used in the request (default = "null")
34+
* @return bool|array If the scope doesn't exist return false
35+
*/
1036
public function getScope($scope, $clientId = null, $grantType = null)
1137
{
1238
$query = DB::table('oauth_scopes')

0 commit comments

Comments
 (0)