diff --git a/README.md b/README.md index 20d82323..f6699c24 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ via Composer: | OAuth2 Provider | Install | | --------------------------------------------------------------------- | ------------------------------------------------------ | +| [Amazon](https://github.com/luchianenco/oauth2-amazon) | composer require luchianenco/oauth2-amazon | | [Auth0](https://github.com/RiskioFr/oauth2-auth0) | composer require riskio/oauth2-auth0 | | [Azure](https://github.com/thenetworg/oauth2-azure) | composer require thenetworg/oauth2-azure | | [Bitbucket](https://github.com/stevenmaguire/oauth2-bitbucket) | composer require stevenmaguire/oauth2-bitbucket | @@ -65,7 +66,9 @@ via Composer: | [Drupal](https://github.com/chrishemmings/oauth2-drupal) | composer require chrishemmings/oauth2-drupal | | [Eve Online](https://github.com/evelabs/oauth2-eveonline) | composer require evelabs/oauth2-eveonline | | [Facebook](https://github.com/thephpleague/oauth2-facebook) | composer require league/oauth2-facebook | +| [Fitbit](https://github.com/djchen/oauth2-fitbit) | composer require djchen/oauth2-fitbit | | [HeadHunter](https://github.com/AlexMasterov/oauth2-headhunter) | composer require alexmasterov/oauth2-headhunter | +| [Heroku](https://github.com/stevenmaguire/oauth2-heroku) | composer require stevenmaguire/oauth2-heroku | | [Instagram](https://github.com/thephpleague/oauth2-instagram) | composer require league/oauth2-instagram | | [GitHub](https://github.com/thephpleague/oauth2-github) | composer require league/oauth2-github | | [GitLab](https://github.com/omines/oauth2-gitlab) | composer require omines/oauth2-gitlab | @@ -73,7 +76,9 @@ via Composer: | [LinkedIn](https://github.com/thephpleague/oauth2-linkedin) | composer require league/oauth2-linkedin | | [Microsoft](https://github.com/stevenmaguire/oauth2-microsoft) | composer require stevenmaguire/oauth2-microsoft | | [Odnoklassniki](https://github.com/rakeev/oauth2-odnoklassniki) | composer require aego/oauth2-odnoklassniki | +| [Paypal](https://github.com/stevenmaguire/oauth2-paypal) | composer require stevenmaguire/oauth2-paypal | | [Slack](https://github.com/adam-paterson/oauth2-slack) | composer require adam-paterson/oauth2-slack | +| [Stripe](https://github.com/adam-paterson/oauth2-stripe) | composer require adam-paterson/oauth2-stripe | | [Vimeo](https://github.com/saf33r/oauth2-vimeo) | composer require saf33r/oauth2-vimeo | | [VKontakte](https://github.com/j4k/oauth2-vkontakte) | composer require j4k/oauth2-vkontakte | | [Yahoo](https://github.com/hayageek/oauth2-yahoo) | composer require hayageek/oauth2-yahoo | @@ -326,6 +331,22 @@ any provider. # app/config/config.yml knpu_oauth2_client: clients: + # will create service: "knpu.oauth2.client.amazon" + # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\AmazonClient + # composer require luchianenco/oauth2-amazon + amazon: + # must be "amazon" - it activates that type! + type: amazon + # add and configure client_id and client_secret in parameters.yml + client_id: %amazon_client_id% + client_secret: %amazon_client_secret% + # a route name you'll create + redirect_route: connect_amazon_check + redirect_params: {} + + # whether to check OAuth2 "state": defaults to true + # use_state: true + # will create service: "knpu.oauth2.client.auth0" # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\Auth0Client # composer require riskio/oauth2-auth0 @@ -470,6 +491,22 @@ knpu_oauth2_client: # whether to check OAuth2 "state": defaults to true # use_state: true + # will create service: "knpu.oauth2.client.fitbit" + # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\FitbitClient + # composer require djchen/oauth2-fitbit + fitbit: + # must be "fitbit" - it activates that type! + type: fitbit + # add and configure client_id and client_secret in parameters.yml + client_id: %fitbit_client_id% + client_secret: %fitbit_client_secret% + # a route name you'll create + redirect_route: connect_fitbit_check + redirect_params: {} + + # whether to check OAuth2 "state": defaults to true + # use_state: true + # will create service: "knpu.oauth2.client.headhunter" # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\HeadHunterClient # composer require alexmasterov/oauth2-headhunter @@ -486,6 +523,22 @@ knpu_oauth2_client: # whether to check OAuth2 "state": defaults to true # use_state: true + # will create service: "knpu.oauth2.client.heroku" + # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\HerokuClient + # composer require stevenmaguire/oauth2-heroku + heroku: + # must be "heroku" - it activates that type! + type: heroku + # add and configure client_id and client_secret in parameters.yml + client_id: %heroku_client_id% + client_secret: %heroku_client_secret% + # a route name you'll create + redirect_route: connect_heroku_check + redirect_params: {} + + # whether to check OAuth2 "state": defaults to true + # use_state: true + # will create service: "knpu.oauth2.client.instagram" # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\InstagramClient # composer require league/oauth2-instagram @@ -609,6 +662,23 @@ knpu_oauth2_client: # whether to check OAuth2 "state": defaults to true # use_state: true + # will create service: "knpu.oauth2.client.paypal" + # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\PaypalClient + # composer require stevenmaguire/oauth2-paypal + paypal: + # must be "paypal" - it activates that type! + type: paypal + # add and configure client_id and client_secret in parameters.yml + client_id: %paypal_client_id% + client_secret: %paypal_client_secret% + # a route name you'll create + redirect_route: connect_paypal_check + redirect_params: {} + # When true, client uses Paypal Sandbox URLs. + # is_sandbox: false + # whether to check OAuth2 "state": defaults to true + # use_state: true + # will create service: "knpu.oauth2.client.slack" # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\SlackClient # composer require adam-paterson/oauth2-slack @@ -625,6 +695,22 @@ knpu_oauth2_client: # whether to check OAuth2 "state": defaults to true # use_state: true + # will create service: "knpu.oauth2.client.stripe" + # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\StripeClient + # composer require adam-paterson/oauth2-stripe + stripe: + # must be "stripe" - it activates that type! + type: stripe + # add and configure client_id and client_secret in parameters.yml + client_id: %stripe_client_id% + client_secret: %stripe_client_secret% + # a route name you'll create + redirect_route: connect_stripe_check + redirect_params: {} + + # whether to check OAuth2 "state": defaults to true + # use_state: true + # will create service: "knpu.oauth2.client.vimeo" # an instance of: KnpU\OAuth2ClientBundle\Client\Provider\VimeoClient # composer require saf33r/oauth2-vimeo diff --git a/bin/update_readme b/bin/update_readme index 970bfeb2..79483851 100755 --- a/bin/update_readme +++ b/bin/update_readme @@ -11,6 +11,7 @@ require __DIR__.'/../vendor/autoload.php'; use KnpU\OAuth2ClientBundle\DependencyInjection\KnpUOAuth2ClientExtension; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\BooleanNode; use Symfony\Component\Config\Definition\NodeInterface; function replaceInString($startTextMarker, $endTextMarker, $fullText, $replacementText) @@ -92,6 +93,11 @@ foreach (KnpUOAuth2ClientExtension::getAllSupportedTypes() as $type) { // *should* ? come out looking like valid-ish YAML ? json_encode($child->getDefaultValue()) : '{}'; + + } elseif ($child instanceof BooleanNode) { + $defaultValue = $child->getDefaultValue() + ? 'true' + : 'false'; } else { $defaultValue = $child->getDefaultValue() ? $child->getDefaultValue() diff --git a/src/Client/Provider/AmazonClient.php b/src/Client/Provider/AmazonClient.php new file mode 100644 index 00000000..51a6c85a --- /dev/null +++ b/src/Client/Provider/AmazonClient.php @@ -0,0 +1,34 @@ + +* +* 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\Token\AccessToken; +use Luchianenco\OAuth2\Client\Provider\AmazonResourceOwner; + +class AmazonClient extends OAuth2Client +{ + /** + * @param AccessToken $accessToken + * @return AmazonResourceOwner + */ + public function fetchUserFromToken(AccessToken $accessToken) + { + return parent::fetchUserFromToken($accessToken); + } + + /** + * @return AmazonResourceOwner + */ + public function fetchUser() + { + return parent::fetchUser(); + } +} \ No newline at end of file diff --git a/src/Client/Provider/FitbitClient.php b/src/Client/Provider/FitbitClient.php new file mode 100644 index 00000000..0761a92c --- /dev/null +++ b/src/Client/Provider/FitbitClient.php @@ -0,0 +1,34 @@ + +* +* 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\Token\AccessToken; +use djchen\OAuth2\Client\Provider\FitbitUser; + +class FitbitClient extends OAuth2Client +{ + /** + * @param AccessToken $accessToken + * @return FitbitUser + */ + public function fetchUserFromToken(AccessToken $accessToken) + { + return parent::fetchUserFromToken($accessToken); + } + + /** + * @return FitbitUser + */ + public function fetchUser() + { + return parent::fetchUser(); + } +} \ No newline at end of file diff --git a/src/Client/Provider/HerokuClient.php b/src/Client/Provider/HerokuClient.php new file mode 100644 index 00000000..5a435d17 --- /dev/null +++ b/src/Client/Provider/HerokuClient.php @@ -0,0 +1,34 @@ + +* +* 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\Token\AccessToken; +use Stevenmaguire\OAuth2\Client\Provider\HerokuResourceOwner; + +class HerokuClient extends OAuth2Client +{ + /** + * @param AccessToken $accessToken + * @return HerokuResourceOwner + */ + public function fetchUserFromToken(AccessToken $accessToken) + { + return parent::fetchUserFromToken($accessToken); + } + + /** + * @return HerokuResourceOwner + */ + public function fetchUser() + { + return parent::fetchUser(); + } +} \ No newline at end of file diff --git a/src/Client/Provider/PaypalClient.php b/src/Client/Provider/PaypalClient.php new file mode 100644 index 00000000..37afc9b5 --- /dev/null +++ b/src/Client/Provider/PaypalClient.php @@ -0,0 +1,34 @@ + +* +* 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\Token\AccessToken; +use Stevenmaguire\OAuth2\Client\Provider\PaypalResourceOwner; + +class PaypalClient extends OAuth2Client +{ + /** + * @param AccessToken $accessToken + * @return PaypalResourceOwner + */ + public function fetchUserFromToken(AccessToken $accessToken) + { + return parent::fetchUserFromToken($accessToken); + } + + /** + * @return PaypalResourceOwner + */ + public function fetchUser() + { + return parent::fetchUser(); + } +} \ No newline at end of file diff --git a/src/Client/Provider/StripeClient.php b/src/Client/Provider/StripeClient.php new file mode 100644 index 00000000..6eb9be97 --- /dev/null +++ b/src/Client/Provider/StripeClient.php @@ -0,0 +1,34 @@ + +* +* 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\Token\AccessToken; +use AdamPaterson\OAuth2\Client\Provider\StripeResourceOwner; + +class StripeClient extends OAuth2Client +{ + /** + * @param AccessToken $accessToken + * @return StripeResourceOwner + */ + public function fetchUserFromToken(AccessToken $accessToken) + { + return parent::fetchUserFromToken($accessToken); + } + + /** + * @return StripeResourceOwner + */ + public function fetchUser() + { + return parent::fetchUser(); + } +} \ No newline at end of file diff --git a/src/DependencyInjection/KnpUOAuth2ClientExtension.php b/src/DependencyInjection/KnpUOAuth2ClientExtension.php index adba1093..76c81404 100644 --- a/src/DependencyInjection/KnpUOAuth2ClientExtension.php +++ b/src/DependencyInjection/KnpUOAuth2ClientExtension.php @@ -10,6 +10,7 @@ namespace KnpU\OAuth2ClientBundle\DependencyInjection; +use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\AmazonProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\Auth0ProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\AzureProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\BitbucketProviderConfigurator; @@ -19,17 +20,21 @@ use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\DrupalProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\EveOnlineProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\FacebookProviderConfigurator; +use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\FitbitProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\GenericProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\GithubProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\GitlabProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\GoogleProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\HeadHunterProviderConfigurator; +use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\HerokuProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\InstagramProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\LinkedInProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\MicrosoftProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\OdnoklassnikiProviderConfigurator; +use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\PaypalProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\ProviderConfiguratorInterface; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\SlackProviderConfigurator; +use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\StripeProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\VimeoProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\VKontakteProviderConfigurator; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\YahooProviderConfigurator; @@ -58,6 +63,7 @@ class KnpUOAuth2ClientExtension extends Extension /** @var array */ private static $supportedProviderTypes = [ + 'amazon' => AmazonProviderConfigurator::class, 'auth0' => Auth0ProviderConfigurator::class, 'azure' => AzureProviderConfigurator::class, 'bitbucket' => BitbucketProviderConfigurator::class, @@ -67,7 +73,9 @@ class KnpUOAuth2ClientExtension extends Extension 'drupal' => DrupalProviderConfigurator::class, 'eve_online' => EveOnlineProviderConfigurator::class, 'facebook' => FacebookProviderConfigurator::class, + 'fitbit' => FitbitProviderConfigurator::class, 'headhunter' => HeadHunterProviderConfigurator::class, + 'heroku' => HerokuProviderConfigurator::class, 'instagram' => InstagramProviderConfigurator::class, 'github' => GithubProviderConfigurator::class, 'gitlab' => GitlabProviderConfigurator::class, @@ -75,7 +83,9 @@ class KnpUOAuth2ClientExtension extends Extension 'linkedin' => LinkedInProviderConfigurator::class, 'microsoft' => MicrosoftProviderConfigurator::class, 'odnoklassniki' => OdnoklassnikiProviderConfigurator::class, + 'paypal' => PaypalProviderConfigurator::class, 'slack' => SlackProviderConfigurator::class, + 'stripe' => StripeProviderConfigurator::class, 'vimeo' => VimeoProviderConfigurator::class, 'vkontakte' => VKontakteProviderConfigurator::class, 'yahoo' => YahooProviderConfigurator::class, diff --git a/src/DependencyInjection/Providers/AmazonProviderConfigurator.php b/src/DependencyInjection/Providers/AmazonProviderConfigurator.php new file mode 100644 index 00000000..86ca6d67 --- /dev/null +++ b/src/DependencyInjection/Providers/AmazonProviderConfigurator.php @@ -0,0 +1,54 @@ + + * + * 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 Symfony\Component\Config\Definition\Builder\NodeBuilder; + +class AmazonProviderConfigurator implements ProviderConfiguratorInterface +{ + public function buildConfiguration(NodeBuilder $node) + { + // no custom options + } + + public function getProviderClass(array $config) + { + return 'Luchianenco\OAuth2\Client\Provider\Amazon'; + } + + public function getProviderOptions(array $config) + { + return [ + 'clientId' => $config['client_id'], + 'clientSecret' => $config['client_secret'], + ]; + } + + public function getPackagistName() + { + return 'luchianenco/oauth2-amazon'; + } + + public function getLibraryHomepage() + { + return 'https://github.com/luchianenco/oauth2-amazon'; + } + + public function getProviderDisplayName() + { + return 'Amazon'; + } + + public function getClientClass(array $config) + { + return 'KnpU\OAuth2ClientBundle\Client\Provider\AmazonClient'; + } +} \ No newline at end of file diff --git a/src/DependencyInjection/Providers/FitbitProviderConfigurator.php b/src/DependencyInjection/Providers/FitbitProviderConfigurator.php new file mode 100644 index 00000000..10251188 --- /dev/null +++ b/src/DependencyInjection/Providers/FitbitProviderConfigurator.php @@ -0,0 +1,54 @@ + + * + * 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 Symfony\Component\Config\Definition\Builder\NodeBuilder; + +class FitbitProviderConfigurator implements ProviderConfiguratorInterface +{ + public function buildConfiguration(NodeBuilder $node) + { + // no custom options + } + + public function getProviderClass(array $config) + { + return 'djchen\OAuth2\Client\Provider\Fitbit'; + } + + public function getProviderOptions(array $config) + { + return [ + 'clientId' => $config['client_id'], + 'clientSecret' => $config['client_secret'], + ]; + } + + public function getPackagistName() + { + return 'djchen/oauth2-fitbit'; + } + + public function getLibraryHomepage() + { + return 'https://github.com/djchen/oauth2-fitbit'; + } + + public function getProviderDisplayName() + { + return 'Fitbit'; + } + + public function getClientClass(array $config) + { + return 'KnpU\OAuth2ClientBundle\Client\Provider\FitbitClient'; + } +} \ No newline at end of file diff --git a/src/DependencyInjection/Providers/HerokuProviderConfigurator.php b/src/DependencyInjection/Providers/HerokuProviderConfigurator.php new file mode 100644 index 00000000..69f7e94a --- /dev/null +++ b/src/DependencyInjection/Providers/HerokuProviderConfigurator.php @@ -0,0 +1,54 @@ + + * + * 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 Symfony\Component\Config\Definition\Builder\NodeBuilder; + +class HerokuProviderConfigurator implements ProviderConfiguratorInterface +{ + public function buildConfiguration(NodeBuilder $node) + { + // no custom options + } + + public function getProviderClass(array $config) + { + return 'Stevenmaguire\OAuth2\Client\Provider\Heroku'; + } + + public function getProviderOptions(array $config) + { + return [ + 'clientId' => $config['client_id'], + 'clientSecret' => $config['client_secret'], + ]; + } + + public function getPackagistName() + { + return 'stevenmaguire/oauth2-heroku'; + } + + public function getLibraryHomepage() + { + return 'https://github.com/stevenmaguire/oauth2-heroku'; + } + + public function getProviderDisplayName() + { + return 'Heroku'; + } + + public function getClientClass(array $config) + { + return 'KnpU\OAuth2ClientBundle\Client\Provider\HerokuClient'; + } +} \ No newline at end of file diff --git a/src/DependencyInjection/Providers/PaypalProviderConfigurator.php b/src/DependencyInjection/Providers/PaypalProviderConfigurator.php new file mode 100644 index 00000000..8b212ca2 --- /dev/null +++ b/src/DependencyInjection/Providers/PaypalProviderConfigurator.php @@ -0,0 +1,60 @@ + + * + * 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 Symfony\Component\Config\Definition\Builder\NodeBuilder; + +class PaypalProviderConfigurator implements ProviderConfiguratorInterface +{ + public function buildConfiguration(NodeBuilder $node) + { + $node + ->booleanNode('is_sandbox') + ->defaultFalse() + ->info('When true, client uses Paypal Sandbox URLs.') + ->end() + ; + } + + public function getProviderClass(array $config) + { + return 'Stevenmaguire\OAuth2\Client\Provider\Paypal'; + } + + public function getProviderOptions(array $config) + { + return [ + 'clientId' => $config['client_id'], + 'clientSecret' => $config['client_secret'], + 'isSandbox' => $config['is_sandbox'], + ]; + } + + public function getPackagistName() + { + return 'stevenmaguire/oauth2-paypal'; + } + + public function getLibraryHomepage() + { + return 'https://github.com/stevenmaguire/oauth2-paypal'; + } + + public function getProviderDisplayName() + { + return 'Paypal'; + } + + public function getClientClass(array $config) + { + return 'KnpU\OAuth2ClientBundle\Client\Provider\PaypalClient'; + } +} \ No newline at end of file diff --git a/src/DependencyInjection/Providers/StripeProviderConfigurator.php b/src/DependencyInjection/Providers/StripeProviderConfigurator.php new file mode 100644 index 00000000..2ae06bf6 --- /dev/null +++ b/src/DependencyInjection/Providers/StripeProviderConfigurator.php @@ -0,0 +1,54 @@ + + * + * 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 Symfony\Component\Config\Definition\Builder\NodeBuilder; + +class StripeProviderConfigurator implements ProviderConfiguratorInterface +{ + public function buildConfiguration(NodeBuilder $node) + { + // no custom options + } + + public function getProviderClass(array $config) + { + return 'AdamPaterson\OAuth2\Client\Provider\Stripe'; + } + + public function getProviderOptions(array $config) + { + return [ + 'clientId' => $config['client_id'], + 'clientSecret' => $config['client_secret'], + ]; + } + + public function getPackagistName() + { + return 'adam-paterson/oauth2-stripe'; + } + + public function getLibraryHomepage() + { + return 'https://github.com/adam-paterson/oauth2-stripe'; + } + + public function getProviderDisplayName() + { + return 'Stripe'; + } + + public function getClientClass(array $config) + { + return 'KnpU\OAuth2ClientBundle\Client\Provider\StripeClient'; + } +} \ No newline at end of file diff --git a/tests/DependencyInjection/KnpUOAuth2ClientExtensionTest.php b/tests/DependencyInjection/KnpUOAuth2ClientExtensionTest.php index 48a2d05a..d5961737 100644 --- a/tests/DependencyInjection/KnpUOAuth2ClientExtensionTest.php +++ b/tests/DependencyInjection/KnpUOAuth2ClientExtensionTest.php @@ -13,6 +13,7 @@ use KnpU\OAuth2ClientBundle\DependencyInjection\KnpUOAuth2ClientExtension; use KnpU\OAuth2ClientBundle\DependencyInjection\Providers\ProviderConfiguratorInterface; use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\BooleanNode; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -151,6 +152,8 @@ public function provideTypesAndConfig() /** @var NodeInterface $child */ if ($child instanceof ArrayNode) { $config[$child->getName()] = []; + } elseif ($child instanceof BooleanNode) { + $config[$child->getName()] = (bool) rand(0, 1); } else { $config[$child->getName()] = rand(); }