Send additional fields to the external authentication URL (#1408)

* send 'protocol' to the external authentication URL

* send session ID to the external authentication URL
This commit is contained in:
Alessandro Ros
2023-01-22 19:48:33 +01:00
committed by GitHub
parent ef214b7649
commit b02d3b83c7
10 changed files with 53 additions and 20 deletions

View File

@@ -5,6 +5,17 @@ import (
"encoding/json"
"fmt"
"net/http"
"github.com/google/uuid"
)
type externalAuthProto string
const (
externalAuthProtoRTSP externalAuthProto = "rtsp"
externalAuthProtoRTMP externalAuthProto = "rtmp"
externalAuthProtoHLS externalAuthProto = "hls"
externalAuthProtoWebRTC externalAuthProto = "webrtc"
)
func externalAuth(
@@ -13,23 +24,28 @@ func externalAuth(
user string,
password string,
path string,
isPublishing bool,
protocol externalAuthProto,
id *uuid.UUID,
publish bool,
query string,
) error {
enc, _ := json.Marshal(struct {
IP string `json:"ip"`
User string `json:"user"`
Password string `json:"password"`
Path string `json:"path"`
Action string `json:"action"`
Query string `json:"query"`
IP string `json:"ip"`
User string `json:"user"`
Password string `json:"password"`
Path string `json:"path"`
Protocol string `json:"protocol"`
ID *uuid.UUID `json:"id"`
Action string `json:"action"`
Query string `json:"query"`
}{
IP: ip,
User: user,
Password: password,
Path: path,
Protocol: string(protocol),
Action: func() string {
if isPublishing {
if publish {
return "publish"
}
return "read"