Open
Description
cas client与server验证
建议使用jwt作为验证数据的方式
server 生成jwt后重定向到client 并携带token
client 接收到token后 储存到localstore 或者保存到cookie
server 获取并验证token
跨域设置(已废弃)
1.后端跨域设置
{
credentials: true,
origin: 'http://10.235.171.233:4445'
其他参数自行:google
}
2.前端跨域设置
export async function getDeviceProfile(v) {
return axios({
url: 'http://10.235.171.233:9000/api/profile/bi/detail/'+v,
method: 'get',
withCredentials: true, //携带cookie 以便验证用户
});
}
jwt失效后后重新登陆的问题
server:验证cookie(jwt)失效或者没有登陆后,返回: 401 msg:faild
client:axios请求封装,请求异常统一处理 如果返回status code是401 则前端跳转到 cas登陆页面,如:
https://cas.test.cn/login?service=http://api.test.com/login?from=http://www.test.com
备注:
测试时,api.test.com www.test.com 请换陈自己前后端服务的完整url
相关文档
Metadata
Metadata
Assignees
Labels
No labels