From 8cdb4aec205d1e7d2c3290469e516794a3e0ce6d Mon Sep 17 00:00:00 2001 From: MathewFrancis Date: Thu, 15 May 2025 14:58:04 +0530 Subject: [PATCH] JWT token username update --- .../cezenPBX/config/CustomAuthenticationProviderForCezen.java | 2 +- .../com/example/cezenPBX/security/JWTTokenGeneratorFilter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CustomAuthenticationProviderForCezen.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CustomAuthenticationProviderForCezen.java index b6c7677..f7edc02 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CustomAuthenticationProviderForCezen.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/config/CustomAuthenticationProviderForCezen.java @@ -66,7 +66,7 @@ public class CustomAuthenticationProviderForCezen implements AuthenticationProvi return null; } - return new UsernamePasswordAuthenticationToken(user, pwd, authorities); + return new UsernamePasswordAuthenticationToken(user.getUserName(), pwd, authorities); } else { throw new BadCredentialsException("Invalid password!"); } diff --git a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java index d2b5838..6fe5da3 100644 --- a/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java +++ b/MySQL_conf_pbx/test1/springCezenPBX/src/main/java/com/example/cezenPBX/security/JWTTokenGeneratorFilter.java @@ -27,7 +27,7 @@ public class JWTTokenGeneratorFilter extends OncePerRequestFilter { //at this point the user is authenticated we just have to send the token back Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - System.out.println(authentication); + System.out.println(authentication.getName()+" Is the name "); if (null != authentication) { //get the JWT key from the contents we defined