0
点赞
收藏
分享

微信扫一扫

Spring Cloud authentication with JWT service

老罗话编程 2022-08-24 阅读 68

 

RequestMethod.POST)
public ResponseEntity<AuthTokenDTO> authenticate(@Valid @RequestBody AuthenticationDTO authenticationDTO) {
User user = userManagementService.authenticateUser(
authenticationDTO.getEmail(), authenticationDTO.getPassword());
if (user != null) {
return new ResponseEntity<>(buildAuthenticationTokenFromUser(user), HttpStatus.OK);
} else {
return new ResponseEntity<>(HttpStatus.UNAUTHORIZED);
}
}

​​https://github.com/vdubois/spring-cloud-sample-authentication-service/blob/a442f7a10bf9529dbb68b669ed394fed51fcc330/src/main/java/io/github/vdubois/controller/AuthenticationController.java​​

 



举报

相关推荐

0 条评论