|
|
|
@ -4,6 +4,7 @@ import cn.chjyj.szwh.bean.User; |
|
|
|
import cn.chjyj.szwh.controller.BaseController; |
|
|
|
import cn.chjyj.szwh.service.LoginService; |
|
|
|
import cn.chjyj.szwh.service.UserService; |
|
|
|
import cn.chjyj.szwh.utils.SignUtils; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.auth0.jwt.JWT; |
|
|
|
import com.auth0.jwt.interfaces.Claim; |
|
|
|
@ -77,21 +78,32 @@ public class AdminUserController extends BaseController { |
|
|
|
String token = request.getHeader("token"); |
|
|
|
String murl= request.getHeader("url"); |
|
|
|
|
|
|
|
List retlist = new ArrayList(); |
|
|
|
Map retmap = new HashMap(); |
|
|
|
//解析token中到信息
|
|
|
|
DecodedJWT decode = JWT.decode(token); |
|
|
|
//获取claim信息
|
|
|
|
Map<String,Claim> pcmap = decode.getClaims(); |
|
|
|
retlist.add(pcmap); |
|
|
|
String accountid = decode.getClaim("accountId").asString(); |
|
|
|
String accountId = decode.getClaim("accountId").asString(); |
|
|
|
retmap.put("accountId",accountId); |
|
|
|
String accountName = decode.getClaim("accountName").asString(); |
|
|
|
retmap.put("accountName",accountName); |
|
|
|
String aud = decode.getClaim("aud").asString(); |
|
|
|
retmap.put("aud",aud); |
|
|
|
Long iat= decode.getClaim("iat").asLong(); |
|
|
|
retmap.put("iat",iat); |
|
|
|
String jti =decode.getClaim("jti").asString(); |
|
|
|
retmap.put("jti",jti); |
|
|
|
//权限列表
|
|
|
|
String[] menuPermission= decode.getClaim("menuPermission").asArray(String.class); |
|
|
|
retmap.put("menuPermission",menuPermission); |
|
|
|
|
|
|
|
|
|
|
|
// 用户权限
|
|
|
|
Map auth = loginService.checkUser(accountid,murl,token); |
|
|
|
Map retmap = new HashMap(); |
|
|
|
Map auth = loginService.checkUser(accountId,murl,token); |
|
|
|
retmap.put("auth",auth.get("data")); |
|
|
|
retlist.add(retmap); |
|
|
|
//for deubug
|
|
|
|
//retmap.put("auth","adminauth");
|
|
|
|
|
|
|
|
jsonObject.put("code",200); |
|
|
|
jsonObject.put("data",retlist); |
|
|
|
jsonObject.put("data",retmap); |
|
|
|
jsonObject.put("msg","成功"); |
|
|
|
return jsonObject; |
|
|
|
} |
|
|
|
|