Skip to content

Commit

Permalink
hls muxer: add WWW-Authenticate header in case of external authentica…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
aler9 committed Aug 27, 2022
1 parent 27fb9fd commit 1e788f8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/core/hls_muxer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
}
Expand Down

0 comments on commit 1e788f8

Please sign in to comment.