mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
Merge pull request #92 from hailwood/patch-1
Adding 'auto_approve' to client details array (with updated interface docs)
This commit is contained in:
commit
ed427cba37
@ -20,19 +20,21 @@ interface ClientInterface
|
|||||||
*
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* # Client ID + redirect URI
|
* # Client ID + redirect URI
|
||||||
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name
|
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name,
|
||||||
|
* oauth_clients.auto_approve
|
||||||
* FROM oauth_clients LEFT JOIN oauth_client_endpoints ON oauth_client_endpoints.client_id = oauth_clients.id
|
* 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
|
* WHERE oauth_clients.id = :clientId AND oauth_client_endpoints.redirect_uri = :redirectUri
|
||||||
*
|
*
|
||||||
* # Client ID + client secret
|
* # Client ID + client secret
|
||||||
* SELECT oauth_clients.id, oauth_clients.secret, oauth_clients.name FROM oauth_clients WHERE
|
* SELECT oauth_clients.id, oauth_clients.secret, oauth_clients.name, oauth_clients.auto_approve FROM oauth_clients
|
||||||
* oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret
|
* WHERE oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret
|
||||||
*
|
*
|
||||||
* # Client ID + client secret + redirect URI
|
* # Client ID + client secret + redirect URI
|
||||||
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name FROM
|
* SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name,
|
||||||
* oauth_clients LEFT JOIN oauth_client_endpoints ON oauth_client_endpoints.client_id = oauth_clients.id
|
* oauth_clients.auto_approve FROM oauth_clients LEFT JOIN oauth_client_endpoints
|
||||||
* WHERE oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret AND
|
* ON oauth_client_endpoints.client_id = oauth_clients.id
|
||||||
* oauth_client_endpoints.redirect_uri = :redirectUri
|
* WHERE oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret AND
|
||||||
|
* oauth_client_endpoints.redirect_uri = :redirectUri
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* Response:
|
* Response:
|
||||||
@ -44,6 +46,7 @@ interface ClientInterface
|
|||||||
* [client secret] => (string) The client secret
|
* [client secret] => (string) The client secret
|
||||||
* [redirect_uri] => (string) The redirect URI used in this request
|
* [redirect_uri] => (string) The redirect URI used in this request
|
||||||
* [name] => (string) The name of the client
|
* [name] => (string) The name of the client
|
||||||
|
* [auto_approve] => (bool) Whether the client should auto approve
|
||||||
* )
|
* )
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
|
@ -11,17 +11,17 @@ class Client implements ClientInterface
|
|||||||
$db = \ezcDbInstance::get();
|
$db = \ezcDbInstance::get();
|
||||||
|
|
||||||
if ( ! is_null($redirectUri) && is_null($clientSecret)) {
|
if ( ! is_null($redirectUri) && is_null($clientSecret)) {
|
||||||
$stmt = $db->prepare('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');
|
$stmt = $db->prepare('SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name, oauth_clients.auto_approve 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');
|
||||||
$stmt->bindValue(':redirectUri', $redirectUri);
|
$stmt->bindValue(':redirectUri', $redirectUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ( ! is_null($clientSecret) && is_null($redirectUri)) {
|
elseif ( ! is_null($clientSecret) && is_null($redirectUri)) {
|
||||||
$stmt = $db->prepare('SELECT oauth_clients.id, oauth_clients.secret, oauth_clients.name FROM oauth_clients WHERE oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret');
|
$stmt = $db->prepare('SELECT oauth_clients.id, oauth_clients.secret, oauth_clients.name, oauth_clients.auto_approve FROM oauth_clients WHERE oauth_clients.id = :clientId AND oauth_clients.secret = :clientSecret');
|
||||||
$stmt->bindValue(':clientSecret', $clientSecret);
|
$stmt->bindValue(':clientSecret', $clientSecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ( ! is_null($clientSecret) && ! is_null($redirectUri)) {
|
elseif ( ! is_null($clientSecret) && ! is_null($redirectUri)) {
|
||||||
$stmt = $db->prepare('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');
|
$stmt = $db->prepare('SELECT oauth_clients.id, oauth_clients.secret, oauth_client_endpoints.redirect_uri, oauth_clients.name, oauth_clients.auto_approve 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');
|
||||||
$stmt->bindValue(':redirectUri', $redirectUri);
|
$stmt->bindValue(':redirectUri', $redirectUri);
|
||||||
$stmt->bindValue(':clientSecret', $clientSecret);
|
$stmt->bindValue(':clientSecret', $clientSecret);
|
||||||
}
|
}
|
||||||
@ -39,7 +39,8 @@ class Client implements ClientInterface
|
|||||||
'client_id' => $row->id,
|
'client_id' => $row->id,
|
||||||
'client_secret' => $row->secret,
|
'client_secret' => $row->secret,
|
||||||
'redirect_uri' => (isset($row->redirect_uri)) ? $row->redirect_uri : null,
|
'redirect_uri' => (isset($row->redirect_uri)) ? $row->redirect_uri : null,
|
||||||
'name' => $row->name
|
'name' => $row->name,
|
||||||
|
'auto_approve' => $row->auto_approve
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user