From c176c1cddcedfea1987def31ea79c93ceaa9b745 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 24 Jul 2013 13:14:48 -0400 Subject: [PATCH 1/5] Added contributors --- README.md | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index efe36404..ec1f603a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# The League of Extraordinary Packages presents: PHP OAuth 2.0 Server +# PHP OAuth 2.0 Server -The goal of this project is to develop a standards compliant [OAuth 2.0](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2/) authorization server and resource server. +A standards compliant [OAuth 2.0](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2/) authorization server and resource server written in PHP. ## Package Installation @@ -62,6 +62,37 @@ A tutorial on how to use the resource server to secure an API server can be foun The initial code was developed as part of the [Linkey](http://linkey.blogs.lincoln.ac.uk) project which was funded by [JISC](http://jisc.ac.uk) under the Access and Identity Management programme. -This code is principally developed and maintained by [@alexbilbie](https://twitter.com/alexbilbie). +This code is principally developed and maintained by [@alexbilbie](https://twitter.com/). -A list of contributors can be found at [https://github.com/php-loep/oauth2-server/contributors](https://github.com/php-loep/oauth2-server/contributors). \ No newline at end of file + +Credits +------- + +* [Alex Bilbie](https://github.com/alexbilbie) +* [Dan Horrigan](https://github.com/dandoescode) +* [Nick Jackson](https://github.com/jacksonj04) +* [Michael Gooden](https://github.com/MichaelGooden) +* [Phil Sturgeon] (https://github.com/philsturgeon) +* [All contributors](https://github.com/php-loep/oauth2-server/contributors) + +Changelog +--------- + +[See the changelog file](https://github.com/php-loep/oauth2-server/blob/master/CHANGELOG.md) + +Contributing +------------ + +Please see [CONTRIBUTING](https://github.com/php-loep/oauth2-server/blob/master/CONTRIBUTING.md) for details. + +Support +------- + +Bugs and feature request are tracked on [GitHub](https://github.com/php-loep/oauth2-server/issues) + + +License +------- + +oauth2-server is released under the MIT License. See the bundled +[LICENSE](https://github.com/php-loep/oauth2-server/blob/master/LICENSE) file for details. From 66ddba808fdc1f0157850c54058c969853104a56 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Fri, 26 Jul 2013 10:04:09 -0400 Subject: [PATCH 2/5] Fixed link to authorization server guide. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec1f603a..907f3a03 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ If you are using MySQL and want to very quickly implement the library then all o The wiki has lots of guides on how to use this library, check it out - [https://github.com/php-loep/oauth2-server/wiki](https://github.com/php-loep/oauth2-server/wiki). -A tutorial on how to use the authorization server can be found on the wiki - (https://github.com/php-loep/oauth2-server/wiki/Developing-an-OAuth-2.0-authorization-server)[https://github.com/php-loep/oauth2-server/wiki/Developing-an-OAuth-2.0-authorization-server]. +A tutorial on how to use the authorization server can be found at [https://github.com/php-loep/oauth2-server/wiki/Developing-an-OAuth-2.0-authorization-server](https://github.com/php-loep/oauth2-server/wiki/Developing-an-OAuth-2.0-authorization-server). A tutorial on how to use the resource server to secure an API server can be found at [https://github.com/php-loep/oauth2-server/wiki/Securing-your-API-with-OAuth-2.0](https://github.com/php-loep/oauth2-server/wiki/Securing-your-API-with-OAuth-2.0). From 85353c58440bd4ba1a4e156a5d1adff6314445da Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 8 Aug 2013 09:25:17 -0400 Subject: [PATCH 3/5] Test in PHP 5.5 too --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4f428b5f..10787e9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ language: php php: - 5.3 - 5.4 + - 5.5 before_script: composer install --dev -script: phpunit \ No newline at end of file +script: phpunit From 69531c3eb5ebd0a923c2b8f6f4d1229c89ce1e43 Mon Sep 17 00:00:00 2001 From: Matthew Hailwood Date: Wed, 4 Sep 2013 12:38:45 +1200 Subject: [PATCH 4/5] Adding auto_approve field to client details array. --- src/League/OAuth2/Server/Storage/PDO/Client.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/League/OAuth2/Server/Storage/PDO/Client.php b/src/League/OAuth2/Server/Storage/PDO/Client.php index 1fcb3642..d56a540f 100644 --- a/src/League/OAuth2/Server/Storage/PDO/Client.php +++ b/src/League/OAuth2/Server/Storage/PDO/Client.php @@ -11,17 +11,17 @@ class Client implements ClientInterface $db = \ezcDbInstance::get(); 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); } 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); } 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(':clientSecret', $clientSecret); } @@ -39,7 +39,8 @@ class Client implements ClientInterface 'client_id' => $row->id, 'client_secret' => $row->secret, 'redirect_uri' => (isset($row->redirect_uri)) ? $row->redirect_uri : null, - 'name' => $row->name + 'name' => $row->name, + 'auto_approve' => $row->auto_approve ); } -} \ No newline at end of file +} From e5dc3001c4661b948d57f2bea80c3617c1722348 Mon Sep 17 00:00:00 2001 From: Matthew Hailwood Date: Wed, 4 Sep 2013 12:43:12 +1200 Subject: [PATCH 5/5] Update ClientInterface.php --- .../OAuth2/Server/Storage/ClientInterface.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/League/OAuth2/Server/Storage/ClientInterface.php b/src/League/OAuth2/Server/Storage/ClientInterface.php index 72538561..ac1a485c 100644 --- a/src/League/OAuth2/Server/Storage/ClientInterface.php +++ b/src/League/OAuth2/Server/Storage/ClientInterface.php @@ -20,19 +20,21 @@ interface ClientInterface * * * # 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 * 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 + * 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 * * # 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 + * 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 * * * Response: @@ -44,6 +46,7 @@ interface ClientInterface * [client secret] => (string) The client secret * [redirect_uri] => (string) The redirect URI used in this request * [name] => (string) The name of the client + * [auto_approve] => (bool) Whether the client should auto approve * ) * * @@ -54,4 +57,4 @@ interface ClientInterface * @return bool|array Returns false if the validation fails, array on success */ public function getClient($clientId, $clientSecret = null, $redirectUri = null, $grantType = null); -} \ No newline at end of file +}