Testing auth UNDO BEFORE DEPLOY

This commit is contained in:
Asaf Gartner 2021-09-24 03:29:47 +03:00
parent a3e7e2afc0
commit ed85d11d96
1 changed files with 3 additions and 0 deletions

View File

@ -40,6 +40,9 @@ func AdminAtomFeed(c *RequestContext) ResponseData {
creds := fmt.Sprintf("%s:%s", config.Config.Admin.AtomUsername, config.Config.Admin.AtomPassword)
expectedAuth := fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte(creds)))
auth, hasAuth := c.Req.Header["Authorization"]
if hasAuth {
c.Logger.Warn().Str("auth", auth[0]).Msg("Got auth")
}
if !hasAuth || auth[0] != expectedAuth {
return FourOhFour(c)
}