前端在发请求的过程中,用到了这个token:
如果使用postman发送GET请求到http://localhost:8080/system/menu/list
若不带有token,则系统不知道你有什么限权
若带有token,则系统会在Redis中查询你的限权
?
{
"msg": "操作成功",
"code": 200,
"data": [
....
]
}
?后端在Redis中 也存储了这个token所对应的权限信息:
?
{
"@type": "com.ruoyi.common.core.domain.model.LoginUser",
"browser": "Firefox 10",
"deptId": 103,
"expireTime": 1656074264849,
"ipaddr": "127.0.0.1",
"loginLocation": "内网IP",
"loginTime": 1656072464849,
"os": "Windows 10",
"permissions": Set[
"*:*:*"
],
"token": "3ce288d6-4c10-4ed6-9399-34123860d084",
"user": {
"admin": true,
"avatar": "",
"createBy": "admin",
"createTime": 1656049805000,
"delFlag": "0",
"dept": {
"ancestors": "0,100,101",
"children": [
],
"deptId": 103,
"deptName": "研发部门",
"leader": "若依",
"orderNum": 1,
"params": {
"@type": "java.util.HashMap"
},
"parentId": 101,
"status": "0"
},
"deptId": 103,
"email": "ry@163.com",
"loginDate": 1656061502000,
"loginIp": "127.0.0.1",
"nickName": "若依",
"params": {
"@type": "java.util.HashMap"
},
"password": "$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2",
"phonenumber": "15888888888",
"remark": "管理员",
"roles": [
{
"admin": true,
"dataScope": "1",
"deptCheckStrictly": false,
"flag": false,
"menuCheckStrictly": false,
"params": {
"@type": "java.util.HashMap"
},
"roleId": 1,
"roleKey": "admin",
"roleName": "超级管理员",
"roleSort": "1",
"status": "0"
}
],
"sex": "1",
"status": "0",
"userId": 1,
"userName": "admin"
},
"userId": 1,
"username": "admin"
}