|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* The MIT License (MIT) |
|
7
|
|
|
* |
|
8
|
|
|
* Copyright (c) 2014-2018 Spomky-Labs |
|
9
|
|
|
* |
|
10
|
|
|
* This software may be modified and distributed under the terms |
|
11
|
|
|
* of the MIT license. See the LICENSE file for details. |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
namespace OAuth2Framework\Bundle\Server; |
|
15
|
|
|
|
|
16
|
|
|
use OAuth2Framework\Bundle\Server\DependencyInjection\Compiler; |
|
17
|
|
|
use OAuth2Framework\Bundle\Server\DependencyInjection\OAuth2FrameworkServerExtension; |
|
18
|
|
|
use OAuth2Framework\Bundle\Server\Security\Factory\OAuth2SecurityFactory; |
|
19
|
|
|
use Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension; |
|
20
|
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; |
|
21
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
22
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
|
23
|
|
|
|
|
24
|
|
|
final class OAuth2FrameworkServerBundle extends Bundle |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* {@inheritdoc} |
|
28
|
|
|
*/ |
|
29
|
|
|
public function boot() |
|
30
|
|
|
{ |
|
31
|
|
|
parent::boot(); |
|
32
|
|
|
$this->container->get('twig.loader')->addPath(__DIR__.DIRECTORY_SEPARATOR.'Resources'.DIRECTORY_SEPARATOR.'views', 'OAuth2FrameworkServerBundle'); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* {@inheritdoc} |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getContainerExtension($alias = 'oauth2_server') |
|
39
|
|
|
{ |
|
40
|
|
|
return new OAuth2FrameworkServerExtension($alias); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* {@inheritdoc} |
|
45
|
|
|
*/ |
|
46
|
|
|
public function build(ContainerBuilder $container) |
|
47
|
|
|
{ |
|
48
|
|
|
foreach ($this->getCompilerPasses() as $pass) { |
|
49
|
|
|
$container->addCompilerPass($pass); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** @var SecurityExtension $extension */ |
|
53
|
|
|
$extension = $container->getExtension('security'); |
|
54
|
|
|
$extension->addSecurityListenerFactory(new OAuth2SecurityFactory()); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return CompilerPassInterface[] |
|
59
|
|
|
*/ |
|
60
|
|
|
private function getCompilerPasses(): array |
|
61
|
|
|
{ |
|
62
|
|
|
return [ |
|
63
|
|
|
new Compiler\ClientRuleCompilerPass(), |
|
64
|
|
|
new Compiler\ScopePolicyCompilerPass(), |
|
65
|
|
|
new Compiler\ResponseFactoryCompilerPass(), |
|
66
|
|
|
new Compiler\TokenEndpointAuthMethodCompilerPass(), |
|
67
|
|
|
new Compiler\TokenIntrospectionEndpointAuthMethodCompilerPass(), |
|
68
|
|
|
new Compiler\GrantTypeCompilerPass(), |
|
69
|
|
|
new Compiler\TokenRouteCompilerPass(), |
|
70
|
|
|
new Compiler\TokenTypeCompilerPass(), |
|
71
|
|
|
new Compiler\PKCEMethodCompilerPass(), |
|
72
|
|
|
new Compiler\TokenIntrospectionRouteCompilerPass(), |
|
73
|
|
|
new Compiler\TokenRevocationRouteCompilerPass(), |
|
74
|
|
|
new Compiler\TokenTypeHintCompilerPass(), |
|
75
|
|
|
new Compiler\IssuerDiscoveryCompilerPass(), |
|
76
|
|
|
new Compiler\ResponseModeCompilerPass(), |
|
77
|
|
|
new Compiler\AccessTokenHandlerCompilerPass(), |
|
78
|
|
|
new Compiler\TokenEndpointExtensionCompilerPass(), |
|
79
|
|
|
new Compiler\AuthorizationEndpointRouteCompilerPass(), |
|
80
|
|
|
new Compiler\UserInfoScopeSupportCompilerPass(), |
|
81
|
|
|
new Compiler\UserinfoRouteCompilerPass(), |
|
82
|
|
|
new Compiler\UserinfoEndpointSignatureCompilerPass(), |
|
83
|
|
|
new Compiler\UserinfoEndpointEncryptionCompilerPass(), |
|
84
|
|
|
new Compiler\UserInfoPairwiseSubjectCompilerPass(), |
|
85
|
|
|
new Compiler\ClaimSourceCompilerPass(), |
|
86
|
|
|
new Compiler\UserAccountDiscoveryCompilerPass(), |
|
87
|
|
|
new Compiler\ParameterCheckerCompilerPass(), |
|
88
|
|
|
new Compiler\ResponseTypeCompilerPass(), |
|
89
|
|
|
new Compiler\BeforeConsentScreenCompilerPass(), |
|
90
|
|
|
new Compiler\AfterConsentScreenCompilerPass(), |
|
91
|
|
|
new Compiler\InitialAccessTokenCompilerPass(), |
|
92
|
|
|
new Compiler\ClientAssertionJWTEncryptionSupportConfigurationCompilerPass(), |
|
93
|
|
|
new Compiler\SessionManagementRouteCompilerPass(), |
|
94
|
|
|
new Compiler\ClientConfigurationEndpointRouteCompilerPass(), |
|
95
|
|
|
new Compiler\ClientRegistrationEndpointRouteCompilerPass(), |
|
96
|
|
|
new Compiler\MetadataRouteCompilerPass(), |
|
97
|
|
|
new Compiler\SignedMetadataCompilerPass(), |
|
98
|
|
|
new Compiler\IdTokenMetadataCompilerPass(), |
|
99
|
|
|
new Compiler\ClientJwtAssertionMetadataCompilerPass(), |
|
100
|
|
|
new Compiler\JwksUriEndpointRouteCompilerPass(), |
|
101
|
|
|
new Compiler\CommonMetadataCompilerPass(), |
|
102
|
|
|
new Compiler\CustomMetadataCompilerPass(), |
|
103
|
|
|
new Compiler\ScopeMetadataCompilerPass(), |
|
104
|
|
|
new Compiler\AuthorizationRequestMetadataCompilerPass(), |
|
105
|
|
|
new Compiler\RequestObjectCompilerPass(), |
|
106
|
|
|
new Compiler\SecurityAnnotationCheckerCompilerPass(), |
|
107
|
|
|
]; |
|
108
|
|
|
} |
|
109
|
|
|
} |
|
110
|
|
|
|