|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace DMK\MKSamlAuth\Container; |
|
6
|
|
|
|
|
7
|
|
|
use DMK\MKSamlAuth\Store\CredentialStore; |
|
8
|
|
|
use DMK\MKSamlAuth\Store\SessionSsoStateStore; |
|
9
|
|
|
use LightSaml\Binding\BindingFactory; |
|
10
|
|
|
use LightSaml\Build\Container\ServiceContainerInterface; |
|
11
|
|
|
use LightSaml\Provider\TimeProvider\SystemTimeProvider; |
|
12
|
|
|
use LightSaml\Resolver\Credential\Factory\CredentialResolverFactory; |
|
13
|
|
|
use LightSaml\Resolver\Endpoint\BindingEndpointResolver; |
|
14
|
|
|
use LightSaml\Resolver\Endpoint\CompositeEndpointResolver; |
|
15
|
|
|
use LightSaml\Resolver\Endpoint\DescriptorTypeEndpointResolver; |
|
16
|
|
|
use LightSaml\Resolver\Endpoint\IndexEndpointResolver; |
|
17
|
|
|
use LightSaml\Resolver\Endpoint\LocationEndpointResolver; |
|
18
|
|
|
use LightSaml\Resolver\Endpoint\ServiceTypeEndpointResolver; |
|
19
|
|
|
use LightSaml\Resolver\Session\SessionProcessor; |
|
20
|
|
|
use LightSaml\Resolver\Signature\OwnSignatureResolver; |
|
21
|
|
|
use LightSaml\State\Sso\SsoSessionState; |
|
22
|
|
|
use LightSaml\Store\Sso\SsoStateSessionStore; |
|
23
|
|
|
use LightSaml\Validator\Model\Assertion\AssertionTimeValidator; |
|
24
|
|
|
use LightSaml\Validator\Model\Assertion\AssertionValidator; |
|
25
|
|
|
use LightSaml\Validator\Model\NameId\NameIdValidator; |
|
26
|
|
|
use LightSaml\Validator\Model\Signature\SignatureValidator; |
|
27
|
|
|
use TYPO3\CMS\Core\SingletonInterface; |
|
28
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
|
29
|
|
|
use TYPO3\CMS\Extbase\Object\Container\Container; |
|
30
|
|
|
|
|
31
|
|
|
class ServiceContainer implements ServiceContainerInterface, SingletonInterface |
|
32
|
|
|
{ |
|
33
|
|
|
private $container; |
|
34
|
|
|
|
|
35
|
|
|
public function __construct(SingletonContainer $container) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->container = $container; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function getAssertionValidator() |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->container->getInstance(AssertionValidator::class); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
public function getAssertionTimeValidator() |
|
46
|
|
|
{ |
|
47
|
|
|
return $this->container->getInstance(AssertionTimeValidator::class); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function getSignatureResolver() |
|
51
|
|
|
{ |
|
52
|
|
|
return $this->container->getInstance(OwnSignatureResolver::class, [ |
|
53
|
|
|
$this->getCredentialResolver() |
|
54
|
|
|
]); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function getEndpointResolver() |
|
58
|
|
|
{ |
|
59
|
|
|
return $this->container->getInstance(CompositeEndpointResolver::class, [[ |
|
60
|
|
|
$this->container->getInstance(BindingEndpointResolver::class), |
|
61
|
|
|
$this->container->getInstance(DescriptorTypeEndpointResolver::class), |
|
62
|
|
|
$this->container->getInstance(ServiceTypeEndpointResolver::class), |
|
63
|
|
|
$this->container->getInstance(IndexEndpointResolver::class), |
|
64
|
|
|
$this->container->getInstance(LocationEndpointResolver::class) |
|
65
|
|
|
]]); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function getNameIdValidator() |
|
69
|
|
|
{ |
|
70
|
|
|
return $this->container->getInstance(NameIdValidator::class); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getBindingFactory() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->container->getInstance(BindingFactory::class); |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function getSignatureValidator() |
|
79
|
|
|
{ |
|
80
|
|
|
return $this->container->getInstance(SignatureValidator::class, [ |
|
81
|
|
|
$this->getCredentialResolver() |
|
82
|
|
|
]); |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
|
|
public function getCredentialResolver() |
|
86
|
|
|
{ |
|
87
|
|
|
/** @var CredentialResolverFactory $factory */ |
|
88
|
|
|
$factory = $this->container->getInstance(CredentialResolverFactory::class, [ |
|
89
|
|
|
$this->container->getInstance(CredentialStore::class) |
|
90
|
|
|
]); |
|
91
|
|
|
|
|
92
|
|
|
return $factory->build(); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
public function getLogoutSessionResolver() |
|
96
|
|
|
{ |
|
97
|
|
|
throw new \LogicException('Not implemented'); |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
public function getSessionProcessor() |
|
101
|
|
|
{ |
|
102
|
|
|
return $this->container->getInstance(SessionProcessor::class, [ |
|
103
|
|
|
$this->container->getInstance(SessionSsoStateStore::class), |
|
104
|
|
|
$this->container->getInstance(SystemTimeProvider::class) |
|
105
|
|
|
]); |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|