Skip to content

Commit

Permalink
Merge pull request #20 from synolia/hotfix/env-variable-name
Browse files Browse the repository at this point in the history
Change oauth env variable name to avoid conflict with knpu's base ones
  • Loading branch information
oallain authored Mar 1, 2024
2 parents 3422e4f + ef3cf83 commit acbfbc3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ ifneq ("$(wildcard tests/data)","")
cp -r tests/data/* ${TEST_DIRECTORY}/
endif

echo "OAUTH_GOOGLE_CLIENT_ID=" >> ${TEST_DIRECTORY}/.env
echo "OAUTH_GOOGLE_CLIENT_SECRET=" >> ${TEST_DIRECTORY}/.env
echo "OAUTH_MICROSOFT_CLIENT_ID=" >> ${TEST_DIRECTORY}/.env
echo "OAUTH_MICROSOFT_CLIENT_SECRET=" >> ${TEST_DIRECTORY}/.env
echo "SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID=" >> ${TEST_DIRECTORY}/.env
echo "SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_SECRET=" >> ${TEST_DIRECTORY}/.env
echo "SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID=" >> ${TEST_DIRECTORY}/.env
echo "SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_SECRET=" >> ${TEST_DIRECTORY}/.env

install-sylius:
${CONSOLE} doctrine:database:create --if-not-exists
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
```
2. Write your Google and/or Microsoft client Id and client secret in you .env file with those keys :
```dotenv
OAUTH_GOOGLE_CLIENT_ID=
OAUTH_GOOGLE_CLIENT_SECRET=
SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID=
SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_SECRET=
OAUTH_MICROSOFT_CLIENT_ID=
OAUTH_MICROSOFT_CLIENT_SECRET=
SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID=
SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_SECRET=
```
3. In your security.yaml, add the OAuth authenticator in your admin firewall and put access_control paths you need depending on wich provider you use. **They must be on top of the others** :
```yaml
Expand Down
12 changes: 6 additions & 6 deletions config/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ sylius_ui:

twig:
globals:
google_client_id: '%env(default::OAUTH_GOOGLE_CLIENT_ID)%'
microsoft_client_id: '%env(default::OAUTH_MICROSOFT_CLIENT_ID)%'
google_client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID)%'
microsoft_client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID)%'

knpu_oauth2_client:
clients:
google_admin:
type: google
client_id: '%env(default::OAUTH_GOOGLE_CLIENT_ID)%'
client_secret: '%env(default::OAUTH_GOOGLE_CLIENT_SECRET)%'
client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID)%'
client_secret: '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_SECRET)%'
redirect_route: 'connect_admin_google_check'
redirect_params: {}
azure_admin:
type: azure
client_id: '%env(default::OAUTH_MICROSOFT_CLIENT_ID)%'
client_secret: '%env(default::OAUTH_MICROSOFT_CLIENT_SECRET)%'
client_id: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID)%'
client_secret: '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_SECRET)%'
redirect_route: 'connect_admin_microsoft_check'
redirect_params: {}

Expand Down
4 changes: 2 additions & 2 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
])
->load('Synolia\SyliusAdminOauthPlugin\Security\Authenticator\\', '../src/Security/Authenticator')
->args([
'$googleClientId' => '%env(default::OAUTH_GOOGLE_CLIENT_ID)%',
'$microsoftClientId' => '%env(default::OAUTH_MICROSOFT_CLIENT_ID)%',
'$googleClientId' => '%env(default::SYNOLIA_ADMIN_OAUTH_GOOGLE_CLIENT_ID)%',
'$microsoftClientId' => '%env(default::SYNOLIA_ADMIN_OAUTH_MICROSOFT_CLIENT_ID)%',
]);
};

0 comments on commit acbfbc3

Please sign in to comment.