forked from hwi/HWIOAuthBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request hwi#668 from FirebornETF/master
EVE Online Resource Owner
- Loading branch information
Showing
7 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |