Skip to content

Commit 4b85728

Browse files
committed
refactor: add authpublish to http stream
Signed-off-by: Felix Gateru <[email protected]>
1 parent edf967f commit 4b85728

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/http/http.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ func (p Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
105105
p.logger.Error("Failed to authorize connect", slog.Any("error", err))
106106
return
107107
}
108+
if err := p.session.AuthPublish(ctx, &r.RequestURI, &payload); err != nil {
109+
encodeError(w, http.StatusForbidden, err)
110+
p.logger.Error("Failed to authorize publish", slog.Any("error", err))
111+
return
112+
}
108113
if err := p.session.Publish(ctx, &r.RequestURI, &payload); err != nil {
109114
encodeError(w, http.StatusBadRequest, err)
110115
p.logger.Error("Failed to publish", slog.Any("error", err))

0 commit comments

Comments
 (0)