永久会员
- 威望
- 1889
- 贡献
- 2162
- 热心值
- 0
- 金币
- 999
- 注册时间
- 2020-11-23
|
@Autowired
private ConsumerTokenServices consumerTokenServices;
@GetMapping("oauth/test")
public String testOauth() {
return "oauth";
}
@GetMapping("user")
public Principal currentUser(Principal principal) {
return principal;
}
@DeleteMapping("signout")
public FebsResponse signout(HttpServletRequest request) throws FebsAuthException {
String authorization = request.getHeader("Authorization");
String token = StringUtils.replace(authorization, "bearer ", "");
FebsResponse febsResponse = new FebsResponse();
if (!consumerTokenServices.revokeToken(token)) {
throw new FebsAuthException("退出登录失败");
}
return febsResponse.message("退出登录成功");
} @Autowired
private ConsumerTokenServices consumerTokenServices;
@GetMapping("oauth/test")
public String testOauth() {
return "oauth";
}
@GetMapping("user")
public Principal currentUser(Principal principal) {
return principal;
}
@DeleteMapping("signout")
public FebsResponse signout(HttpServletRequest request) throws FebsAuthException {
String authorization = request.getHeader("Authorization");
String token = StringUtils.replace(authorization, "bearer ", "");
FebsResponse febsResponse = new FebsResponse();
if (!consumerTokenServices.revokeToken(token)) {
throw new FebsAuthException("退出登录失败");
}
return febsResponse.message("退出登录成功");
} |
|