diff --git a/pom.xml b/pom.xml
index de4e6bb3..bc1bef28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,18 +51,17 @@
 
 
 	<dependencies>
-		<!--
-		https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
+		<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop -->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-aop</artifactId>
 		</dependency>
-		<dependency> 
-			<groupId>co.elastic.logging</groupId> 
-			<artifactId>logback-ecs-encoder</artifactId> 
-			<version>1.3.2</version> 
+		<dependency>
+			<groupId>co.elastic.logging</groupId>
+			<artifactId>logback-ecs-encoder</artifactId>
+			<version>1.3.2</version>
 		</dependency>
-	
+
 		<dependency>
 			<groupId>org.slf4j</groupId>
 			<artifactId>slf4j-api</artifactId>
@@ -141,7 +140,7 @@
 			<artifactId>spring-boot-starter-test</artifactId>
 			<scope>test</scope>
 		</dependency>
-		
+
 		<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
 		<dependency>
 			<groupId>com.google.guava</groupId>
@@ -163,7 +162,7 @@
 			<artifactId>json</artifactId>
 			<version>20231013</version>
 		</dependency>
-		
+
 		<dependency>
 			<groupId>jakarta.servlet</groupId>
 			<artifactId>jakarta.servlet-api</artifactId>
@@ -193,8 +192,7 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
-		<!--
-		https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis -->
+		<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-redis -->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-data-redis</artifactId>
@@ -239,8 +237,7 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
-		<!--
-		https://mvnrepository.com/artifact/org.springframework.session/spring-session-data-redis -->
+		<!-- https://mvnrepository.com/artifact/org.springframework.session/spring-session-data-redis -->
 		<dependency>
 			<groupId>org.springframework.session</groupId>
 			<artifactId>spring-session-data-redis</artifactId>
@@ -266,8 +263,7 @@
 			<artifactId>jackson-datatype-joda</artifactId>
 			<version>2.17.0</version>
 		</dependency>
-		<!--
-		https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
+		<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-databind</artifactId>
@@ -279,8 +275,28 @@
 			<artifactId>jackson-core</artifactId>
 			<version>2.17.0-rc1</version>
 		</dependency>
+		<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-api -->
+		<dependency>
+			<groupId>io.jsonwebtoken</groupId>
+			<artifactId>jjwt-api</artifactId>
+			<version>0.12.6</version>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-impl -->
+		<dependency>
+			<groupId>io.jsonwebtoken</groupId>
+			<artifactId>jjwt-impl</artifactId>
+			<version>0.12.6</version>
+			<scope>runtime</scope>
+		</dependency>
+		<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt-jackson -->
+		<dependency>
+			<groupId>io.jsonwebtoken</groupId>
+			<artifactId>jjwt-jackson</artifactId>
+			<version>0.12.6</version>
+			<scope>runtime</scope>
+		</dependency>
 	</dependencies>
-	
+
 
 
 	<build>
@@ -371,8 +387,7 @@
 									${target-properties} and
 									${source-properties}
 								</echo>
-								<concat destfile="${target-properties}"
-									append="yes"
+								<concat destfile="${target-properties}" append="yes"
 									force="yes">
 									<fileset file="${source-properties}">
 									</fileset>
diff --git a/src/main/environment/common_ci.properties b/src/main/environment/common_ci.properties
index 21c1dea4..5a1f395e 100644
--- a/src/main/environment/common_ci.properties
+++ b/src/main/environment/common_ci.properties
@@ -67,6 +67,9 @@ tcSpeclistWL=7
 
 ### Redis IP
 spring.redis.host=localhost
+jwt.secret=@env.JWT_SECRET_KEY@
+
 
 #ELK logging file name
-logging.file.name=@env.TM_API_LOGGING_FILE_NAME@
\ No newline at end of file
+logging.file.name=@env.TM_API_LOGGING_FILE_NAME@
+
diff --git a/src/main/environment/common_dev.properties b/src/main/environment/common_dev.properties
index 8d0dd347..2d294e09 100644
--- a/src/main/environment/common_dev.properties
+++ b/src/main/environment/common_dev.properties
@@ -66,4 +66,5 @@ tcSpeclistWL=7
 prescription=TMPrescription SMS
 ### Redis IP
 spring.redis.host=localhost
+jwt.secret=
 
diff --git a/src/main/environment/common_test.properties b/src/main/environment/common_test.properties
index 76338b13..229cf96d 100644
--- a/src/main/environment/common_test.properties
+++ b/src/main/environment/common_test.properties
@@ -69,6 +69,7 @@ prescription=TMPrescription SMS
 
 ### Redis IP
 spring.redis.host=localhost
+jwt.secret=
 
 
 
diff --git a/src/main/environment/common_uat.properties b/src/main/environment/common_uat.properties
index 913c2808..68411bb1 100644
--- a/src/main/environment/common_uat.properties
+++ b/src/main/environment/common_uat.properties
@@ -68,5 +68,6 @@ tcSpeclistWL=7
 prescription=TMPrescription SMS
 ### Redis IP
 spring.redis.host=localhost
+jwt.secret=
 
 
diff --git a/src/main/java/com/iemr/tm/Application.java b/src/main/java/com/iemr/tm/Application.java
index 5b1ecd65..97f380b2 100644
--- a/src/main/java/com/iemr/tm/Application.java
+++ b/src/main/java/com/iemr/tm/Application.java
@@ -25,8 +25,13 @@
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
 import org.springframework.web.client.RestTemplate;
 
+import com.iemr.tm.data.login.Users;
 import com.iemr.tm.utils.IEMRApplBeans;
 
 @SpringBootApplication
@@ -45,5 +50,20 @@ public IEMRApplBeans instantiateBeans() {
 	public RestTemplate getRestTemplate() {
 		return new RestTemplate();
 	}
+	
+	@Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
+        RedisTemplate<String, Object> template = new RedisTemplate<>();
+        template.setConnectionFactory(factory);
+
+        // Use StringRedisSerializer for keys (userId)
+        template.setKeySerializer(new StringRedisSerializer());
+
+        // Use Jackson2JsonRedisSerializer for values (Users objects)
+        Jackson2JsonRedisSerializer<Users> serializer = new Jackson2JsonRedisSerializer<>(Users.class);
+        template.setValueSerializer(serializer);
+
+        return template;
+    }
 
 }
diff --git a/src/main/java/com/iemr/tm/config/RedisConfig.java b/src/main/java/com/iemr/tm/config/RedisConfig.java
new file mode 100644
index 00000000..7c75fb52
--- /dev/null
+++ b/src/main/java/com/iemr/tm/config/RedisConfig.java
@@ -0,0 +1,38 @@
+package com.iemr.tm.config;
+
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.springframework.session.data.redis.config.ConfigureRedisAction;
+
+import com.iemr.tm.data.login.Users;
+
+@Configuration
+@EnableCaching
+public class RedisConfig {
+
+	@Bean
+	public ConfigureRedisAction configureRedisAction() {
+		return ConfigureRedisAction.NO_OP;
+	}
+
+	@Bean
+	public RedisTemplate<String, Users> redisTemplate(RedisConnectionFactory factory) {
+		RedisTemplate<String, Users> template = new RedisTemplate<>();
+		template.setConnectionFactory(factory);
+
+		// Use StringRedisSerializer for keys (userId)
+		template.setKeySerializer(new StringRedisSerializer());
+
+		// Use Jackson2JsonRedisSerializer for values (Users objects)
+		Jackson2JsonRedisSerializer<Users> serializer = new Jackson2JsonRedisSerializer<>(Users.class);
+		template.setValueSerializer(serializer);
+
+		return template;
+	}
+
+}
diff --git a/src/main/java/com/iemr/tm/data/login/Users.java b/src/main/java/com/iemr/tm/data/login/Users.java
index 53d1b44d..6f8bd9f2 100644
--- a/src/main/java/com/iemr/tm/data/login/Users.java
+++ b/src/main/java/com/iemr/tm/data/login/Users.java
@@ -21,7 +21,9 @@
 */
 package com.iemr.tm.data.login;
 
-import java.sql.Timestamp;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 
 import jakarta.persistence.Column;
 import jakarta.persistence.Entity;
@@ -29,90 +31,20 @@
 import jakarta.persistence.GenerationType;
 import jakarta.persistence.Id;
 import jakarta.persistence.Table;
-
-import com.google.gson.annotations.Expose;
+import lombok.Data;
 
 @Entity
+@Data
 @Table(name = "m_user")
-public class Users {
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class Users implements Serializable {
 	@Id
 	@GeneratedValue(strategy = GenerationType.IDENTITY)
-	@Expose
 	@Column(name = "UserID")
 	private Long userID;
-	@Expose
-	@Column(name = "TitleID")	private Short titleID;
-	@Expose
-	@Column(name = "FirstName")
-	private String firstName;
-	@Expose
-	@Column(name = "MiddleName")
-	private String middleName;
-	@Expose
-	@Column(name = "lastName")
-	private String lastName;
-	@Expose
-	@Column(name = "GenderID")
-	private Short genderID;
-	@Expose
-	@Column(name = "MaritalStatusID")
-	private Short maritalStatusID;
-	@Expose
-	@Column(name = "AadhaarNo")
-	private String aadhaarNo;
-	@Expose
-	@Column(name = "PAN")
-	private String pan;
-	@Expose
-	@Column(name = "DOB")
-	private Timestamp dob;
-	@Expose
-	@Column(name = "DOJ")
-	private Timestamp doj;
-	@Expose
-	@Column(name = "QualificationID")
-	private Integer qualificationID;
-	@Expose
 	@Column(name = "UserName")
 	private String userName;
-	@Expose
-	@Column(name = "Password")
-	private String password;
-	@Expose
-	@Column(name = "AgentID")
-	private String agentID;
-	@Expose
-	@Column(name = "AgentPassword")
-	private String agentPassword;
-	@Expose
-	@Column(name = "EmailID")
-	private String emailID;
-	@Expose
-	@Column(name = "StatusID")
-	private Short statusID;
-	@Expose
-	@Column(name = "EmergencyContactPerson")
-	private String emergencyContactPerson;
-	@Expose
-	@Column(name = "EmergencyContactNo")
-	private String emergencyContactNo;
-	@Expose
-	@Column(name = "IsSupervisor")
-	private Boolean isSupervisor;
-	@Expose
-	@Column(name = "Deleted")
-	private Boolean deleted;
-	@Expose
-	@Column(name = "CreatedBy")
-	private String createdBy;
-	@Expose
-	@Column(name = "CreatedDate")
-	private Timestamp createdDate;
-	@Expose
-	@Column(name = "ModifiedBy")
-	private String modifiedBy;
-	@Expose
-	@Column(name = "LastModDate")
-	private Timestamp lastModDate;
+	@Column(name = "Deleted", insertable = false, updatable = false)
+	private Boolean Deleted;
 
 }
diff --git a/src/main/java/com/iemr/tm/repo/login/UserLoginRepo.java b/src/main/java/com/iemr/tm/repo/login/UserLoginRepo.java
new file mode 100644
index 00000000..0898602d
--- /dev/null
+++ b/src/main/java/com/iemr/tm/repo/login/UserLoginRepo.java
@@ -0,0 +1,16 @@
+package com.iemr.tm.repo.login;
+
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.CrudRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import com.iemr.tm.data.login.Users;
+
+@Repository
+public interface UserLoginRepo extends CrudRepository<Users, Long> {
+
+	@Query(" SELECT u FROM Users u WHERE u.userID = :userID AND u.Deleted = false ")
+	public Users getUserByUserID(@Param("userID") Long userID);
+
+}
diff --git a/src/main/java/com/iemr/tm/utils/CookieUtil.java b/src/main/java/com/iemr/tm/utils/CookieUtil.java
new file mode 100644
index 00000000..6685af01
--- /dev/null
+++ b/src/main/java/com/iemr/tm/utils/CookieUtil.java
@@ -0,0 +1,31 @@
+package com.iemr.tm.utils;
+
+import java.util.Arrays;
+import java.util.Optional;
+
+import org.springframework.stereotype.Service;
+
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+@Service
+public class CookieUtil {
+
+	public Optional<String> getCookieValue(HttpServletRequest request, String cookieName) {
+		Cookie[] cookies = request.getCookies();
+		if (cookies != null) {
+			for (Cookie cookie : cookies) {
+				if (cookieName.equals(cookie.getName())) {
+					return Optional.of(cookie.getValue());
+				}
+			}
+		}
+		return Optional.empty();
+	}
+
+	public String getJwtTokenFromCookie(HttpServletRequest request) {
+		return Arrays.stream(request.getCookies()).filter(cookie -> "Jwttoken".equals(cookie.getName()))
+				.map(Cookie::getValue).findFirst().orElse(null);
+	}
+}
diff --git a/src/main/java/com/iemr/tm/utils/FilterConfig.java b/src/main/java/com/iemr/tm/utils/FilterConfig.java
new file mode 100644
index 00000000..48aee27b
--- /dev/null
+++ b/src/main/java/com/iemr/tm/utils/FilterConfig.java
@@ -0,0 +1,19 @@
+package com.iemr.tm.utils;
+
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class FilterConfig {
+
+	@Bean
+	public FilterRegistrationBean<JwtUserIdValidationFilter> jwtUserIdValidationFilter(
+			JwtAuthenticationUtil jwtAuthenticationUtil) {
+		FilterRegistrationBean<JwtUserIdValidationFilter> registrationBean = new FilterRegistrationBean<>();
+		registrationBean.setFilter(new JwtUserIdValidationFilter(jwtAuthenticationUtil));
+		registrationBean.addUrlPatterns("/*"); // Apply filter to all API endpoints
+		return registrationBean;
+	}
+
+}
diff --git a/src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java b/src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java
new file mode 100644
index 00000000..0a59bba6
--- /dev/null
+++ b/src/main/java/com/iemr/tm/utils/JwtAuthenticationUtil.java
@@ -0,0 +1,127 @@
+package com.iemr.tm.utils;
+
+import java.util.Optional;
+import java.util.concurrent.TimeUnit;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+
+import com.iemr.tm.data.login.Users;
+import com.iemr.tm.repo.login.UserLoginRepo;
+import com.iemr.tm.utils.exception.IEMRException;
+
+import io.jsonwebtoken.Claims;
+import jakarta.servlet.http.HttpServletRequest;
+
+@Component
+public class JwtAuthenticationUtil {
+
+	@Autowired
+	private CookieUtil cookieUtil;
+	@Autowired
+	private JwtUtil jwtUtil;
+	@Autowired
+	private RedisTemplate<String, Object> redisTemplate;
+	@Autowired
+	private UserLoginRepo userLoginRepo;
+	private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
+
+	public JwtAuthenticationUtil(CookieUtil cookieUtil, JwtUtil jwtUtil) {
+		this.cookieUtil = cookieUtil;
+		this.jwtUtil = jwtUtil;
+	}
+
+	public ResponseEntity<String> validateJwtToken(HttpServletRequest request) {
+		Optional<String> jwtTokenOpt = cookieUtil.getCookieValue(request, "Jwttoken");
+
+		if (jwtTokenOpt.isEmpty()) {
+			return ResponseEntity.status(HttpStatus.UNAUTHORIZED)
+					.body("Error 401: Unauthorized - JWT Token is not set!");
+		}
+
+		String jwtToken = jwtTokenOpt.get();
+
+		// Validate the token
+		Claims claims = jwtUtil.validateToken(jwtToken);
+		if (claims == null) {
+			return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body("Error 401: Unauthorized - Invalid JWT Token!");
+		}
+
+		// Extract username from token
+		String usernameFromToken = claims.getSubject();
+		if (usernameFromToken == null || usernameFromToken.isEmpty()) {
+			return ResponseEntity.status(HttpStatus.UNAUTHORIZED)
+					.body("Error 401: Unauthorized - Username is missing!");
+		}
+
+		// Return the username if valid
+		return ResponseEntity.ok(usernameFromToken);
+	}
+
+	public boolean validateUserIdAndJwtToken(String jwtToken) throws IEMRException {
+		try {
+			// Validate JWT token and extract claims
+			Claims claims = jwtUtil.validateToken(jwtToken);
+
+			if (claims == null) {
+				throw new IEMRException("Invalid JWT token.");
+			}
+
+			String userId = claims.get("userId", String.class);
+
+			// Check if user data is present in Redis
+			Users user = getUserFromCache(userId);
+			if (user == null) {
+				// If not in Redis, fetch from DB and cache the result
+				user = fetchUserFromDB(userId);
+			}
+			if (user == null) {
+				throw new IEMRException("Invalid User ID.");
+			}
+
+			return true; // Valid userId and JWT token
+		} catch (Exception e) {
+			logger.error("Validation failed: " + e.getMessage(), e);
+			throw new IEMRException("Validation error: " + e.getMessage(), e);
+		}
+	}
+
+	private Users getUserFromCache(String userId) {
+		String redisKey = "user_" + userId; // The Redis key format
+		Users user = (Users) redisTemplate.opsForValue().get(redisKey);
+
+		if (user == null) {
+			logger.warn("User not found in Redis. Will try to fetch from DB.");
+		} else {
+			logger.info("User fetched successfully from Redis.");
+		}
+
+		return user; // Returns null if not found
+	}
+
+	private Users fetchUserFromDB(String userId) {
+		// This method will only be called if the user is not found in Redis.
+		String redisKey = "user_" + userId; // Redis key format
+
+		// Fetch user from DB
+		Users user = userLoginRepo.getUserByUserID(Long.parseLong(userId));
+
+		if (user != null) {
+			// Cache the user in Redis for future requests (cache for 30 minutes)
+			redisTemplate.opsForValue().set(redisKey, user, 30, TimeUnit.MINUTES);
+
+			// Log that the user has been stored in Redis
+			logger.info("User stored in Redis with key: " + redisKey);
+		} else {
+			logger.warn("User not found for userId: " + userId);
+		}
+
+		return user;
+	}
+
+}
diff --git a/src/main/java/com/iemr/tm/utils/JwtUserIdValidationFilter.java b/src/main/java/com/iemr/tm/utils/JwtUserIdValidationFilter.java
new file mode 100644
index 00000000..06e3a5e8
--- /dev/null
+++ b/src/main/java/com/iemr/tm/utils/JwtUserIdValidationFilter.java
@@ -0,0 +1,111 @@
+package com.iemr.tm.utils;
+
+import java.io.IOException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+import jakarta.servlet.Filter;
+import jakarta.servlet.FilterChain;
+import jakarta.servlet.ServletException;
+import jakarta.servlet.ServletRequest;
+import jakarta.servlet.ServletResponse;
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+
+@Component
+public class JwtUserIdValidationFilter implements Filter {
+
+	private final JwtAuthenticationUtil jwtAuthenticationUtil;
+	private final Logger logger = LoggerFactory.getLogger(this.getClass().getName());
+
+	public JwtUserIdValidationFilter(JwtAuthenticationUtil jwtAuthenticationUtil) {
+		this.jwtAuthenticationUtil = jwtAuthenticationUtil;
+	}
+
+	@Override
+	public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+			throws IOException, ServletException {
+		HttpServletRequest request = (HttpServletRequest) servletRequest;
+		HttpServletResponse response = (HttpServletResponse) servletResponse;
+
+		String path = request.getRequestURI();
+		String contextPath = request.getContextPath();
+		logger.info("JwtUserIdValidationFilter invoked for path: " + path);
+
+		// Log cookies for debugging
+		Cookie[] cookies = request.getCookies();
+		if (cookies != null) {
+			for (Cookie cookie : cookies) {
+				if ("userId".equals(cookie.getName())) {
+					logger.warn("userId found in cookies! Clearing it...");
+					clearUserIdCookie(response); // Explicitly remove userId cookie
+				}
+			}
+		} else {
+			logger.info("No cookies found in the request");
+		}
+
+		// Log headers for debugging
+		String jwtTokenFromHeader = request.getHeader("Jwttoken");
+		logger.info("JWT token from header: ");
+
+		// Skip login and public endpoints
+		if (path.equals(contextPath + "/user/userAuthenticate")
+				|| path.equalsIgnoreCase(contextPath + "/user/logOutUserFromConcurrentSession")
+				|| path.startsWith(contextPath + "/public")) {
+			logger.info("Skipping filter for path: " + path);
+			filterChain.doFilter(servletRequest, servletResponse);
+			return;
+		}
+
+		try {
+			// Retrieve JWT token from cookies
+			String jwtTokenFromCookie = getJwtTokenFromCookies(request);
+			logger.info("JWT token from cookie: ");
+
+			// Determine which token (cookie or header) to validate
+			String jwtToken = jwtTokenFromCookie != null ? jwtTokenFromCookie : jwtTokenFromHeader;
+			if (jwtToken == null) {
+				response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "JWT token not found in cookies or headers");
+				return;
+			}
+
+			// Validate JWT token and userId
+			boolean isValid = jwtAuthenticationUtil.validateUserIdAndJwtToken(jwtToken);
+
+			if (isValid) {
+				// If token is valid, allow the request to proceed
+				filterChain.doFilter(servletRequest, servletResponse);
+			} else {
+				response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Invalid JWT token");
+			}
+		} catch (Exception e) {
+			logger.error("Authorization error: ", e);
+			response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Authorization error: " + e.getMessage());
+		}
+	}
+
+	private String getJwtTokenFromCookies(HttpServletRequest request) {
+		Cookie[] cookies = request.getCookies();
+		if (cookies != null) {
+			for (Cookie cookie : cookies) {
+				if (cookie.getName().equals("Jwttoken")) {
+					return cookie.getValue();
+				}
+			}
+		}
+		return null;
+	}
+
+	private void clearUserIdCookie(HttpServletResponse response) {
+		Cookie cookie = new Cookie("userId", null);
+		cookie.setPath("/");
+		cookie.setHttpOnly(true);
+		cookie.setSecure(true);
+		cookie.setMaxAge(0); // Invalidate the cookie
+		response.addCookie(cookie);
+	}
+}
diff --git a/src/main/java/com/iemr/tm/utils/JwtUtil.java b/src/main/java/com/iemr/tm/utils/JwtUtil.java
new file mode 100644
index 00000000..83d98119
--- /dev/null
+++ b/src/main/java/com/iemr/tm/utils/JwtUtil.java
@@ -0,0 +1,52 @@
+package com.iemr.tm.utils;
+
+import java.security.Key;
+import java.util.Date;
+import java.util.function.Function;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+import io.jsonwebtoken.security.Keys;
+
+@Component
+public class JwtUtil {
+
+	@Value("${jwt.secret}")
+	private String SECRET_KEY;
+
+	private static final long EXPIRATION_TIME = 24L * 60 * 60 * 1000; // 1 day in milliseconds
+
+	// Generate a key using the secret
+	private Key getSigningKey() {
+		if (SECRET_KEY == null || SECRET_KEY.isEmpty()) {
+			throw new IllegalStateException("JWT secret key is not set in application.properties");
+		}
+		return Keys.hmacShaKeyFor(SECRET_KEY.getBytes());
+	}
+
+	// Validate and parse JWT Token
+	public Claims validateToken(String token) {
+		try {
+			return Jwts.parser().setSigningKey(getSigningKey()).build().parseClaimsJws(token).getBody();
+		} catch (Exception e) {
+			return null; // Handle token parsing/validation errors
+		}
+	}
+
+	public String extractUsername(String token) {
+		return extractClaim(token, Claims::getSubject);
+	}
+
+	public <T> T extractClaim(String token, Function<Claims, T> claimsResolver) {
+		final Claims claims = extractAllClaims(token);
+		return claimsResolver.apply(claims);
+	}
+
+	private Claims extractAllClaims(String token) {
+		return Jwts.parser().setSigningKey(getSigningKey()).build().parseClaimsJws(token).getBody();
+	}
+}
