aboutsummaryrefslogtreecommitdiff
path: root/roomserver/inthttp
diff options
context:
space:
mode:
Diffstat (limited to 'roomserver/inthttp')
-rw-r--r--roomserver/inthttp/client.go11
-rw-r--r--roomserver/inthttp/server.go13
2 files changed, 24 insertions, 0 deletions
diff --git a/roomserver/inthttp/client.go b/roomserver/inthttp/client.go
index e496b81e..8a1c91d2 100644
--- a/roomserver/inthttp/client.go
+++ b/roomserver/inthttp/client.go
@@ -54,6 +54,7 @@ const (
RoomserverQuerySharedUsersPath = "/roomserver/querySharedUsers"
RoomserverQueryKnownUsersPath = "/roomserver/queryKnownUsers"
RoomserverQueryServerBannedFromRoomPath = "/roomserver/queryServerBannedFromRoom"
+ RoomserverQueryAuthChainPath = "/roomserver/queryAuthChain"
)
type httpRoomserverInternalAPI struct {
@@ -502,6 +503,16 @@ func (h *httpRoomserverInternalAPI) QueryKnownUsers(
return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
}
+func (h *httpRoomserverInternalAPI) QueryAuthChain(
+ ctx context.Context, req *api.QueryAuthChainRequest, res *api.QueryAuthChainResponse,
+) error {
+ span, ctx := opentracing.StartSpanFromContext(ctx, "QueryAuthChain")
+ defer span.Finish()
+
+ apiURL := h.roomserverURL + RoomserverQueryAuthChainPath
+ return httputil.PostJSON(ctx, span, h.httpClient, apiURL, req, res)
+}
+
func (h *httpRoomserverInternalAPI) QueryServerBannedFromRoom(
ctx context.Context, req *api.QueryServerBannedFromRoomRequest, res *api.QueryServerBannedFromRoomResponse,
) error {
diff --git a/roomserver/inthttp/server.go b/roomserver/inthttp/server.go
index ac1fc25b..f9c8ef9f 100644
--- a/roomserver/inthttp/server.go
+++ b/roomserver/inthttp/server.go
@@ -452,4 +452,17 @@ func AddRoutes(r api.RoomserverInternalAPI, internalAPIMux *mux.Router) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
+ internalAPIMux.Handle(RoomserverQueryAuthChainPath,
+ httputil.MakeInternalAPI("queryAuthChain", func(req *http.Request) util.JSONResponse {
+ request := api.QueryAuthChainRequest{}
+ response := api.QueryAuthChainResponse{}
+ if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
+ return util.MessageResponse(http.StatusBadRequest, err.Error())
+ }
+ if err := r.QueryAuthChain(req.Context(), &request, &response); err != nil {
+ return util.ErrorResponse(err)
+ }
+ return util.JSONResponse{Code: http.StatusOK, JSON: &response}
+ }),
+ )
}