|
|
@@ -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();
|