cashless2ecash

cashless2ecash: pay with cards for digital cash (experimental)
Log | Files | Refs | README

commit 21db2652cd932e45f2f04281fc6102b8db430192
parent 08b392ba680f36b28584b5b55de265a12bcc9778
Author: Joel-Haeberli <haebu@rubigen.ch>
Date:   Wed, 29 May 2024 17:29:06 +0200

fix: wire gateway auth config

Diffstat:
Mc2ec/api-auth.go | 19+------------------
Mc2ec/config.go | 4++--
2 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/c2ec/api-auth.go b/c2ec/api-auth.go @@ -113,24 +113,7 @@ func AuthenticateWirewatcher(req *http.Request) bool { return true } } else { - LogWarn("auth", "basic auth prefix was not set! optimistically matching credentials") - decoded, err := base64.StdEncoding.DecodeString(basicAuth) - if err != nil { - LogWarn("auth", "failed decoding basic auth header from base64") - return false - } - - username, password, err := parseBasicAuth(string(decoded)) - if err != nil { - LogWarn("auth", "failed parsing username password from basic auth") - return false - } - - if strings.EqualFold(username, CONFIG.Server.WireGateway.Username) && - strings.EqualFold(password, CONFIG.Server.WireGateway.Password) { - - return true - } + LogWarn("auth", "expecting exact 'Basic' prefix!") } LogWarn("auth", "basic auth prefix did not match") return false diff --git a/c2ec/config.go b/c2ec/config.go @@ -218,13 +218,13 @@ func ParseIni(content []byte) (*C2ECConfig, error) { if err != nil { return nil, err } - cfg.Server.CreditAccount = value.String() + cfg.Server.WireGateway.Username = value.String() value, err = s.GetKey("PASSWORD") if err != nil { return nil, err } - cfg.Server.CreditAccount = value.String() + cfg.Server.WireGateway.Password = value.String() } if s.Name() == "database" {