Skip to content

Commit 86ab2da

Browse files
committed
Add LexikJWTAuthenticationBundle for JWT Authentication in Symfony
1 parent 711b975 commit 86ab2da

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
generate-jwt-keys:
2+
ifeq (, $(shell which openssl))
3+
$(error "Unable to generate keys (needs OpenSSL)")
4+
endif
5+
mkdir -p etc/jwt
6+
openssl genrsa -passout pass:${JWT_PASSPHRASE} -out etc/jwt/private.pem -aes256 4096
7+
openssl rsa -passin pass:${JWT_PASSPHRASE} -pubout -in etc/jwt/private.pem -out etc/jwt/public.pem
8+
@echo "RSA key pair successfuly generated in \033[32metc/jwt/\033[39m"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lexik_jwt_authentication:
2+
private_key_path: "%env(JWT_PRIVATE_KEY_PATH)%"
3+
public_key_path: "%env(JWT_PUBLIC_KEY_PATH)%"
4+
pass_phrase: "%env(JWT_PASSPHRASE)%"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"bundles": {
3+
"Lexik\\Bundle\\JWTAuthenticationBundle\\LexikJWTAuthenticationBundle": ["all"]
4+
},
5+
"copy-from-recipe": {
6+
"etc/": "%ETC_DIR%"
7+
},
8+
"env": {
9+
"JWT_PRIVATE_KEY_PATH": "%ETC_DIR%/jwt/private.pem",
10+
"JWT_PUBLIC_KEY_PATH": "%ETC_DIR%/jwt/public.pem",
11+
"JWT_PASSPHRASE": "%generate(secret)%"
12+
}
13+
}

0 commit comments

Comments
 (0)