修改加解密

master
bynt 2 years ago
parent e7939ee7a9
commit ee713fcaaf

@ -129,6 +129,7 @@ public class AuthServerConfig extends AuthorizationServerConfigurerAdapter {
endpoints
.tokenGranter(tokenGranter(endpoints, tokenServices))
.tokenServices(tokenServices)
.accessTokenConverter(jwtAccessTokenConverter())
// 配置请求方式
.allowedTokenEndpointRequestMethods(HttpMethod.GET, HttpMethod.POST)
// 配置token的存储位置

@ -5,7 +5,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
@ -49,7 +49,7 @@ public class OnlineUser implements Serializable {
/**
*
*/
private LocalDateTime loginTime;
private Date loginTime;
/**
* 访token

@ -2,10 +2,9 @@ package com.baiye.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.text.CharSequenceUtil;
import com.baiye.constant.SecurityConstants;
import com.baiye.entity.OnlineUser;
import com.baiye.service.IOnlineUserService;
import com.baiye.constant.SecurityConstants;
import com.baiye.util.CacheKey;
import com.baiye.util.PageUtil;
import com.baiye.util.RedisUtils;
@ -22,12 +21,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -67,8 +61,7 @@ public class OnlineServiceImpl implements IOnlineUserService {
String tokenValue = accessToken.getValue();
int expiresIn = accessToken.getExpiresIn();
String refreshToken = accessToken.getRefreshToken().getValue();
OnlineUser onlineUser = new OnlineUser(userId, username, browser, ip, cityInfo,
LocalDateTime.now(ZoneId.systemDefault()), tokenValue, refreshToken, expiresIn);
OnlineUser onlineUser = new OnlineUser(userId, username, browser, ip, cityInfo, new Date(), tokenValue, refreshToken, expiresIn);
this.redisUtils.set(CacheKey.ONLINE_USER + userId, onlineUser, expiresIn, TimeUnit.SECONDS);
}
@ -99,12 +92,13 @@ public class OnlineServiceImpl implements IOnlineUserService {
} else if (userId == null) {
userId = (Long) oAuth2AccessToken.getAdditionalInformation().get(SecurityConstants.DETAILS_USER_ID);
}
String username = (String) oAuth2AccessToken.getAdditionalInformation().get(SecurityConstants.DETAILS_USERNAME);
// 判断oAuth2AccessToken是否为空oAuth2AccessToken是否有token的值
if (BeanUtil.isEmpty(oAuth2AccessToken)) {
// 都为空说明已经注销直接返回true
return true;
}
String username = (String) oAuth2AccessToken.getAdditionalInformation().get(SecurityConstants.DETAILS_USERNAME);
// 判断oAuth2AccessToken是否为空oAuth2AccessToken是否有token的值
// 清理redis中存储的信息
this.redisTokenStore.removeAccessToken(oAuth2AccessToken);
// 清空刷新token

@ -15,7 +15,7 @@ spring:
active: @profiles.active@
security:
decode:
private-key: MIICWwIBAAKBgHy7lujT2jh9wYypztbDFCJnmtHgSVIRZ2wq44qGz35Cpl+H7bcGAOkIrhoOqmsvlcVzNSQrwYlQK0XDmLsbwWdGrnf+sGQheBrF1AfgsI98LoqfFE420+jDsGnYIwMLiRs0wOPZ9drGhYBWwotHQb4kKt5WMJSK0IbjiR3lGWatAgMBAAECgYAfXYy1P5DAY98n4AuDNcr6W9Mys5O8b2Pyb1aInx3OQjRUEXpVa80OzH/7TXTNP0oKPM5AKkCgpug6wtTFOFWJp1s/oUP6qC/fiCEVhTkBu6NvPPsfq5kLJAswtM+12sM4+4Ip3wfICJllU8wzmC0DfOF9sZCnETsd0h4axZ+2gQJBANgs7hVPq9eKmzdCSjfOpP5CXmI+I/drHwklfd4GAeKSq8WEyl+XXELIRwsfbOivpfcTZ4jr16mwbo/1+aVrQPsCQQCTth8XjQYke4ucemoNEYdANBTeOqDyeVXz25/sMDmqUBn0h5K/r+gjx3JBbFL+IFQrhebY+crEwellCT+H1/Z3AkEAmWUIbEbkgUXxbfyz/XW8zk75+mxtyRtSIoNgFTPeEpBRIw9fKwWUii7jepkKBvLcqb4zMY1os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