From e13d636328da13b5de120e8c968955f81eb7de6b Mon Sep 17 00:00:00 2001 From: FirebornETF Date: Sat, 11 Oct 2014 17:05:42 +0200 Subject: [PATCH 1/4] EVE Online Resource Owner --- DependencyInjection/Configuration.php | 1 + .../ResourceOwner/EveOnlineResourceOwner.php | 47 +++++++++++++++++++ README.md | 1 + Resources/config/oauth.xml | 1 + .../doc/2-configuring_resource_owners.md | 1 + Resources/doc/resource_owners/eve.md | 40 ++++++++++++++++ .../EveOnlineResourceOwnerTest.php | 39 +++++++++++++++ 7 files changed, 130 insertions(+) create mode 100644 OAuth/ResourceOwner/EveOnlineResourceOwner.php create mode 100644 Resources/doc/resource_owners/eve.md create mode 100644 Tests/OAuth/ResourceOwner/EveOnlineResourceOwnerTest.php diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 11692d585..5bbd78bf7 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -37,6 +37,7 @@ class Configuration implements ConfigurationInterface 'dailymotion', 'deviantart', 'disqus', + 'eve', 'eventbrite', 'facebook', 'foursquare', diff --git a/OAuth/ResourceOwner/EveOnlineResourceOwner.php b/OAuth/ResourceOwner/EveOnlineResourceOwner.php new file mode 100644 index 000000000..9c4469030 --- /dev/null +++ b/OAuth/ResourceOwner/EveOnlineResourceOwner.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace HWI\Bundle\OAuthBundle\OAuth\ResourceOwner; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\OptionsResolver\OptionsResolverInterface; + +/** + * EveOnlineResourceOwner + * + * @author Ivan Stankovic + */ +class EveOnlineResourceOwner extends GenericOAuth2ResourceOwner +{ + /** + * {@inheritDoc} + */ + protected $paths = array( + 'identifier' => 'CharacterID', + 'nickname' => 'CharacterName', + 'realname' => 'CharacterName', + ); + + /** + * {@inheritDoc} + */ + protected function configureOptions(OptionsResolverInterface $resolver) + { + parent::configureOptions($resolver); + + $resolver->setDefaults(array( + 'authorization_url' => 'https://login.eveonline.com/oauth/authorize', + 'access_token_url' => 'https://login.eveonline.com/oauth/token', + 'infos_url' => 'https://login.eveonline.com/oauth/verify', + 'use_commas_in_scope' => true, + )); + } +} diff --git a/README.md b/README.md index c472c1805..e23d487fa 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ This bundle contains support for 20+ different providers: * DeviantArt, * Disqus, * Dropbox, +* EVE Online, * Facebook, * Flickr, * Foursquare, diff --git a/Resources/config/oauth.xml b/Resources/config/oauth.xml index 86ec81f64..f9b4b4194 100644 --- a/Resources/config/oauth.xml +++ b/Resources/config/oauth.xml @@ -25,6 +25,7 @@ HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DeviantartResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DisqusResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DropboxResourceOwner + HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EveOnlineResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EventbriteResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\FacebookResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\FlickrResourceOwner diff --git a/Resources/doc/2-configuring_resource_owners.md b/Resources/doc/2-configuring_resource_owners.md index a3e642e31..47dac330d 100644 --- a/Resources/doc/2-configuring_resource_owners.md +++ b/Resources/doc/2-configuring_resource_owners.md @@ -42,6 +42,7 @@ hwi_oauth: - [DeviantArt](resource_owners/deviantart.md) - [Disqus](resource_owners/disqus.md) - [Dropbox](resource_owners/dropbox.md) +- [EVE Online] (resource_owners/eve.md) - [Eventbrite](resource_owners/eventbrite.md) - [Facebook](resource_owners/facebook.md) - [Flickr](resource_owners/flickr.md) diff --git a/Resources/doc/resource_owners/eve.md b/Resources/doc/resource_owners/eve.md new file mode 100644 index 000000000..f9440f78a --- /dev/null +++ b/Resources/doc/resource_owners/eve.md @@ -0,0 +1,40 @@ +Step 2x: Setup EVE Online +===================== +First you will have to register your application on EVE: Developers website. Check out the +documentation for more information: https://developers.eveonline.com. + +Next configure a resource owner of type `eve` with appropriate +`client_id`, `client_secret` and `scope`. Refer to the EVE: Developers documentation +for the available scopes. + +```yaml +# app/config/config.yml + +hwi_oauth: + resource_owners: + any_name: + type: eve + client_id: + client_secret: +``` + +Optionally, for authenticating to EVE online test servers, you can override endpoint settings: + +```yaml +# app/config/config.yml +hwi_oauth: + resource_owners: + any_name: + type: eve + client_id: + client_secret: + authorization_url: https://sisilogin.testeveonline.com/oauth/authorize + access_token_url: https://sisilogin.testeveonline.com/oauth/token + infos_url: https://sisilogin.testeveonline.com/oauth/verify +``` + +When you're done. Continue by configuring the security layer or go back to +setup more resource owners. + +- [Step 2: Configuring resource owners (Facebook, GitHub, Google, Windows Live and others](../2-configuring_resource_owners.md) +- [Step 3: Configuring the security layer](../3-configuring_the_security_layer.md). diff --git a/Tests/OAuth/ResourceOwner/EveOnlineResourceOwnerTest.php b/Tests/OAuth/ResourceOwner/EveOnlineResourceOwnerTest.php new file mode 100644 index 000000000..5bb0e96d2 --- /dev/null +++ b/Tests/OAuth/ResourceOwner/EveOnlineResourceOwnerTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace HWI\Bundle\OAuthBundle\Tests\OAuth\ResourceOwner; + +use HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EveOnlineResourceOwner; + +class EveOnlineResourceOwnerTest extends GenericOAuth2ResourceOwnerTest +{ + protected $userResponse = << Date: Sat, 11 Oct 2014 17:33:06 +0200 Subject: [PATCH 3/4] Fix GenericOAuth2ResourceOwnerTest, user response JSON fixed --- Tests/OAuth/ResourceOwner/GenericOAuth2ResourceOwnerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/OAuth/ResourceOwner/GenericOAuth2ResourceOwnerTest.php b/Tests/OAuth/ResourceOwner/GenericOAuth2ResourceOwnerTest.php index b8921a049..54fe34162 100644 --- a/Tests/OAuth/ResourceOwner/GenericOAuth2ResourceOwnerTest.php +++ b/Tests/OAuth/ResourceOwner/GenericOAuth2ResourceOwnerTest.php @@ -42,7 +42,7 @@ class GenericOAuth2ResourceOwnerTest extends \PHPUnit_Framework_TestCase protected $userResponse = << Date: Tue, 14 Oct 2014 21:12:26 +0200 Subject: [PATCH 4/4] Changing type name: 'eve' to 'eve_online' --- DependencyInjection/Configuration.php | 2 +- Resources/config/oauth.xml | 2 +- Resources/doc/2-configuring_resource_owners.md | 2 +- Resources/doc/resource_owners/{eve.md => eve_online.md} | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename Resources/doc/resource_owners/{eve.md => eve_online.md} (94%) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 5bbd78bf7..99cfcae66 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -37,7 +37,7 @@ class Configuration implements ConfigurationInterface 'dailymotion', 'deviantart', 'disqus', - 'eve', + 'eve_online', 'eventbrite', 'facebook', 'foursquare', diff --git a/Resources/config/oauth.xml b/Resources/config/oauth.xml index f9b4b4194..ec550c2d9 100644 --- a/Resources/config/oauth.xml +++ b/Resources/config/oauth.xml @@ -25,7 +25,7 @@ HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DeviantartResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DisqusResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DropboxResourceOwner - HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EveOnlineResourceOwner + HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EveOnlineResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EventbriteResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\FacebookResourceOwner HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\FlickrResourceOwner diff --git a/Resources/doc/2-configuring_resource_owners.md b/Resources/doc/2-configuring_resource_owners.md index 47dac330d..a23046315 100644 --- a/Resources/doc/2-configuring_resource_owners.md +++ b/Resources/doc/2-configuring_resource_owners.md @@ -42,7 +42,7 @@ hwi_oauth: - [DeviantArt](resource_owners/deviantart.md) - [Disqus](resource_owners/disqus.md) - [Dropbox](resource_owners/dropbox.md) -- [EVE Online] (resource_owners/eve.md) +- [EVE Online] (resource_owners/eve_online.md) - [Eventbrite](resource_owners/eventbrite.md) - [Facebook](resource_owners/facebook.md) - [Flickr](resource_owners/flickr.md) diff --git a/Resources/doc/resource_owners/eve.md b/Resources/doc/resource_owners/eve_online.md similarity index 94% rename from Resources/doc/resource_owners/eve.md rename to Resources/doc/resource_owners/eve_online.md index f9440f78a..c29ec39be 100644 --- a/Resources/doc/resource_owners/eve.md +++ b/Resources/doc/resource_owners/eve_online.md @@ -13,7 +13,7 @@ for the available scopes. hwi_oauth: resource_owners: any_name: - type: eve + type: eve_online client_id: client_secret: ``` @@ -25,7 +25,7 @@ Optionally, for authenticating to EVE online test servers, you can override endp hwi_oauth: resource_owners: any_name: - type: eve + type: eve_online client_id: client_secret: authorization_url: https://sisilogin.testeveonline.com/oauth/authorize