|
@@ -60,9 +60,24 @@ public class TokenUtil {
|
|
|
* @return
|
|
|
* @throws MzException
|
|
|
*/
|
|
|
- public static User getUser(HttpServletRequest httpServletRequest){
|
|
|
+ public static User getUser(HttpServletRequest httpServletRequest) throws MzException {
|
|
|
String token = TokenUtil.getToken(httpServletRequest);
|
|
|
- AssertUtil.isNotBlank(token,"业务处理失败,用户Token不存在");
|
|
|
+ if(StringUtils.isBlank(token)){
|
|
|
+ throw new MzException("业务处理失败,用户token不存在");
|
|
|
+ }
|
|
|
+ DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
|
|
|
+ return (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @description:获取用户 新
|
|
|
+ * @author: lihong
|
|
|
+ * @date: 2023/8/15 15:40
|
|
|
+ * @param: httpServletRequest
|
|
|
+ * @return: cn.hnthyy.thmz.entity.thmz.User
|
|
|
+ **/
|
|
|
+ public static User getNewUser(HttpServletRequest httpServletRequest){
|
|
|
+ String token = TokenUtil.getToken(httpServletRequest);
|
|
|
+ AssertUtil.isNotBlank(token,"业务处理失败,用户token不存在");
|
|
|
DecodedJWT decodedJWT = TokenUtil.parseJWT(token);
|
|
|
return (User) JsonUtil.jsontoObject(decodedJWT.getSubject(), User.class);
|
|
|
}
|