Skip to content

Commit

Permalink
Merge pull request hwi#668 from FirebornETF/master
Browse files Browse the repository at this point in the history
EVE Online Resource Owner
  • Loading branch information
stloyd committed Nov 15, 2014
2 parents 2bb9947 + 12d14ec commit 54746ec
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 0 deletions.
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Configuration implements ConfigurationInterface
'dailymotion',
'deviantart',
'disqus',
'eve_online',
'eventbrite',
'facebook',
'foursquare',
Expand Down
47 changes: 47 additions & 0 deletions OAuth/ResourceOwner/EveOnlineResourceOwner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

/*
* This file is part of the HWIOAuthBundle package.
*
* (c) Hardware.Info <[email protected]>
*
* 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 <[email protected]>
*/
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,
));
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This bundle contains support for 20+ different providers:
* DeviantArt,
* Disqus,
* Dropbox,
* EVE Online,
* Facebook,
* Flickr,
* Foursquare,
Expand Down
1 change: 1 addition & 0 deletions Resources/config/oauth.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<parameter key="hwi_oauth.resource_owner.deviantart.class">HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DeviantartResourceOwner</parameter>
<parameter key="hwi_oauth.resource_owner.disqus.class">HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DisqusResourceOwner</parameter>
<parameter key="hwi_oauth.resource_owner.dropbox.class">HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\DropboxResourceOwner</parameter>
<parameter key="hwi_oauth.resource_owner.eve_online.class">HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EveOnlineResourceOwner</parameter>
<parameter key="hwi_oauth.resource_owner.eventbrite.class">HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\EventbriteResourceOwner</parameter>
<parameter key="hwi_oauth.resource_owner.facebook.class">HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\FacebookResourceOwner</parameter>
<parameter key="hwi_oauth.resource_owner.flickr.class">HWI\Bundle\OAuthBundle\OAuth\ResourceOwner\FlickrResourceOwner</parameter>
Expand Down
1 change: 1 addition & 0 deletions Resources/doc/2-configuring_resource_owners.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_online.md)
- [Eventbrite](resource_owners/eventbrite.md)
- [Facebook](resource_owners/facebook.md)
- [Flickr](resource_owners/flickr.md)
Expand Down
40 changes: 40 additions & 0 deletions Resources/doc/resource_owners/eve_online.md
Original file line number Diff line number Diff line change
@@ -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_online
client_id: <client_id>
client_secret: <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_online
client_id: <client_id>
client_secret: <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).
35 changes: 35 additions & 0 deletions Tests/OAuth/ResourceOwner/EveOnlineResourceOwnerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/*
* This file is part of the HWIOAuthBundle package.
*
* (c) Hardware.Info <[email protected]>
*
* 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 = <<<json
{
"CharacterID": "1",
"CharacterName": "bar"
}
json;

protected $paths = array(
'identifier' => 'CharacterID',
'nickname' => 'CharacterName',
'realname' => 'CharacterName',
);

protected function setUpResourceOwner($name, $httpUtils, array $options)
{
return new EveOnlineResourceOwner($this->buzzClient, $httpUtils, $options, $name, $this->storage);
}
}

0 comments on commit 54746ec

Please sign in to comment.