Commit b3625949 authored by 赵啸非's avatar 赵啸非

修改token鉴权方式

parent 4f1d740e
Pipeline #1367 failed with stages
...@@ -45,12 +45,13 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -45,12 +45,13 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (!auth) { if (!auth) {
//不存在时候 如果是管理员也不做拦截 //不存在时候 如果是管理员也不做拦截
IUser loginUser = authTokenService.getLoginUser(request); IUser loginUser = authTokenService.getLoginUser(request);
//loginUser.isManager()
if(ObjectUtils.isEmpty(loginUser)){ if(ObjectUtils.isEmpty(loginUser)){
ret.put("code", -1); ret.put("code", -1);
ret.put("msg", "用户未登录或登录失效,请重新登录"); ret.put("msg", "用户未登录或登录失效,请重新登录");
ServletUtils.renderString(response, JSONObject.toJSONString(ret)); ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false; return false;
}else if(loginUser.isAdmin()){ }else if(loginUser.isAdmin()||loginUser.getUserType()==1){
return super.preHandle(request, response, handler); return super.preHandle(request, response, handler);
} else { } else {
ret.put("code", -1); ret.put("code", -1);
...@@ -84,4 +85,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -84,4 +85,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
} }
return false; return false;
} }
} }
...@@ -90,14 +90,14 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -90,14 +90,14 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
recordSysLog(request, userEntity, "用户登录系统成功!"); recordSysLog(request, userEntity, "用户登录系统成功!");
// 返回拥有的菜单数据 // 返回拥有的菜单数据
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId()); Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
// List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls); List<MenuEntity> outlookBarList = menuService.findTreeMenu(userEntity, urls);
String currUserName = userEntity.getRealName(); String currUserName = userEntity.getRealName();
if (currUserName == null || currUserName.trim().length() == 0) { if (currUserName == null || currUserName.trim().length() == 0) {
currUserName = "管理员"; currUserName = "管理员";
} }
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("currUserName", currUserName); data.put("currUserName", currUserName);
// data.put("barList", outlookBarList); data.put("barList", outlookBarList);
data.put("id", userEntity.getId()); data.put("id", userEntity.getId());
data.put("userType", userEntity.getUserType()); data.put("userType", userEntity.getUserType());
userEntity.setLoginTime(System.currentTimeMillis()); userEntity.setLoginTime(System.currentTimeMillis());
...@@ -107,11 +107,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -107,11 +107,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
String token = authTokenService.createToken(userEntity); String token = authTokenService.createToken(userEntity);
data.put("token", token); data.put("token", token);
//设置token 和过期时间 //设置token 和过期时间
// CookieInfo loginCookie = CookieService.getLoginCookie(request);
// if(!ObjectUtils.isEmpty(loginCookie)){
//
// }
// data.put("token", UUID.fastUUID().toString());
data.put("expiresTime", DateUtils.addCurrDate(7).getTime()); data.put("expiresTime", DateUtils.addCurrDate(7).getTime());
generateMenuUrlCode(urls); generateMenuUrlCode(urls);
//this.generateBlackCookie(request, response, loginName, urls); //this.generateBlackCookie(request, response, loginName, urls);
......
...@@ -62,7 +62,6 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService, ...@@ -62,7 +62,6 @@ public class ParamController extends BaseCRUDJsonMappingController<ParamService,
return result; return result;
} }
public static void main(String[] args) { public static void main(String[] args) {
FileUtil.delete("E:\\pic\\1.png"); FileUtil.delete("E:\\pic\\1.png");
} }
......
...@@ -67,6 +67,26 @@ ...@@ -67,6 +67,26 @@
<profiles.data.path>/data</profiles.data.path> <profiles.data.path>/data</profiles.data.path>
</properties> </properties>
</profile> </profile>
<profile>
<id>test-node</id>
<properties>
<profiles.active>test-node</profiles.active>
<profiles.server.port>17212</profiles.server.port>
<profiles.datasource.uri>
<![CDATA[jdbc:p6spy:mysql://192.168.0.98:3306/base-platform?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Hongkong]]></profiles.datasource.uri>
<profiles.datasource.username>root</profiles.datasource.username>
<profiles.datasource.password>nacos@2020</profiles.datasource.password>
<profiles.redis.uri>192.168.0.252</profiles.redis.uri>
<profiles.redis.port>6379</profiles.redis.port>
<profiles.redis.username></profiles.redis.username>
<profiles.redis.password>hotel@2020</profiles.redis.password>
<profiles.redis.database>4</profiles.redis.database>
<profiles.filepath>/mortals/app/data</profiles.filepath>
<profiles.log.level>INFO</profiles.log.level>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<profiles.data.path>/data</profiles.data.path>
</properties>
</profile>
<profile> <profile>
<id>product</id> <id>product</id>
<properties> <properties>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment