Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
* origin/master:
  VK.com Provider added
  • Loading branch information
weaverryan committed Feb 2, 2016
2 parents 0baf522 + 7f72166 commit c4554cb
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions DependencyInjection/KnpUOAuth2ClientExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class KnpUOAuth2ClientExtension extends Extension
'github' => 'KnpU\OAuth2ClientBundle\DependencyInjection\Providers\GithubProviderConfigurator',
'linkedin' => 'KnpU\OAuth2ClientBundle\DependencyInjection\Providers\LinkedInProviderConfigurator',
'google' => 'KnpU\OAuth2ClientBundle\DependencyInjection\Providers\GoogleProviderConfigurator',
'vk' => 'KnpU\OAuth2ClientBundle\DependencyInjection\Providers\VkProviderConfigurator',
);

public function __construct($checkExternalClassExistence = true)
Expand Down
41 changes: 41 additions & 0 deletions DependencyInjection/Providers/VkProviderConfigurator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace KnpU\OAuth2ClientBundle\DependencyInjection\Providers;

use Symfony\Component\Config\Definition\Builder\NodeBuilder;

class VkProviderConfigurator implements ProviderConfiguratorInterface
{
public function buildConfiguration(NodeBuilder $node)
{
// no custom options
}

public function getProviderClass()
{
return 'J4k\OAuth2\Client\Provider\Vkontakte';
}

public function getProviderOptions(array $config)
{
return array(
'clientId' => $config['client_id'],
'clientSecret' => $config['client_secret'],
);
}

public function getPackagistName()
{
return 'j4k/oauth2-vkontakte';
}

public function getLibraryHomepage()
{
return 'https://github.com/j4k/oauth2-vkontakte';
}

public function getProviderDisplayName()
{
return 'VK';
}
}
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ via Composer:
| [GitHub](https://github.com/thephpleague/oauth2-github) | composer require league/oauth2-github |
| [LinkedIn](https://github.com/thephpleague/oauth2-linkedin) | composer require league/oauth2-linkedin |
| [Google](https://github.com/thephpleague/oauth2-google) | composer require league/oauth2-google |
| [VK](https://github.com/j4k/oauth2-vkontakte) | composer require j4k/oauth2-vkontakte |

<span name="end-client-downloader-table"></span>

Expand Down Expand Up @@ -241,6 +242,21 @@ knpu_oauth2_client:
# hosted_domain: ''
# whether to check OAuth2 "state": defaults to true
# use_state: true
# will create service: "knpu.oauth2.client.vk"
# composer require j4k/oauth2-vkontakte
vk:
# must be "vk" - it activates that type!
type: vk
# add and configure client_id and client_secret in parameters.yml
client_id: %vk_client_id%
client_secret: %vk_client_secret%
# a route name you'll create
redirect_route: connect_vk_check
redirect_params: {}
# whether to check OAuth2 "state": defaults to true
# use_state: true
```

## Contributing
Expand Down

0 comments on commit c4554cb

Please sign in to comment.