mirror of
https://github.com/bluenviron/mediamtx
synced 2024-12-25 16:12:19 +00:00
hls muxer: add WWW-Authenticate header in case of external authentication
This commit is contained in:
parent
27fb9fdb7e
commit
1e788f81fd
@ -480,7 +480,7 @@ func (m *hlsMuxer) authenticate(ctx *gin.Context) error {
|
||||
|
||||
if m.externalAuthenticationURL != "" {
|
||||
ip := net.ParseIP(ctx.ClientIP())
|
||||
user, pass, _ := ctx.Request.BasicAuth()
|
||||
user, pass, ok := ctx.Request.BasicAuth()
|
||||
|
||||
err := externalAuth(
|
||||
m.externalAuthenticationURL,
|
||||
@ -491,6 +491,10 @@ func (m *hlsMuxer) authenticate(ctx *gin.Context) error {
|
||||
false,
|
||||
ctx.Request.URL.RawQuery)
|
||||
if err != nil {
|
||||
if !ok {
|
||||
return pathErrAuthNotCritical{}
|
||||
}
|
||||
|
||||
return pathErrAuthCritical{
|
||||
message: fmt.Sprintf("external authentication failed: %s", err),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user