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.
This commit is contained in:
Christian Loelkes 2020-12-27 12:56:18 +01:00
parent f894837cd1
commit 4af4a47ffd

View file

@ -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)
})
}