forked from Flowpack/Flowpack.OAuth2.Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResolver.php
49 lines (43 loc) · 1.9 KB
/
Resolver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Flowpack\OAuth2\Client\Endpoint;
/* *
* This script belongs to the TYPO3 Flow package "Flowpack.OAuth2.Client".*
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU General Public License, either version 3 of the *
* License, or (at your option) any later version. *
* *
* The TYPO3 project - inspiring people to share! *
* */
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Configuration\ConfigurationManager;
use Neos\Flow\ObjectManagement\ObjectManagerInterface;
/**
* @Flow\Scope("singleton")
*/
class Resolver
{
/**
* @Flow\Inject
* @var ConfigurationManager
*/
protected $configurationManager;
/**
* @Flow\Inject
* @var ObjectManagerInterface
*/
protected $objectManager;
/**
* @param string $providerName The provider name as given in Settings.yaml
* @throws \InvalidArgumentException
* @return TokenEndpointInterface
*/
public function getTokenEndpointForProvider($providerName)
{
$tokenEndpointClassName = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('Neos.Flow.security.authentication.providers.%s.providerOptions.tokenEndpointClassName', $providerName));
if ($tokenEndpointClassName === null) {
throw new \InvalidArgumentException(sprintf('In Settings.yaml, there was no "tokenEndpointClassName" option given for the provider "%s".', $providerName), 1383743372);
}
return $this->objectManager->get($tokenEndpointClassName);
}
}