mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-06-03 22:42:05 -04:00
remove mirror.SetTokenFromAuthorizationHeader
This commit is contained in:
parent
4e19e6c84e
commit
38be4ed5a9
1 changed files with 0 additions and 10 deletions
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue