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:
@@ -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 {
|
||||
|
Reference in New Issue
Block a user