[AppleScript] 纯文本查看 复制代码
......
//请求ucenter查询用户
XcUserExt userext = userClient.getUserext(username);
if(userext == null){
//返回NULL表示用户不存在,Spring Security会抛出异常
return null;
}
//从数据库查询用户正确的密码,Spring Security会去比对输入密码的正确性
String password = userext.getPassword();
//指定用户的权限,这里暂时硬编码
List<String> permissionList = new ArrayList<>(); //
permissionList.add("course_get_baseinfo"); //
permissionList.add("course_find_pic");
//取出用户权限
List<XcMenu> permissions = userext.getPermissions();
for(XcMenu xcMenu:permissions){
permissionList.add(xcMenu.getCode());
}
......
[AppleScript] 纯文本查看 复制代码
#前端教学管理 upstream teacher_server_pool{ server 127.0.0.1:12000 weight=10;
} #文件服务 upstream filesystem_server_pool{ server 127.0.0.1:22100 weight=10;
} #媒资服务 upstream media_server_pool{ server 127.0.0.1:31400 weight=10;
} #学成网教学管理中心 server { listen
80;
server_name teacher.xuecheng.com;
#个人中心
location / {
proxy_pass http://teacher_server_pool;
}
location /api {
proxy_pass http://api_server_pool;
}
location /filesystem {
proxy_pass http://filesystem_server_pool;
}
#媒资管理
location ^~ /api/media/ {
proxy_pass http://media_server_pool/media/;
}
#认证
location ^~ /openapi/auth/ {
proxy_pass http://auth_server_pool/auth/;
}
}
4.2.2身份校验 [AppleScript] 纯文本查看 复制代码
router.beforeEach((to, from, next) => { if(openAuthenticate){
// console.log(to)
// console.log(from)
//***********身份校验***************
let activeUser
let uid
try{
activeUser = utilApi.getActiveUser()
uid = utilApi.getCookie("uid")
}catch(e){
//alert(e)
}
if(activeUser && uid && uid == activeUser.uid) {
next();
}else if(to.path =='/login' || to.path =='/logout'){
next();
}else if(uid){
//请求获取jwt
systemApi.getjwt().then((res)=>{
if(res.success){
let jwt = res.jwt;
let activeUser = utilApi.getUserInfoFromJwt(jwt)
if(activeUser){
utilApi.setUserSession("activeUser",JSON.stringify(activeUser))
}
next();
}else{
//跳转到统一登陆
window.location = "http://ucenter.xuecheng.com/#/login?returnUrl="+ Base64.encode(window.location)
}
})
}else{
//跳转到统一登陆
window.location = "http://ucenter.xuecheng.com/#/login?returnUrl="+ Base64.encode(window.location)
}
}else{
next();
}
});