Refactoring to avoid deprecated methods #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello and thank you for your repository. It saved me countless hours trying to understand how to use spring security and jwt tokens in my code for my project. I believe that it might be useful for others too, so here is some small refactoring, so code stays up to date with the latest version of spring security.
This pull request includes several changes to improve the security configuration and token handling in the Spring Security Demo project. The most important changes include modifying the
User
class, updating the CSRF configuration, and enhancing the JWT token processing.Changes to
User
class:src/main/kotlin/com/hadiyarajesh/spring_security_demo/model/User.kt
: Changeddata class User
toclass User
and added acopy
method to facilitate object copying. [1] [2]Security configuration updates:
src/main/kotlin/com/hadiyarajesh/spring_security_demo/security/SecurityConfiguration.kt
: Updated CSRF configuration to usePathRequest.toH2Console()
and refactored session management and request authorization setup.JWT token handling improvements:
src/main/kotlin/com/hadiyarajesh/spring_security_demo/security/TokenProvider.kt
: Refactored JWT token processing to useJwts.parserBuilder()
andKeys.hmacShaKeyFor()
for improved security and error handling. [1] [2] [3] [4]Database configuration change:
src/main/resources/application.yml
: Changed the H2 database URL to use an in-memory database for testing purposes.