working commit

This commit is contained in:
2026-02-26 18:15:10 +02:00
commit 19b173357a
9 changed files with 328 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package client
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 "Autentification", "Basic " + pair, nil
}