|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* SocialConnect project |
|
4
|
|
|
* @author: Patsura Dmitry https://github.com/ovr <[email protected]> |
|
5
|
|
|
* @author Alexander Fedyashov <[email protected]> |
|
6
|
|
|
*/ |
|
7
|
|
|
declare(strict_types=1); |
|
8
|
|
|
|
|
9
|
|
|
namespace SocialConnect\OpenIDConnect\Provider; |
|
10
|
|
|
|
|
11
|
|
|
use SocialConnect\Common\ArrayHydrator; |
|
12
|
|
|
use SocialConnect\Provider\AccessTokenInterface; |
|
13
|
|
|
use SocialConnect\OpenIDConnect\AbstractProvider; |
|
14
|
|
|
use SocialConnect\Common\Entity\User; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
class Google extends AbstractProvider |
|
17
|
|
|
{ |
|
18
|
|
|
const NAME = 'google'; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* {@inheritdoc} |
|
22
|
|
|
*/ |
|
23
|
1 |
|
public function getOpenIdUrl() |
|
24
|
|
|
{ |
|
25
|
1 |
|
return 'https://accounts.google.com/.well-known/openid-configuration'; |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* {@inheritdoc} |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function getBaseUri() |
|
32
|
|
|
{ |
|
33
|
1 |
|
return 'https://www.googleapis.com/'; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* {@inheritdoc} |
|
38
|
|
|
*/ |
|
39
|
1 |
|
public function getAuthorizeUri() |
|
40
|
|
|
{ |
|
41
|
1 |
|
return 'https://accounts.google.com/o/oauth2/auth'; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* {@inheritdoc} |
|
46
|
|
|
*/ |
|
47
|
1 |
|
public function getRequestTokenUri() |
|
48
|
|
|
{ |
|
49
|
1 |
|
return 'https://accounts.google.com/o/oauth2/token'; |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* {@inheritdoc} |
|
54
|
|
|
*/ |
|
55
|
1 |
|
public function getName() |
|
56
|
|
|
{ |
|
57
|
1 |
|
return self::NAME; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* {@inheritdoc} |
|
62
|
|
|
*/ |
|
63
|
|
|
public function getIdentity(AccessTokenInterface $accessToken) |
|
64
|
|
|
{ |
|
65
|
|
|
$response = $this->request('GET', 'oauth2/v1/userinfo', [], $accessToken); |
|
66
|
|
|
|
|
67
|
|
|
$hydrator = new ArrayHydrator([ |
|
68
|
|
|
'id' => 'id', |
|
69
|
|
|
'given_name' => 'firstname', |
|
70
|
|
|
'family_name' => 'lastname', |
|
71
|
|
|
'email' => 'email', |
|
72
|
|
|
'verified_email' => 'emailVerified', |
|
73
|
|
|
'name' => 'fullname', |
|
74
|
|
|
'gender' => static function ($value, User $user) { |
|
75
|
|
|
$user->setSex($value); |
|
76
|
|
|
}, |
|
77
|
|
|
]); |
|
78
|
|
|
|
|
79
|
|
|
return $hydrator->hydrate(new User(), $response); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* {@inheritdoc} |
|
84
|
|
|
*/ |
|
85
|
|
|
public function getScopeInline() |
|
86
|
|
|
{ |
|
87
|
|
|
return implode(' ', $this->scope); |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths