File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Axium \Identity \Recipe ;
4+
5+ use Symfony \Component \Yaml \Yaml ;
6+
7+ class SecurityConfigurator
8+ {
9+ public function configure (array $ options ): void
10+ {
11+ $ file = 'config/packages/security.yaml ' ;
12+
13+ if (!file_exists ($ file )) {
14+ return ;
15+ }
16+
17+ $ config = Yaml::parseFile ($ file );
18+
19+ $ security = $ config ['security ' ] ?? [];
20+
21+ // Ajouter le provider
22+ $ security ['providers ' ]['axium_identity ' ] = [
23+ 'id ' => 'Axium \\Identity \\Security \\IdentityUserProvider '
24+ ];
25+
26+ // Ajouter firewall
27+ $ security ['firewalls ' ]['main ' ]['custom_authenticator ' ][] =
28+ 'Axium \\Identity \\Security \\IdentityAuthenticator ' ;
29+
30+ // Ajouter access_control
31+ $ security ['access_control ' ][] = [
32+ 'path ' => '^/api/oauth/token ' ,
33+ 'roles ' => 'PUBLIC_ACCESS '
34+ ];
35+
36+ $ config ['security ' ] = $ security ;
37+
38+ file_put_contents (
39+ $ file ,
40+ Yaml::dump ($ config , 10 )
41+ );
42+ }
43+ }
Original file line number Diff line number Diff line change 77 "copy-from-recipe" : {
88 "config/" : " %CONFIG_DIR%/"
99 },
10+ "configurators" : [
11+ " Axium\\ Identity\\ Recipe\\ SecurityConfigurator"
12+ ],
1013 "env" : {
1114 "AXIUM_IDENTITY_URL" : " https://identity.example.com" ,
1215 "AXIUM_CLIENT_ID" : " your-client-id" ,
You can’t perform that action at this time.
0 commit comments