第五修改
parent
afe4128893
commit
0856e6a335
|
@ -1,5 +1,6 @@
|
||||||
package com.bwie.service.impl;
|
package com.bwie.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.nacos.common.utils.UuidUtils;
|
import com.alibaba.nacos.common.utils.UuidUtils;
|
||||||
import com.bwie.common.constants.JwtConstants;
|
import com.bwie.common.constants.JwtConstants;
|
||||||
import com.bwie.common.constants.TokenConstants;
|
import com.bwie.common.constants.TokenConstants;
|
||||||
|
@ -130,7 +131,11 @@ public class AuthServicelmpl implements AuthService{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result info() {
|
public Result info() {
|
||||||
return null;
|
String token = request.getHeader(TokenConstants.TOKEN);
|
||||||
|
String userKey = JwtUtils.getUserKey(token);
|
||||||
|
String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
|
||||||
|
User user = JSON.parseObject(s, User.class);
|
||||||
|
return Result.success(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,7 +146,7 @@ public class AuthServicelmpl implements AuthService{
|
||||||
String userKey = UuidUtils.generateUuid().replaceAll("-", "");
|
String userKey = UuidUtils.generateUuid().replaceAll("-", "");
|
||||||
map.put(JwtConstants.USER_KEY,userKey);
|
map.put(JwtConstants.USER_KEY,userKey);
|
||||||
String token = JwtUtils.createToken(map);
|
String token = JwtUtils.createToken(map);
|
||||||
redisTemplate.opsForValue().set(TokenConstants.LOGIN_TOKEN_KEY+userKey,token,15, TimeUnit.MINUTES);
|
redisTemplate.opsForValue().set(TokenConstants.LOGIN_TOKEN_KEY+userKey, JSON.toJSONString(user),15, TimeUnit.MINUTES);
|
||||||
return new JwtRequest(token);
|
return new JwtRequest(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue