1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-04 08:54:39 +00:00

Add check Authorization header (#686)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2024-08-29 15:28:41 +08:00
committed by GitHub
parent 6944257cc8
commit b5b37e69e0
5 changed files with 56 additions and 4 deletions

View File

@@ -1166,8 +1166,11 @@ func checkPermission(repoID, user, op string, skipCache bool) *appError {
func validateToken(r *http.Request, repoID string, skipCache bool) (string, *appError) {
token := r.Header.Get("Seafile-Repo-Token")
if token == "" {
msg := "token is null"
return "", &appError{nil, msg, http.StatusBadRequest}
token = utils.GetAuthorizationToken(r.Header)
if token == "" {
msg := "token is null"
return "", &appError{nil, msg, http.StatusBadRequest}
}
}
if value, ok := tokenCache.Load(token); ok {