[#13] Add bearer token usage in receive/upload methods

This commit is contained in:
Pavel Korotkov 2021-02-16 18:20:15 +03:00 committed by pkorotkov
parent e45e5ed6f9
commit 237c247ec4
5 changed files with 65 additions and 18 deletions

View file

@ -44,6 +44,12 @@ func (a *app) upload(c *fasthttp.RequestCtx) {
log = a.log.With(zap.String("cid", sCID))
)
if err = checkAndPropagateBearerToken(c); err != nil {
log.Error("could not fetch bearer token", zap.Error(err))
c.Error("could not fetch bearer token", fasthttp.StatusBadRequest)
return
}
if err = cid.Parse(sCID); err != nil {
log.Error("wrong container id", zap.Error(err))
c.Error("wrong container id", fasthttp.StatusBadRequest)