mirror of
https://github.com/symfony/recipes.git
synced 2026-09-11 15:16:30 +03:00
Add LexikJWTAuthenticationBundle for JWT Authentication in Symfony
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
generate-jwt-keys:
|
||||||
|
ifeq (, $(shell which openssl))
|
||||||
|
$(error "Unable to generate keys (needs OpenSSL)")
|
||||||
|
endif
|
||||||
|
mkdir -p etc/jwt
|
||||||
|
openssl genrsa -passout pass:${JWT_PASSPHRASE} -out ${JWT_PRIVATE_KEY_PATH} -aes256 4096
|
||||||
|
openssl rsa -passin pass:${JWT_PASSPHRASE} -pubout -in ${JWT_PRIVATE_KEY_PATH} -out ${JWT_PUBLIC_KEY_PATH}
|
||||||
|
@echo "\033[32mRSA key pair successfully generated\033[39m"
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
lexik_jwt_authentication:
|
||||||
|
private_key_path: "%env(JWT_PRIVATE_KEY_PATH)%"
|
||||||
|
public_key_path: "%env(JWT_PUBLIC_KEY_PATH)%"
|
||||||
|
pass_phrase: "%env(JWT_PASSPHRASE)%"
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"bundles": {
|
||||||
|
"Lexik\\Bundle\\JWTAuthenticationBundle\\LexikJWTAuthenticationBundle": ["all"]
|
||||||
|
},
|
||||||
|
"copy-from-recipe": {
|
||||||
|
"etc/": "%ETC_DIR%"
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"JWT_PRIVATE_KEY_PATH": "%ETC_DIR%/jwt/private.pem",
|
||||||
|
"JWT_PUBLIC_KEY_PATH": "%ETC_DIR%/jwt/public.pem",
|
||||||
|
"JWT_PASSPHRASE": "%generate(secret)%"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<bg=blue;fg=white>Now</>, run <comment>make generate-jwt-keys</> to generate a key pair for LexikJWTAuthenticationBundle.
|
||||||
Reference in New Issue
Block a user