我设法为微服务用户添加了安全性。但我现在面临的问题是,我无法使用 open feign 使微服务(用户微服务和票证微服务)相互通信,因为其中之一现在由 Spring Security 和 JWT 保护。请问我该如何解决这个问题?
这是我的控制器的一部分
@GetMapping("/find-ticket/{id}")
public ResponseEntity<Ticket> findTicketById(@PathVariable("id") UUID ticketId)
{
Ticket ticket= ticketService.findTicketById(ticketId);
ticket.setUser(userService.findUserById(ticket.getUserId()));
ResponseEntity<Ticket> responseEntity = new ResponseEntity<>(ticket, HttpStatus.OK);
return responseEntity;
}
这是工单微服务的UserService接口
@FeignClient(name = "USER-SERVICE")
public interface UserService {
@GetMapping("/find-user/{id}")
public User findUserById(@PathVariable(name = "id") UUID USER_ID);
}