Skip to content

Add jwt authentication#15

Merged
chloecasali merged 9 commits intomainfrom
12-add-jwt-authentication
Nov 14, 2025
Merged

Add jwt authentication#15
chloecasali merged 9 commits intomainfrom
12-add-jwt-authentication

Conversation

@chloecasali
Copy link
Copy Markdown
Owner

No description provided.

@chloecasali chloecasali linked an issue Nov 12, 2025 that may be closed by this pull request
2 tasks
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds JWT authentication to the Symfony application using the Lexik JWT Authentication Bundle and Gesdinet JWT Refresh Token Bundle. The changes enable secure API authentication with token-based access control and refresh token functionality.

  • Integrates JWT authentication bundles (lexik/jwt-authentication-bundle v3.1 and gesdinet/jwt-refresh-token-bundle v1.5)
  • Updates User entity to implement UserInterface and adds authentication endpoints
  • Configures security settings with stateless JWT authentication and access control rules

Reviewed Changes

Copilot reviewed 11 out of 14 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
symfony.lock Adds lock entries for the two JWT-related bundles
composer.json Adds dependencies for lexik/jwt-authentication-bundle and gesdinet/jwt-refresh-token-bundle
composer.lock Updates dependency lock file with JWT bundles and upgrades doctrine packages
config/bundles.php Registers LexikJWTAuthenticationBundle and GesdinetJWTRefreshTokenBundle
config/packages/security.yaml Configures JWT-based authentication with json_login, refresh token support, and access control rules
config/packages/lexik_jwt_authentication.yaml Sets up JWT configuration with secret/public keys and passphrase
config/packages/gesdinet_jwt_refresh_token.yaml Configures refresh token entity class
config/packages/api_platform.yaml Adds JWT authorization to Swagger documentation
config/routes.yaml Defines routes for login and token refresh endpoints
src/Entity/User.php Implements UserInterface, adds API operations for login/registration, and includes eraseCredentials method
src/Entity/RefreshToken.php Creates RefreshToken entity extending base bundle class
migrations/Version20251112160004.php Adds database migration for refresh_tokens table and updates user table column lengths
.env Adds JWT environment variables including secret/public key paths and passphrase
.gitignore Excludes JWT private keys from version control

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chloecasali
Copy link
Copy Markdown
Owner Author

chloecasali commented Nov 14, 2025

  • try to remove test deprecations

  • fix copilot review

  • test for refresh token

chloecasali and others added 5 commits November 14, 2025 17:44
* user can create an account

* improve tests + wip token into request's header

* delete redundant role

* improve fixures by adding a admin user

* add role hierarchy + only authorized routes for admin user + dont serialize password in json response

* update functional tests + fix role logic in controller + wip refactor

* refactor tests

* fix prettier

* delete comments + fix test in ci with jwt keys

* Update config/packages/security.yaml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Controller/RegistrationController.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update config/packages/security.yaml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/Controller/RegistrationController.php

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Chloe Casali <chloecasali2003@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@chloecasali chloecasali self-assigned this Nov 14, 2025
@chloecasali chloecasali merged commit 4ebe2fe into main Nov 14, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add jwt authentication

2 participants