-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-Authored-By: Ryan Weaver <[email protected]>
- Loading branch information
1 parent
1483e39
commit ca168d6
Showing
4 changed files
with
129 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,34 @@ | ||
<?php | ||
|
||
/* | ||
* OAuth2 Client Bundle | ||
* Copyright (c) KnpUniversity <http://knpuniversity.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KnpU\OAuth2ClientBundle\Client\Provider; | ||
|
||
use KnpU\OAuth2ClientBundle\Client\OAuth2Client; | ||
use League\OAuth2\Client\Provider\ResourceOwnerInterface; | ||
use League\OAuth2\Client\Token\AccessToken; | ||
|
||
class SpotifyClient extends OAuth2Client | ||
{ | ||
/** | ||
* @return \Kerox\OAuth2\Client\Provider\SpotifyResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface | ||
*/ | ||
public function fetchUserFromToken(AccessToken $accessToken): ResourceOwnerInterface | ||
{ | ||
return parent::fetchUserFromToken($accessToken); | ||
} | ||
|
||
/** | ||
* @return \Kerox\OAuth2\Client\Provider\SpotifyResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface | ||
*/ | ||
public function fetchUser(): ResourceOwnerInterface | ||
{ | ||
return parent::fetchUser(); | ||
} | ||
} |
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
77 changes: 77 additions & 0 deletions
77
src/DependencyInjection/Providers/SpotifyProviderConfigurator.php
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,77 @@ | ||
<?php | ||
|
||
/* | ||
* OAuth2 Client Bundle | ||
* Copyright (c) KnpUniversity <http://knpuniversity.com/> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers; | ||
|
||
use Kerox\OAuth2\Client\Provider\Spotify; | ||
use KnpU\OAuth2ClientBundle\Client\Provider\SpotifyClient; | ||
use Symfony\Component\Config\Definition\Builder\NodeBuilder; | ||
|
||
class SpotifyProviderConfigurator implements ProviderConfiguratorInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function buildConfiguration(NodeBuilder $node): void | ||
{ | ||
// no custom options | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getProviderClass(array $configuration): string | ||
{ | ||
return Spotify::class; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getClientClass(array $config): string | ||
{ | ||
return SpotifyClient::class; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getProviderOptions(array $configuration): array | ||
{ | ||
return [ | ||
'clientId' => $configuration['client_id'], | ||
'clientSecret' => $configuration['client_secret'], | ||
]; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getPackagistName(): string | ||
{ | ||
return 'kerox/oauth2-spotify'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getLibraryHomepage(): string | ||
{ | ||
return 'https://github.com/ker0x/oauth2-spotify'; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getProviderDisplayName(): string | ||
{ | ||
return 'Spotify'; | ||
} | ||
} |