@tiledesk/tiledesk-server 2.3.72 → 2.3.74

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,7 +22,7 @@ var cacheUtil = require('../utils/cacheUtil');
22
22
  var mongoose = require('mongoose');
23
23
  const requestConstants = require("../models/requestConstants");
24
24
  var RoleConstants = require('../models/roleConstants');
25
- let configSecret = process.env.GLOBAL_SECRET || config.secret;
25
+ let configSecretOrPubicKay = process.env.GLOBAL_SECRET_OR_PUB_KEY || process.env.GLOBAL_SECRET || config.secret;
26
26
  var cacheEnabler = require("../services/cacheEnabler");
27
27
 
28
28
 
@@ -71,14 +71,14 @@ class WebSocketServer {
71
71
 
72
72
  var token = queryParameter.token;
73
73
  winston.debug('token:'+ token);
74
- winston.debug('configSecret:'+ configSecret);
74
+ winston.debug('configSecretOrPubicKay:'+ configSecretOrPubicKay);
75
75
 
76
76
 
77
77
  if (!token)
78
78
  cb(false, 401, 'Unauthorized');
79
79
  else {
80
80
  token = token.replace('JWT ', '');
81
- jwt.verify(token, configSecret, function (err, decoded) {
81
+ jwt.verify(token, configSecretOrPubicKay, function (err, decoded) { //pub_jwt pp_jwt
82
82
  if (err) {
83
83
  winston.error('WebSocket error verifing websocket jwt token ', err);
84
84
  return cb(false, 401, 'Unauthorized');
@@ -189,7 +189,7 @@ class WebSocketServer {
189
189
 
190
190
  if (cacheEnabler.project) {
191
191
  q.cache(cacheUtil.defaultTTL, "projects:id:"+projectId) //project_cache
192
- winston.debug('project cache enabled');
192
+ winston.debug('project cache enabled for websocket');
193
193
  }
194
194
 
195
195
  return q.exec(function(err, project) {