redis客户端使用lettuce代替jedis

This commit is contained in:
zlt
2019-07-12 15:44:57 +08:00
parent 482bc3d9b7
commit 426f0b6ac1
7 changed files with 49 additions and 108 deletions
@@ -1,5 +1,6 @@
package com.central.oauth.handler;
import cn.hutool.core.util.StrUtil;
import com.central.oauth2.common.util.AuthUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -26,8 +27,11 @@ public class OauthLogoutHandler implements LogoutHandler {
@Override
public void logout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) {
Assert.notNull(tokenStore, "tokenStore must be set");
String token = AuthUtils.extractToken(request);
if(StringUtils.isNotBlank(token)){
String token = request.getParameter("token");
if (StrUtil.isEmpty(token)) {
token = AuthUtils.extractToken(request);
}
if(StrUtil.isNotEmpty(token)){
OAuth2AccessToken existingAccessToken = tokenStore.readAccessToken(token);
OAuth2RefreshToken refreshToken;
if (existingAccessToken != null) {
@@ -52,7 +52,9 @@ public class RedisTokensServiceImpl implements ITokensService {
tokenVo.setClientId(clientId);
tokenVo.setTokenValue(accessToken.getValue());
tokenVo.setExpiration(accessToken.getExpiration());
tokenVo.setUsername(authentication.getName());
if (authentication != null) {
tokenVo.setUsername(authentication.getName());
}
result.add(tokenVo);
}
}