From 4af4a47ffd926b885df3f1ebfb949a7f7fe61b0b Mon Sep 17 00:00:00 2001 From: Christian Loelkes Date: Sun, 27 Dec 2020 12:56:18 +0100 Subject: [PATCH] fix incorrect OCS response from auth backend For compliance with the OCS standard, the OCS response structure MUST be {ocs: {meta:{...}, data: {...}}}. Until now the temporary auth backend from the client only responded with the data and triggered an 'Incomplete OCS response' from the signaling server. --- src/client/main.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/client/main.go b/src/client/main.go index f774bd1..e1c821d 100644 --- a/src/client/main.go +++ b/src/client/main.go @@ -456,9 +456,22 @@ func registerAuthHandler(router *mux.Router) { return } + rawdata := json.RawMessage(data) + payload := &signaling.OcsResponse{ + Ocs: &signaling.OcsBody{ + Data: &rawdata, + }, + } + + jsonpayload, err := payload.MarshalJSON() + if err != nil { + log.Println(err) + return + } + w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) - w.Write(data) + w.Write(jsonpayload) }) }