isundil hace 1 año
padre
commit
059c41a94c
Se han modificado 2 ficheros con 6 adiciones y 20 borrados
  1. 1 1
      package.json
  2. 5 19
      src/security.js

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "craftlabhttpserver",
-  "version": "20240122.2",
+  "version": "20240122.3",
   "description": "",
   "main": "main.js",
   "scripts": {

+ 5 - 19
src/security.js

@@ -41,13 +41,6 @@ function getSessionObj(cookieObject) {
     return sessionEntry;
 }
 
-function getAccessList(cookieObject) {
-    let session = getSessionObj(cookieObject);
-    if (!session)
-        return null;
-    return session.accessList;
-}
-
 function getRequestIp(req) {
     return req.headers['x-forwarded-for'] || req.socket.remoteAddress;
 }
@@ -56,19 +49,12 @@ function sign(msg) {
     return crypto.sign('sha256', Buffer.from(msg), decodeKey(CONFIG.privKey)).toString('base64');
 }
 
-function Access() {
-}
-Access.prototype.id = function() { return ""; }
-
-function LinkAccess(linkId) {
-    Access.call(this);
-    this.linkId = linkId;
-}
-LinkAccess.prototype = Object.create(Access.prototype);
-LinkAccess.prototype.id = function() { return "LINK_"+this.linkId; }
-
 module.exports = {
-    getAccessList: getAccessList,
+    SESSION_TIME: SESSION_TIME,
+    SESSION_COOKIE: SESSION_COOKIE,
+    pushSession: (key, val) => { loggedCache[key] = val; },
+    getSessionObj: getSessionObj,
+    getSessionId: getSessionId,
     getRequestIp: getRequestIp,
     createSession: req => {
         const now = Date.now();