]> git.r.bdr.sh - rbdr/dead-drop/blobdiff - lib/dead_drop.js
Update readme and changelog
[rbdr/dead-drop] / lib / dead_drop.js
index 6f976459e18231d8ed5fbd0cb950b33b0024ca7d..3336444e7e1246489a504738ac8c665ba9ae6b3e 100644 (file)
@@ -45,10 +45,24 @@ module.exports = internals.DeadDrop = class DeadDrop {
 
   _initializeServer() {
 
 
   _initializeServer() {
 
+    const self = this;
+
     this._app = Koa();
 
     this._app.use(KoaBodyParser());
 
     this._app = Koa();
 
     this._app.use(KoaBodyParser());
 
+    this._app.use(function * (next) {
+
+      const accountSid = this.request.body.AccountSid || this.request.query.AccountSid;
+
+      if (accountSid === self.twilioAccountSid) {
+        yield next;
+      }
+      else {
+        this.throw('Unauthorized', 401);
+      }
+    });
+
     this._initializeMainMenuRoutes();
     this._initializeRecordingMenuRoutes();
     this._initializeRecordingsRoutes();
     this._initializeMainMenuRoutes();
     this._initializeRecordingMenuRoutes();
     this._initializeRecordingsRoutes();