mirror of https://gitee.com/bigwinds/arangodb
Disambiguated "lifetime" in Foxx auth.
This commit is contained in:
parent
1f63a6317d
commit
5b62aae51e
|
@ -821,7 +821,7 @@ Sessions.prototype._toObject = function (session) {
|
||||||
|
|
||||||
if (!this._changed) {
|
if (!this._changed) {
|
||||||
oldExpires = this.expires;
|
oldExpires = this.expires;
|
||||||
newExpires = internal.time() + that._options.lifetime;
|
newExpires = internal.time() + that._options.sessionLifetime;
|
||||||
|
|
||||||
if (newExpires - oldExpires > that._options.minUpdateResolution) {
|
if (newExpires - oldExpires > that._options.minUpdateResolution) {
|
||||||
this.expires = newExpires;
|
this.expires = newExpires;
|
||||||
|
@ -917,8 +917,8 @@ Sessions.prototype.generate = function (identifier, data) {
|
||||||
throw new TypeError("invalid type for 'identifier'");
|
throw new TypeError("invalid type for 'identifier'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._options.hasOwnProperty("lifetime")) {
|
if (!this._options.hasOwnProperty("sessionLifetime")) {
|
||||||
throw new Error("no value specified for 'lifetime'");
|
throw new Error("no value specified for 'sessionLifetime'");
|
||||||
}
|
}
|
||||||
|
|
||||||
storage = this.storage();
|
storage = this.storage();
|
||||||
|
@ -934,7 +934,7 @@ Sessions.prototype.generate = function (identifier, data) {
|
||||||
token = generateToken();
|
token = generateToken();
|
||||||
session = {
|
session = {
|
||||||
_key: token,
|
_key: token,
|
||||||
expires: internal.time() + this._options.lifetime,
|
expires: internal.time() + this._options.sessionLifetime,
|
||||||
identifier: identifier,
|
identifier: identifier,
|
||||||
data: data || {}
|
data: data || {}
|
||||||
};
|
};
|
||||||
|
@ -963,7 +963,7 @@ Sessions.prototype.update = function (token, data) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
this.storage().update(token, {
|
this.storage().update(token, {
|
||||||
expires: internal.time() + this._options.lifetime,
|
expires: internal.time() + this._options.sessionLifetime,
|
||||||
data: data
|
data: data
|
||||||
}, true, false);
|
}, true, false);
|
||||||
};
|
};
|
||||||
|
@ -990,7 +990,7 @@ Sessions.prototype.get = function (token) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var storage = this.storage(),
|
var storage = this.storage(),
|
||||||
session,
|
session,
|
||||||
lifetime;
|
sessionLifetime;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
session = storage.document(token);
|
session = storage.document(token);
|
||||||
|
@ -998,7 +998,7 @@ Sessions.prototype.get = function (token) {
|
||||||
if (session.expires >= internal.time()) {
|
if (session.expires >= internal.time()) {
|
||||||
// session still valid
|
// session still valid
|
||||||
|
|
||||||
lifetime = this._options.lifetime;
|
sessionLifetime = this._options.sessionLifetime;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
errorNum: internal.errors.ERROR_NO_ERROR,
|
errorNum: internal.errors.ERROR_NO_ERROR,
|
||||||
|
@ -1049,7 +1049,7 @@ CookieAuthentication = function (applicationContext, options) {
|
||||||
|
|
||||||
this._options = {
|
this._options = {
|
||||||
name: options.name || this._applicationContext.name + "-session",
|
name: options.name || this._applicationContext.name + "-session",
|
||||||
lifetime: options.lifetime || 3600,
|
cookieLifetime: options.cookieLifetime || 3600,
|
||||||
path: options.path || "/",
|
path: options.path || "/",
|
||||||
domain: options.path || undefined,
|
domain: options.path || undefined,
|
||||||
secure: options.secure || false,
|
secure: options.secure || false,
|
||||||
|
@ -1105,7 +1105,7 @@ CookieAuthentication.prototype.setCookie = function (res, value) {
|
||||||
cookie = {
|
cookie = {
|
||||||
name: name,
|
name: name,
|
||||||
value: value,
|
value: value,
|
||||||
lifeTime: (value === null || value === "") ? 0 : this._options.lifetime,
|
lifeTime: (value === null || value === "") ? 0 : this._options.cookieLifetime,
|
||||||
path: this._options.path,
|
path: this._options.path,
|
||||||
secure: this._options.secure,
|
secure: this._options.secure,
|
||||||
domain: this._options.domain,
|
domain: this._options.domain,
|
||||||
|
|
Loading…
Reference in New Issue