提交 486816c8 编写于 作者: pig_冷冷's avatar pig_冷冷

🐛 fix #IWG40 用户退出没有删除refresh_token

上级 5d562e85
......@@ -33,6 +33,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.common.OAuth2AccessToken;
import org.springframework.security.oauth2.common.OAuth2RefreshToken;
import org.springframework.security.oauth2.common.util.OAuth2Utils;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.token.TokenStore;
......@@ -69,7 +70,7 @@ public class PigTokenEndpoint {
public R<Boolean> logout(@RequestHeader(value = HttpHeaders.AUTHORIZATION, required = false) String authHeader) {
if (StrUtil.isBlank(authHeader)) {
return R.<Boolean>builder()
.code(CommonConstants.FAIL)
.code(CommonConstants.SUCCESS)
.data(Boolean.FALSE)
.msg("退出失败,token 为空").build();
}
......@@ -78,11 +79,15 @@ public class PigTokenEndpoint {
OAuth2AccessToken accessToken = tokenStore.readAccessToken(tokenValue);
if (accessToken == null || StrUtil.isBlank(accessToken.getValue())) {
return R.<Boolean>builder()
.code(CommonConstants.FAIL)
.code(CommonConstants.SUCCESS)
.data(Boolean.FALSE)
.msg("退出失败,token 无效").build();
}
tokenStore.removeAccessToken(accessToken);
OAuth2RefreshToken refreshToken = tokenStore.readRefreshToken(tokenValue);
tokenStore.removeRefreshToken(refreshToken);
return R.<Boolean>builder()
.code(CommonConstants.SUCCESS)
.data(Boolean.TRUE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册