1 | <?php |
||
30 | abstract class AbstractOAuth2Authenticator extends AbstractGuardAuthenticator |
||
31 | { |
||
32 | protected $router; |
||
33 | protected $session; |
||
34 | protected $firewalls; |
||
35 | |||
36 | /** |
||
37 | * Dependency Injection constructor. |
||
38 | * |
||
39 | * @param RouterInterface $router |
||
40 | * @param SessionInterface $session |
||
41 | * @param FirewallMap $firewalls |
||
42 | */ |
||
43 | 14 | public function __construct( |
|
52 | |||
53 | /** |
||
54 | * {@inheritdoc} |
||
55 | */ |
||
56 | 2 | public function start(Request $request, AuthenticationException $authException = null) |
|
73 | |||
74 | /** |
||
75 | * {@inheritdoc} |
||
76 | */ |
||
77 | 5 | public function getCredentials(Request $request) |
|
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | */ |
||
108 | 2 | public function getUser($credentials, UserProviderInterface $userProvider) |
|
130 | |||
131 | /** |
||
132 | * {@inheritdoc} |
||
133 | */ |
||
134 | 1 | public function checkCredentials($credentials, UserInterface $user) |
|
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | 2 | public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) |
|
153 | |||
154 | /** |
||
155 | * {@inheritdoc} |
||
156 | */ |
||
157 | 1 | public function onAuthenticationFailure(Request $request, AuthenticationException $exception) |
|
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | */ |
||
165 | 1 | public function supportsRememberMe() |
|
169 | |||
170 | /** |
||
171 | * Returns OAuth2 provider for the specified firewall. |
||
172 | * |
||
173 | * @param RouterInterface $router |
||
174 | * @param string $firewall |
||
175 | * |
||
176 | * @return \League\OAuth2\Client\Provider\AbstractProvider |
||
177 | */ |
||
178 | abstract protected function getProvider(RouterInterface $router, string $firewall); |
||
179 | |||
180 | /** |
||
181 | * Returns user entity based on specified OAuth2 account. |
||
182 | * |
||
183 | * @param ResourceOwnerInterface $owner |
||
184 | * |
||
185 | * @return UserInterface|null |
||
186 | */ |
||
187 | abstract protected function getUserFromResourceOwner(ResourceOwnerInterface $owner); |
||
188 | } |
||
189 |