Use ws directly to handle new exec ws route

This commit is contained in:
Girish Ramakrishnan
2017-08-18 17:56:01 -07:00
parent e3040b334d
commit 537fbff4aa
5 changed files with 91 additions and 84 deletions
+6 -1
View File
@@ -534,7 +534,9 @@ function scope(requestedScope) {
];
}
function websocketAuth(ws, req, next) {
function websocketAuth(requestedScopes, req, res, next) {
assert(Array.isArray(requestedScopes));
if (typeof req.query.access_token !== 'string') return next(new HttpError(401, 'Unauthorized'));
auth.accessTokenAuth(req.query.access_token, function (error, user, info) {
@@ -544,6 +546,9 @@ function websocketAuth(ws, req, next) {
req.user = user;
req.authInfo = info;
var error = validateRequestedScopes(req, requestedScopes);
if (error) return next(new HttpError(401, error.message));
next();
});
}