added pkg/filecli/

This commit is contained in:
2026-03-02 11:05:29 +02:00
parent 4f7bc221cf
commit 957e655694
8 changed files with 409 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
package filecli
import (
"encoding/base64"
)
type Authenticator interface {
MakeHeader(user, pass string) (key, value string, err error)
}
type BasicAuthenticator struct{}
func NewBasicAuthenticator() *BasicAuthenticator {
return &BasicAuthenticator{}
}
func (auth *BasicAuthenticator) MakeHeader(user, pass string) (string, string, error) {
pair := base64.StdEncoding.EncodeToString([]byte(user + ":" + pass))
return "Authorization", "Basic " + pair, nil
}