Skip to content

Commit

Permalink
[WIP] login api
Browse files Browse the repository at this point in the history
Adds LexikJWT auth bundle and JSON login

TODO: Add tests
  • Loading branch information
y3n4 committed Apr 20, 2024
1 parent 2e3ec40 commit 1cf3044
Show file tree
Hide file tree
Showing 13 changed files with 485 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,9 @@ MAILER_DELIVERY_ADDRESS="[email protected]"
# DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=14&charset=utf8"
DATABASE_URL="mysql://mail:[email protected]:3306/mail?charset=utf8mb4"
###< doctrine/doctrine-bundle ###

###> lexik/jwt-authentication-bundle ###
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem
JWT_PASSPHRASE=857ce6bfb8d058ca8f51421d40864305d96be4be4a30d75e843b2d13958e6fde
###< lexik/jwt-authentication-bundle ###
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ translations/
###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###

###> lexik/jwt-authentication-bundle ###
/config/jwt/*.pem
###< lexik/jwt-authentication-bundle ###
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"endroid/qr-code": "^5.0",
"ircmaxell/password-compat": "~1.0.3",
"knplabs/knp-menu-bundle": "^3.0",
"lexik/jwt-authentication-bundle": "^2.20",
"mopa/bootstrap-bundle": "~3.0",
"nelmio/security-bundle": "^3.0",
"pear/crypt_gpg": "^1.6",
Expand Down
325 changes: 324 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
FriendsOfBehat\SymfonyExtension\Bundle\FriendsOfBehatSymfonyExtensionBundle::class => ['test' => true],
Lexik\Bundle\JWTAuthenticationBundle\LexikJWTAuthenticationBundle::class => ['all' => true],
];
14 changes: 14 additions & 0 deletions config/packages/lexik_jwt_authentication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
lexik_jwt_authentication:
secret_key: "%env(resolve:JWT_SECRET_KEY)%"
public_key: "%env(resolve:JWT_PUBLIC_KEY)%"
pass_phrase: "%env(JWT_PASSPHRASE)%"
token_ttl: 3600
token_extractors:
authorization_header:
enabled: true
prefix: Bearer
name: Authorization

when@dev:
lexik_jwt_authentication:
token_ttl: 31536000
Loading

0 comments on commit 1cf3044

Please sign in to comment.