Initial implementation of auth conflict resolution

This commit is contained in:
Erik Johnston 2015-01-29 16:50:23 +00:00
parent 5a3a15f5c1
commit 78015948a7
8 changed files with 211 additions and 82 deletions

View file

@ -42,7 +42,7 @@ class TransportLayerServer(object):
content = None
origin = None
if request.method == "PUT":
if request.method in ["PUT", "POST"]:
# TODO: Handle other method types? other content types?
try:
content_bytes = request.content.read()
@ -234,6 +234,16 @@ class TransportLayerServer(object):
)
)
)
self.server.register_path(
"POST",
re.compile("^" + PREFIX + "/query_auth/([^/]*)/([^/]*)$"),
self._with_authentication(
lambda origin, content, query, context, event_id:
self._on_query_auth_request(
origin, content, event_id,
)
)
)
@defer.inlineCallbacks
@log_function
@ -325,3 +335,12 @@ class TransportLayerServer(object):
)
defer.returnValue((200, content))
@defer.inlineCallbacks
@log_function
def _on_query_auth_request(self, origin, content, event_id):
new_content = yield self.request_handler.on_query_auth_request(
origin, content, event_id
)
defer.returnValue((200, new_content))