Skip to content

Commit cf910ab

Browse files
committed
feature #32 Add LexikJWTAuthenticationBundle (chalasr)
This PR was merged into the master branch. Discussion ---------- Add LexikJWTAuthenticationBundle Alternative to symfony/recipes-contrib#5, I think it would be more appropriated here as this bundle has no competitor regarding the need it solves. Repository: https://github.com/lexik/LexikJWTAuthenticationBundle Commits ------- 9fdecab Add LexikJWTAuthenticationBundle for JWT Authentication in Symfony
2 parents b623974 + 9fdecab commit cf910ab

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-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 ${JWT_PRIVATE_KEY_PATH} -aes256 4096
7+
openssl rsa -passin pass:${JWT_PASSPHRASE} -pubout -in ${JWT_PRIVATE_KEY_PATH} -out ${JWT_PUBLIC_KEY_PATH}
8+
@echo "\033[32mRSA key pair successfully generated\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+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<bg=blue;fg=white>Now</>, run <comment>make generate-jwt-keys</> to generate a key pair for LexikJWTAuthenticationBundle.

0 commit comments

Comments
 (0)