Skip to content

Commit bd9dae2

Browse files
committed
fix: coderabbit comments
1 parent 5b7b281 commit bd9dae2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/main/java/com/iemr/tm/controller/foetalmonitor/FoetalMonitorController.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050

5151
@RestController
5252
@RequestMapping(value = "/foetalMonitor", headers = "Authorization", consumes = "application/json", produces = "application/json")
53-
@PreAuthorize("hasRole('NURSE') || hasRole('DOCTOR') || hasRole('REGISTRAR')")
5453
public class FoetalMonitorController {
5554
@Autowired
5655
private FoetalMonitorService foetalMonitorService;

src/main/java/com/iemr/tm/utils/mapper/RoleAuthenticationFilter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
5151
filterChain.doFilter(request, response);
5252
return;
5353
}
54-
Claims extractAllClaims = jwtUtil.extractAllClaims(jwtToken);
55-
if(null == extractAllClaims) {
54+
Claims claims = jwtUtil.validateToken(jwtToken);
55+
if(null == claims) {
5656
filterChain.doFilter(request, response);
5757
return;
5858
}
59-
Object userIdObj = extractAllClaims.get("userId");
59+
Object userIdObj = claims.get("userId");
6060
String userId = userIdObj != null ? userIdObj.toString() : null;
6161
if (null == userId || userId.trim().isEmpty()) {
6262
filterChain.doFilter(request, response);

src/main/java/com/iemr/tm/utils/redis/RedisStorage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public void cacheUserRoles(Long userId, List<String> roles) {
104104
String key = "roles:" + userId;
105105
redisTemplate.delete(key); // Clear previous cache
106106
redisTemplate.opsForList().rightPushAll(key, roles);
107+
redisTemplate.expire(key, 30, java.util.concurrent.TimeUnit.MINUTES);
107108
} catch (Exception e) {
108109
logger.warn("Failed to cache role for user {} : {} ", userId, e.getMessage());
109110
}

0 commit comments

Comments
 (0)