remove mirror.SetTokenFromAuthorizationHeader

This commit is contained in:
limiting-factor 2026-05-25 11:12:02 +02:00
parent 4e19e6c84e
commit 38be4ed5a9
No known key found for this signature in database
GPG key ID: FBFC3FECD17D904F

View file

@ -8,7 +8,6 @@ import (
"errors"
"fmt"
"path/filepath"
"slices"
"strings"
"time"
@ -45,15 +44,6 @@ func (o Mirror) GetID() int64 {
return o.ID
}
func (o *Mirror) SetTokenFromAuthorizationHeader(authorizationHeader string) error {
auths := strings.SplitN(authorizationHeader, " ", 2)
if len(auths) < 1 || !slices.Contains([]string{"bearer", "token"}, strings.ToLower(auths[0])) {
return fmt.Errorf("Authorization header empty or not starting with 'bearer' or 'token'")
}
o.SetToken(auths[1])
return nil
}
func (o *Mirror) SetToken(token string) {
o.Token = []byte(token)
}