您的位置:首页 > 编程语言 > Java开发

Spring Cloud authentication with JWT service

2017-08-23 00:13 393 查看
@RequestMapping(value = "/authenticate", method = 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: