mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 11:41:44 +08:00
cookie过期时间为0时仅限本次访问鉴权
This commit is contained in:
@@ -388,12 +388,16 @@ inline void HttpSession::canAccessPath(const string &path_in,bool is_dir,const f
|
||||
//自己已经销毁
|
||||
return;
|
||||
}
|
||||
//我们给用户生成追踪cookie
|
||||
auto cookie = CookieManager::Instance().addCookie(uid, kMaxClientPerUid, cookieLifeSecond);
|
||||
//记录用户能访问的路径
|
||||
(*cookie)[kAccessPathKey] = accessPath;
|
||||
//判断该用户是否有权限访问该目录,并且设置客户端cookie
|
||||
callback(!accessPath.empty() && path.find(accessPath) == 0, cookie);
|
||||
if(cookieLifeSecond){
|
||||
//我们给用户生成追踪cookie
|
||||
auto cookie = CookieManager::Instance().addCookie(uid, kMaxClientPerUid, cookieLifeSecond);
|
||||
//记录用户能访问的路径
|
||||
(*cookie)[kAccessPathKey] = accessPath;
|
||||
//判断该用户是否有权限访问该目录,并且设置客户端cookie
|
||||
callback(!accessPath.empty() && path.find(accessPath) == 0, cookie);
|
||||
}else{
|
||||
callback(!accessPath.empty() && path.find(accessPath) == 0, nullptr);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user