mirror of
https://github.com/bluenviron/mediamtx.git
synced 2026-01-09 11:52:02 -08:00
This commit is contained in:
parent
5077fb2238
commit
8f04264fe5
27 changed files with 563 additions and 421 deletions
|
|
@ -286,11 +286,13 @@ func (a *API) middlewareOrigin(ctx *gin.Context) {
|
|||
}
|
||||
|
||||
func (a *API) middlewareAuth(ctx *gin.Context) {
|
||||
err := a.AuthManager.Authenticate(&auth.Request{
|
||||
IP: net.ParseIP(ctx.ClientIP()),
|
||||
Action: conf.AuthActionAPI,
|
||||
HTTPRequest: ctx.Request,
|
||||
})
|
||||
req := &auth.Request{
|
||||
IP: net.ParseIP(ctx.ClientIP()),
|
||||
Action: conf.AuthActionAPI,
|
||||
}
|
||||
req.FillFromHTTPRequest(ctx.Request)
|
||||
|
||||
err := a.AuthManager.Authenticate(req)
|
||||
if err != nil {
|
||||
if err.(*auth.Error).AskCredentials { //nolint:errorlint
|
||||
ctx.Header("WWW-Authenticate", `Basic realm="mediamtx"`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue