| | |
| | | |
| | | protected static final long MILLIS_MINUTE = 60 * MILLIS_SECOND; |
| | | |
| | | private final static long expireTime = CacheConstants.EXPIRATION; |
| | | private final static long EXPIRE_TIME = CacheConstants.EXPIRATION; |
| | | |
| | | private final static String ACCESS_TOKEN = CacheConstants.LOGIN_TOKEN_KEY; |
| | | |
| | |
| | | // 接口返回信息 |
| | | Map<String, Object> rspMap = new HashMap<String, Object>(); |
| | | rspMap.put("access_token", JwtUtils.createToken(claimsMap)); |
| | | rspMap.put("expires_in", expireTime); |
| | | rspMap.put("expires_in", EXPIRE_TIME); |
| | | return rspMap; |
| | | } |
| | | |
| | |
| | | claimsMap.put(SecurityConstants.DETAILS_USERNAME, userName); |
| | | claimsMap.put(SecurityConstants.LOGIN_FROM, Constants.FROM_MINI_APP); |
| | | rspMap.put("access_token", JwtUtils.createToken(claimsMap)); |
| | | rspMap.put("expires_in", expireTime); |
| | | rspMap.put("expires_in", EXPIRE_TIME); |
| | | } |
| | | if(StringUtils.isNotBlank(appMiniLoginVo.getMobile())){ |
| | | rspMap.put("mobile",appMiniLoginVo.getMobile() ); |
| | |
| | | OauthUserVo oauthUserVo = new OauthUserVo(); |
| | | oauthUserVo.setShopId(qwH5LoginVo.getShopId()); |
| | | oauthUserVo.setToken(JwtUtils.createToken(claimsMap)); |
| | | oauthUserVo.setExpiresIn(expireTime); |
| | | oauthUserVo.setExpiresIn(EXPIRE_TIME); |
| | | oauthUserVo.setUserid(qwH5LoginVo.getUserid()); |
| | | oauthUserVo.setMobile(qwH5LoginVo.getMobile()); |
| | | return oauthUserVo; |
| | |
| | | public void refreshToken(LoginUser loginUser) |
| | | { |
| | | loginUser.setLoginTime(System.currentTimeMillis()); |
| | | loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE); |
| | | loginUser.setExpireTime(loginUser.getLoginTime() + EXPIRE_TIME * MILLIS_MINUTE); |
| | | // 根据uuid将loginUser缓存 |
| | | String userKey = getTokenKey(loginUser.getToken()); |
| | | redisService.setCacheObject(userKey, loginUser, expireTime, TimeUnit.MINUTES); |
| | | redisService.setCacheObject(userKey, loginUser, EXPIRE_TIME, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | private String getTokenKey(String token) |