rtsp: rewrite authentication around ServerConn.VerifyCredentials (#4267)
Some checks failed
code_lint / golangci_lint (push) Has been cancelled
code_lint / mod_tidy (push) Has been cancelled
code_lint / api_docs (push) Has been cancelled
code_test / test_64 (push) Has been cancelled
code_test / test_32 (push) Has been cancelled
code_test / test_highlevel (push) Has been cancelled

This commit is contained in:
Alessandro Ros 2025-02-18 17:54:13 +01:00 committed by GitHub
parent 7ade2896e5
commit 386be42784
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 165 additions and 218 deletions

View file

@ -294,7 +294,7 @@ func (a *API) middlewareAuth(ctx *gin.Context) {
err := a.AuthManager.Authenticate(req)
if err != nil {
if err.(*auth.Error).AskCredentials { //nolint:errorlint
if err.(auth.Error).AskCredentials { //nolint:errorlint
ctx.Header("WWW-Authenticate", `Basic realm="mediamtx"`)
ctx.AbortWithStatus(http.StatusUnauthorized)
return