|
@@ -29,6 +29,7 @@ from sydent.http.servlets.authenticated_bind_threepid_servlet import (
|
|
from sydent.http.servlets.authenticated_unbind_threepid_servlet import (
|
|
from sydent.http.servlets.authenticated_unbind_threepid_servlet import (
|
|
AuthenticatedUnbindThreePidServlet,
|
|
AuthenticatedUnbindThreePidServlet,
|
|
)
|
|
)
|
|
|
|
+from sydent.http.httpcommon import SizeLimitingRequest
|
|
|
|
|
|
logger = logging.getLogger(__name__)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@@ -45,26 +46,17 @@ class ClientApiHttpServer:
|
|
v2 = self.sydent.servlets.v2
|
|
v2 = self.sydent.servlets.v2
|
|
|
|
|
|
validate = Resource()
|
|
validate = Resource()
|
|
|
|
+ validate_v2 = Resource()
|
|
email = Resource()
|
|
email = Resource()
|
|
|
|
+ email_v2 = Resource()
|
|
msisdn = Resource()
|
|
msisdn = Resource()
|
|
- emailReqCode = self.sydent.servlets.emailRequestCode
|
|
|
|
- emailValCode = self.sydent.servlets.emailValidate
|
|
|
|
- msisdnReqCode = self.sydent.servlets.msisdnRequestCode
|
|
|
|
- msisdnValCode = self.sydent.servlets.msisdnValidate
|
|
|
|
- getValidated3pid = self.sydent.servlets.getValidated3pid
|
|
|
|
-
|
|
|
|
- lookup = self.sydent.servlets.lookup
|
|
|
|
- bulk_lookup = self.sydent.servlets.bulk_lookup
|
|
|
|
|
|
+ msisdn_v2 = Resource()
|
|
|
|
|
|
info = self.sydent.servlets.info
|
|
info = self.sydent.servlets.info
|
|
internalInfo = self.sydent.servlets.internalInfo
|
|
internalInfo = self.sydent.servlets.internalInfo
|
|
|
|
|
|
- hash_details = self.sydent.servlets.hash_details
|
|
|
|
- lookup_v2 = self.sydent.servlets.lookup_v2
|
|
|
|
-
|
|
|
|
threepid_v1 = Resource()
|
|
threepid_v1 = Resource()
|
|
threepid_v2 = Resource()
|
|
threepid_v2 = Resource()
|
|
- bind = self.sydent.servlets.threepidBind
|
|
|
|
unbind = self.sydent.servlets.threepidUnbind
|
|
unbind = self.sydent.servlets.threepidUnbind
|
|
|
|
|
|
pubkey = Resource()
|
|
pubkey = Resource()
|
|
@@ -72,8 +64,6 @@ class ClientApiHttpServer:
|
|
|
|
|
|
userDirectory = Resource()
|
|
userDirectory = Resource()
|
|
|
|
|
|
- pk_ed25519 = self.sydent.servlets.pubkey_ed25519
|
|
|
|
-
|
|
|
|
root.putChild(b'_matrix', matrix)
|
|
root.putChild(b'_matrix', matrix)
|
|
matrix.putChild(b'identity', identity)
|
|
matrix.putChild(b'identity', identity)
|
|
identity.putChild(b'api', api)
|
|
identity.putChild(b'api', api)
|
|
@@ -83,36 +73,45 @@ class ClientApiHttpServer:
|
|
validate.putChild(b'email', email)
|
|
validate.putChild(b'email', email)
|
|
validate.putChild(b'msisdn', msisdn)
|
|
validate.putChild(b'msisdn', msisdn)
|
|
|
|
|
|
|
|
+ validate_v2.putChild(b'email', email_v2)
|
|
|
|
+ validate_v2.putChild(b'msisdn', msisdn_v2)
|
|
|
|
+
|
|
v1.putChild(b'validate', validate)
|
|
v1.putChild(b'validate', validate)
|
|
|
|
|
|
- v1.putChild(b'lookup', lookup)
|
|
|
|
- v1.putChild(b'bulk_lookup', bulk_lookup)
|
|
|
|
|
|
+ v1.putChild(b'lookup', self.sydent.servlets.lookup)
|
|
|
|
+ v1.putChild(b'bulk_lookup', self.sydent.servlets.bulk_lookup)
|
|
|
|
|
|
v1.putChild(b'pubkey', pubkey)
|
|
v1.putChild(b'pubkey', pubkey)
|
|
pubkey.putChild(b'isvalid', self.sydent.servlets.pubkeyIsValid)
|
|
pubkey.putChild(b'isvalid', self.sydent.servlets.pubkeyIsValid)
|
|
- pubkey.putChild(b'ed25519:0', pk_ed25519)
|
|
|
|
|
|
+ pubkey.putChild(b'ed25519:0', self.sydent.servlets.pubkey_ed25519)
|
|
pubkey.putChild(b'ephemeral', ephemeralPubkey)
|
|
pubkey.putChild(b'ephemeral', ephemeralPubkey)
|
|
ephemeralPubkey.putChild(b'isvalid', self.sydent.servlets.ephemeralPubkeyIsValid)
|
|
ephemeralPubkey.putChild(b'isvalid', self.sydent.servlets.ephemeralPubkeyIsValid)
|
|
|
|
|
|
- threepid_v2.putChild(b'getValidated3pid', getValidated3pid)
|
|
|
|
- threepid_v2.putChild(b'bind', bind)
|
|
|
|
|
|
+ threepid_v2.putChild(b'getValidated3pid', self.sydent.servlets.getValidated3pidV2)
|
|
|
|
+ threepid_v2.putChild(b'bind', self.sydent.servlets.threepidBindV2)
|
|
threepid_v2.putChild(b'unbind', unbind)
|
|
threepid_v2.putChild(b'unbind', unbind)
|
|
|
|
|
|
- threepid_v1.putChild(b'getValidated3pid', getValidated3pid)
|
|
|
|
|
|
+ threepid_v1.putChild(b'getValidated3pid', self.sydent.servlets.getValidated3pid)
|
|
threepid_v1.putChild(b'unbind', unbind)
|
|
threepid_v1.putChild(b'unbind', unbind)
|
|
if self.sydent.enable_v1_associations:
|
|
if self.sydent.enable_v1_associations:
|
|
- threepid_v1.putChild(b'bind', bind)
|
|
|
|
|
|
+ threepid_v1.putChild(b'bind', self.sydent.servlets.threepidBind)
|
|
|
|
|
|
v1.putChild(b'3pid', threepid_v1)
|
|
v1.putChild(b'3pid', threepid_v1)
|
|
|
|
|
|
v1.putChild(b'info', info)
|
|
v1.putChild(b'info', info)
|
|
v1.putChild(b'internal-info', internalInfo)
|
|
v1.putChild(b'internal-info', internalInfo)
|
|
|
|
|
|
- email.putChild(b'requestToken', emailReqCode)
|
|
|
|
- email.putChild(b'submitToken', emailValCode)
|
|
|
|
|
|
+ email.putChild(b'requestToken', self.sydent.servlets.emailRequestCode)
|
|
|
|
+ email.putChild(b'submitToken', self.sydent.servlets.emailValidate)
|
|
|
|
+
|
|
|
|
+ email_v2.putChild(b'requestToken', self.sydent.servlets.emailRequestCodeV2)
|
|
|
|
+ email_v2.putChild(b'submitToken', self.sydent.servlets.emailValidateV2)
|
|
|
|
+
|
|
|
|
+ msisdn.putChild(b'requestToken', self.sydent.servlets.msisdnRequestCode)
|
|
|
|
+ msisdn.putChild(b'submitToken', self.sydent.servlets.msisdnValidate)
|
|
|
|
|
|
- msisdn.putChild(b'requestToken', msisdnReqCode)
|
|
|
|
- msisdn.putChild(b'submitToken', msisdnValCode)
|
|
|
|
|
|
+ msisdn_v2.putChild(b'requestToken', self.sydent.servlets.msisdnRequestCodeV2)
|
|
|
|
+ msisdn_v2.putChild(b'submitToken', self.sydent.servlets.msisdnValidateV2)
|
|
|
|
|
|
v1.putChild(b'store-invite', self.sydent.servlets.storeInviteServlet)
|
|
v1.putChild(b'store-invite', self.sydent.servlets.storeInviteServlet)
|
|
|
|
|
|
@@ -136,15 +135,16 @@ class ClientApiHttpServer:
|
|
account.putChild(b'logout', self.sydent.servlets.logoutServlet)
|
|
account.putChild(b'logout', self.sydent.servlets.logoutServlet)
|
|
|
|
|
|
# v2 versions of existing APIs
|
|
# v2 versions of existing APIs
|
|
- v2.putChild(b'validate', validate)
|
|
|
|
|
|
+ v2.putChild(b'validate', validate_v2)
|
|
v2.putChild(b'pubkey', pubkey)
|
|
v2.putChild(b'pubkey', pubkey)
|
|
v2.putChild(b'3pid', threepid_v2)
|
|
v2.putChild(b'3pid', threepid_v2)
|
|
- v2.putChild(b'store-invite', self.sydent.servlets.storeInviteServlet)
|
|
|
|
- v2.putChild(b'sign-ed25519', self.sydent.servlets.blindlySignStuffServlet)
|
|
|
|
- v2.putChild(b'lookup', lookup_v2)
|
|
|
|
- v2.putChild(b'hash_details', hash_details)
|
|
|
|
|
|
+ v2.putChild(b'store-invite', self.sydent.servlets.storeInviteServletV2)
|
|
|
|
+ v2.putChild(b'sign-ed25519', self.sydent.servlets.blindlySignStuffServletV2)
|
|
|
|
+ v2.putChild(b'lookup', self.sydent.servlets.lookup_v2)
|
|
|
|
+ v2.putChild(b'hash_details', self.sydent.servlets.hash_details)
|
|
|
|
|
|
self.factory = Site(root)
|
|
self.factory = Site(root)
|
|
|
|
+ self.factory.requestFactory = SizeLimitingRequest
|
|
self.factory.displayTracebacks = False
|
|
self.factory.displayTracebacks = False
|
|
|
|
|
|
def setup(self):
|
|
def setup(self):
|