|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Sludio\HelperBundle\Oauth\Configurator; |
|
4
|
|
|
|
|
5
|
|
|
use Symfony\Component\Config\Definition\Builder\NodeBuilder; |
|
6
|
|
|
|
|
7
|
|
|
class GoogleProviderConfiguratorInterface implements ProviderConfiguratorInterface |
|
8
|
|
|
{ |
|
9
|
|
|
public function buildConfiguration(NodeBuilder $node) |
|
10
|
|
|
{ |
|
11
|
|
|
// @formatter:off |
|
12
|
|
|
$node |
|
13
|
|
|
->scalarNode('access_type') |
|
14
|
|
|
->defaultNull() |
|
15
|
|
|
->info('Optional value for sending access_type parameter. More detail: https://developers.google.com/identity/protocols/OpenIDConnect#authenticationuriparameters') |
|
16
|
|
|
->end() |
|
17
|
|
|
->scalarNode('hosted_domain') |
|
|
|
|
|
|
18
|
|
|
->defaultNull() |
|
19
|
|
|
->info('Optional value for sending hd parameter. More detail: https://developers.google.com/identity/protocols/OpenIDConnect#hd-param') |
|
20
|
|
|
->end() |
|
21
|
|
|
->arrayNode('user_fields') |
|
|
|
|
|
|
22
|
|
|
->prototype('scalar')->end() |
|
23
|
|
|
->info('Optional value for additional fields to be requested from the user profile. If set, these values will be included with the defaults. More details: https://developers.google.com/+/web/api/rest/latest/people') |
|
|
|
|
|
|
24
|
|
|
->end() |
|
|
|
|
|
|
25
|
|
|
->scalarNode('client_class') |
|
|
|
|
|
|
26
|
|
|
->info('If you have a sub-class of OAuth2Client you want to use, add it here') |
|
27
|
|
|
->defaultValue('Sludio\HelperBundle\Oauth\Client\Client\GoogleOAuth2Client') |
|
28
|
|
|
->end() |
|
29
|
|
|
->scalarNode('redirect_route') |
|
30
|
|
|
->isRequired() |
|
31
|
|
|
->cannotBeEmpty() |
|
32
|
|
|
->end() |
|
33
|
|
|
->arrayNode('provider_options') |
|
34
|
|
|
->info('Other options to pass to your provider\'s constructor') |
|
35
|
|
|
->prototype('variable')->end() |
|
36
|
|
|
->end() |
|
37
|
|
|
; |
|
38
|
|
|
// @formatter:on |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function getProviderClass(array $config) |
|
42
|
|
|
{ |
|
43
|
|
|
return 'Sludio\HelperBundle\Oauth\Client\Provider\Google\Google'; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function getProviderOptions(array $config) |
|
47
|
|
|
{ |
|
48
|
|
|
$options = [ |
|
49
|
|
|
'clientId' => $config['client_id'], |
|
50
|
|
|
'clientSecret' => $config['client_secret'], |
|
51
|
|
|
'redirect_route' => $config['redirect_route'], |
|
52
|
|
|
]; |
|
53
|
|
|
|
|
54
|
|
|
if ($config['access_type']) { |
|
55
|
|
|
$options['accessType'] = $config['access_type']; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
if ($config['hosted_domain']) { |
|
59
|
|
|
$options['hostedDomain'] = $config['hosted_domain']; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
if (!empty($config['user_fields'])) { |
|
63
|
|
|
$options['userFields'] = $config['user_fields']; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
return array_merge($options, $config['provider_options']); |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
public function getProviderDisplayName() |
|
70
|
|
|
{ |
|
71
|
|
|
return 'Google'; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
public function getClientClass(array $config) |
|
75
|
|
|
{ |
|
76
|
|
|
return $config['client_class']; |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.