-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] JWT Authentication key pair generation via (lexik) bundle command #1446
Comments
Good idea! |
The command was added in lexik/LexikJWTAuthenticationBundle#817. Interestingly, the topic of permissions (cf.) did not come up there at all. Edit: I obviously was thinking about SSH keys. The permission change here is not about restricting access (which I would have expected to correctly be done by the command), but about making sure that the webserver user has access, too (which very much belongs outside of the command). |
Creation of directory and files is now covered by lexik/jwt-authentication-bundle's command. This somewhat causes the directory/file location somewhat pop up out of nowhere in the subsequent permission change (`setfacl`). That could be avoided by extracting JWT_SECRET_KEY and JWT_PUBLIC_KEY from api's `.env` file (section maintained by the bundle) but it adds bloat without apparent benefit. The previously documented behaviour was closer to using the `--overwrite` option on the command, but I doubt it is in the user's best interest in a starter guide. Using `--skip-if-exists` would make some sense, but bailing feels like the sane option – the user obviously touched this area before and should be made aware. Resolves api-platform#1446
Creation of directory and files is now covered by lexik/jwt-authentication-bundle's command. This somewhat causes the directory/file location to pop up out of nowhere in the subsequent permission change (`setfacl`). That could be avoided by extracting JWT_SECRET_KEY and JWT_PUBLIC_KEY from api's `.env` file (section maintained by the bundle) but it adds bloat without apparent benefit. The previously documented behaviour was closer to using the `--overwrite` option on the command, but I doubt it is in the user's best interest in a starter guide. Using `--skip-if-exists` would make some sense, but bailing feels like the sane option – the user obviously touched this area before and should be made aware. Resolves api-platform#1446 Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
The idea was proposed in api-platform/docs#1446 and added to the docs in api-platform/docs#1448. The command was added to the bundle in v2.11. Composer install was moved first to ensure that the bundle is installed. This now attempts the permission modification (`setfacl`) irrespective of the previous existence of the key files. While the cost of this operation are certainly not zero, it ensures the permissions are as intended no matter how the key files came to be and leaves the configuration of the key file name entirely with the bundle/.env file.
The idea was proposed in api-platform/docs#1446 and added to the docs in api-platform/docs#1448. The command was added to the bundle in v2.11. Composer install was moved first to ensure that the bundle is installed. This now attempts the permission modification (`setfacl`) irrespective of the previous existence of the key files. While the cost of this operation are certainly not zero, it ensures the permissions are as intended no matter how the key files came to be and leaves the configuration of the key file name entirely with the bundle/.env file.
The JWT Authentication docs show how to install and set up the lexik JWT AuthenticationBundle, incl. generating the key pair.
Apparently, the bundle now (added 8 months ago) comes with a GenerateKeyPairCommand to – as the name implies – generate the key pair. Maybe documenting the use of this console command instead of the list of CLI commands can make the api-platform docs less cumbersome and less prone to fall out of sync with the bundle.
The text was updated successfully, but these errors were encountered: