35
35
use Symfony \Component \DependencyInjection \Definition ;
36
36
use Symfony \Component \DependencyInjection \Extension \Extension ;
37
37
use Symfony \Component \DependencyInjection \Extension \PrependExtensionInterface ;
38
- use Symfony \Component \DependencyInjection \Loader \XmlFileLoader ;
38
+ use Symfony \Component \DependencyInjection \Loader \PhpFileLoader ;
39
39
use Symfony \Component \DependencyInjection \Reference ;
40
40
use Symfony \Component \HttpKernel \KernelEvents ;
41
41
@@ -50,8 +50,8 @@ final class LeagueOAuth2ServerExtension extends Extension implements PrependExte
50
50
*/
51
51
public function load (array $ configs , ContainerBuilder $ container )
52
52
{
53
- $ loader = new XmlFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
54
- $ loader ->load ('services.xml ' );
53
+ $ loader = new PhpFileLoader ($ container , new FileLocator (__DIR__ . '/../Resources/config ' ));
54
+ $ loader ->load ('services.php ' );
55
55
56
56
$ config = $ this ->processConfiguration (new Configuration (), $ configs );
57
57
@@ -129,14 +129,14 @@ private function configureAuthorizationServer(ContainerBuilder $container, array
129
129
{
130
130
$ authorizationServer = $ container
131
131
->getDefinition (AuthorizationServer::class)
132
- ->replaceArgument (' $privateKey ' , new Definition (CryptKey::class, [
132
+ ->replaceArgument (3 , new Definition (CryptKey::class, [
133
133
$ config ['private_key ' ],
134
134
$ config ['private_key_passphrase ' ],
135
135
false ,
136
136
]));
137
137
138
138
if ('plain ' === $ config ['encryption_key_type ' ]) {
139
- $ authorizationServer ->replaceArgument (' $encryptionKey ' , $ config ['encryption_key ' ]);
139
+ $ authorizationServer ->replaceArgument (4 , $ config ['encryption_key ' ]);
140
140
} elseif ('defuse ' === $ config ['encryption_key_type ' ]) {
141
141
if (!class_exists (Key::class)) {
142
142
throw new \RuntimeException ('You must install the "defuse/php-encryption" package to use "encryption_key_type: defuse". ' );
@@ -147,7 +147,7 @@ private function configureAuthorizationServer(ContainerBuilder $container, array
147
147
->addArgument ($ config ['encryption_key ' ]);
148
148
$ container ->setDefinition ('league.oauth2-server.defuse_key ' , $ keyDefinition );
149
149
150
- $ authorizationServer ->replaceArgument (' $encryptionKey ' , new Reference ('league.oauth2-server.defuse_key ' ));
150
+ $ authorizationServer ->replaceArgument (4 , new Reference ('league.oauth2-server.defuse_key ' ));
151
151
}
152
152
153
153
if ($ config ['enable_client_credentials_grant ' ]) {
@@ -205,7 +205,7 @@ private function configureGrants(ContainerBuilder $container, array $config): vo
205
205
;
206
206
207
207
$ authCodeGrantDefinition = $ container ->getDefinition (AuthCodeGrant::class);
208
- $ authCodeGrantDefinition ->replaceArgument (' $authCodeTTL ' , new Definition (\DateInterval::class, [$ config ['auth_code_ttl ' ]]))
208
+ $ authCodeGrantDefinition ->replaceArgument (2 , new Definition (\DateInterval::class, [$ config ['auth_code_ttl ' ]]))
209
209
->addMethodCall ('setRefreshTokenTTL ' , [
210
210
new Definition (\DateInterval::class, [$ config ['refresh_token_ttl ' ]]),
211
211
])
@@ -217,7 +217,7 @@ private function configureGrants(ContainerBuilder $container, array $config): vo
217
217
218
218
$ container
219
219
->getDefinition (ImplicitGrant::class)
220
- ->replaceArgument (' $accessTokenTTL ' , new Definition (\DateInterval::class, [$ config ['access_token_ttl ' ]]))
220
+ ->replaceArgument (0 , new Definition (\DateInterval::class, [$ config ['access_token_ttl ' ]]))
221
221
;
222
222
}
223
223
@@ -235,11 +235,11 @@ private function configurePersistence(LoaderInterface $loader, ContainerBuilder
235
235
236
236
switch ($ persistenceMethod ) {
237
237
case 'in_memory ' :
238
- $ loader ->load ('storage/in_memory.xml ' );
238
+ $ loader ->load ('storage/in_memory.php ' );
239
239
$ this ->configureInMemoryPersistence ($ container );
240
240
break ;
241
241
case 'doctrine ' :
242
- $ loader ->load ('storage/doctrine.xml ' );
242
+ $ loader ->load ('storage/doctrine.php ' );
243
243
$ this ->configureDoctrinePersistence ($ container , $ persistenceConfiguration );
244
244
break ;
245
245
}
@@ -255,27 +255,27 @@ private function configureDoctrinePersistence(ContainerBuilder $container, array
255
255
256
256
$ container
257
257
->getDefinition (AccessTokenManager::class)
258
- ->replaceArgument (' $entityManager ' , $ entityManager )
258
+ ->replaceArgument (0 , $ entityManager )
259
259
;
260
260
261
261
$ container
262
262
->getDefinition (ClientManager::class)
263
- ->replaceArgument (' $entityManager ' , $ entityManager )
263
+ ->replaceArgument (0 , $ entityManager )
264
264
;
265
265
266
266
$ container
267
267
->getDefinition (RefreshTokenManager::class)
268
- ->replaceArgument (' $entityManager ' , $ entityManager )
268
+ ->replaceArgument (0 , $ entityManager )
269
269
;
270
270
271
271
$ container
272
272
->getDefinition (AuthorizationCodeManager::class)
273
- ->replaceArgument (' $entityManager ' , $ entityManager )
273
+ ->replaceArgument (0 , $ entityManager )
274
274
;
275
275
276
276
$ container
277
277
->getDefinition (DoctrineCredentialsRevoker::class)
278
- ->replaceArgument (' $entityManager ' , $ entityManager )
278
+ ->replaceArgument (0 , $ entityManager )
279
279
;
280
280
281
281
$ container ->setParameter ('league.oauth2-server.persistence.doctrine.enabled ' , true );
@@ -291,7 +291,7 @@ private function configureResourceServer(ContainerBuilder $container, array $con
291
291
{
292
292
$ container
293
293
->getDefinition (ResourceServer::class)
294
- ->replaceArgument (' $publicKey ' , new Definition (CryptKey::class, [
294
+ ->replaceArgument (1 , new Definition (CryptKey::class, [
295
295
$ config ['public_key ' ],
296
296
null ,
297
297
false ,
0 commit comments