projects
/
squeep-authentication-module
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
dcbdec0
)
minor cleanups
author
Justin Wind
<justin.wind+git@gmail.com>
Sat, 10 Jun 2023 18:48:11 +0000
(11:48 -0700)
committer
Justin Wind
<justin.wind+git@gmail.com>
Sat, 10 Jun 2023 18:48:11 +0000
(11:48 -0700)
.eslintrc.json
patch
|
blob
|
history
lib/authenticator.js
patch
|
blob
|
history
lib/common.js
patch
|
blob
|
history
lib/session-manager.js
patch
|
blob
|
history
package.json
patch
|
blob
|
history
diff --git
a/.eslintrc.json
b/.eslintrc.json
index e6c6f891e3faa434368a990eaeaffb9f0aea42f4..b3ffbe2a33db74e7d1c2dafd6be10a0371ae7343 100644
(file)
--- a/
.eslintrc.json
+++ b/
.eslintrc.json
@@
-11,7
+11,7
@@
"plugin:sonarjs/recommended"
],
"parserOptions": {
"plugin:sonarjs/recommended"
],
"parserOptions": {
- "ecmaVersion":
2018
+ "ecmaVersion":
"latest"
},
"plugins": [
"node",
},
"plugins": [
"node",
diff --git
a/lib/authenticator.js
b/lib/authenticator.js
index 040834fd650cd46b4d61f6b03c1acf647721d0ff..ba5d9217a86ca03efdaebd07c7b833338ddc7cce 100644
(file)
--- a/
lib/authenticator.js
+++ b/
lib/authenticator.js
@@
-189,7
+189,7
@@
class Authenticator {
(cookieHeader || '').split(/; */).forEach((field) => {
const [ name, value ] = common.splitFirst(field, '=', null).map((x) => x && decodeURIComponent(x.trim()));
if (name && !(name in cookie)) {
(cookieHeader || '').split(/; */).forEach((field) => {
const [ name, value ] = common.splitFirst(field, '=', null).map((x) => x && decodeURIComponent(x.trim()));
if (name && !(name in cookie)) {
- if (value
&& value
.startsWith('"') && value.endsWith('"')) {
+ if (value
?
.startsWith('"') && value.endsWith('"')) {
cookie[name] = value.slice(1, -1); // eslint-disable-line security/detect-object-injection
} else {
cookie[name] = value; // eslint-disable-line security/detect-object-injection
cookie[name] = value.slice(1, -1); // eslint-disable-line security/detect-object-injection
} else {
cookie[name] = value; // eslint-disable-line security/detect-object-injection
diff --git
a/lib/common.js
b/lib/common.js
index 816b65c5bea9ad23052eaf75b06961a20e999037..d69e6ad6a2131d12d975dbaaddaca70fdb3551e5 100644
(file)
--- a/
lib/common.js
+++ b/
lib/common.js
@@
-20,10
+20,22
@@
const freezeDeep = (o) => {
return o;
};
return o;
};
+/**
+ * Return a new object duplicating `o`, without the properties specified.
+ * @param {Object} o
+ * @param {String[]} props
+ * @returns {Object}
+ */
const omit = (o, props) => {
return Object.fromEntries(Object.entries(o).filter(([k]) => !props.includes(k)));
};
const omit = (o, props) => {
return Object.fromEntries(Object.entries(o).filter(([k]) => !props.includes(k)));
};
+/**
+ * Helper to log mystery-box statistics.
+ * @param {ConsoleLike} logger
+ * @param {String} scope
+ * @returns {Function}
+ */
const mysteryBoxLogger = (logger, scope) => {
return (s) => {
logger.debug(scope, `${s.packageName}@${s.packageVersion}:${s.method}`, omit(s, [
const mysteryBoxLogger = (logger, scope) => {
return (s) => {
logger.debug(scope, `${s.packageName}@${s.packageVersion}:${s.method}`, omit(s, [
diff --git
a/lib/session-manager.js
b/lib/session-manager.js
index 6af1017ad6c1d6a5bdfc3c7ca53fdb3d72e239ca..cb4c7126ec54cffc18b1856270cd1112f5c60182 100644
(file)
--- a/
lib/session-manager.js
+++ b/
lib/session-manager.js
@@
-23,8
+23,8
@@
class SessionManager {
* @param {Number=} options.authenticator.inactiveSessionLifespanSeconds
* @param {Boolean} options.authenticator.secureAuthOnly
* @param {Object} options.dingus
* @param {Number=} options.authenticator.inactiveSessionLifespanSeconds
* @param {Boolean} options.authenticator.secureAuthOnly
* @param {Object} options.dingus
- * @param {
Object
} options.dingus.proxyPrefix
- * @param {
Object
} options.dingus.selfBaseUrl
+ * @param {
String
} options.dingus.proxyPrefix
+ * @param {
String
} options.dingus.selfBaseUrl
*/
constructor(logger, authenticator, options) {
this.logger = logger;
*/
constructor(logger, authenticator, options) {
this.logger = logger;
@@
-140,13
+140,13
@@
class SessionManager {
&& me) {
let profile;
profile = await this.indieAuthCommunication.fetchProfile(me);
&& me) {
let profile;
profile = await this.indieAuthCommunication.fetchProfile(me);
- if ((!profile
|| !profile
.metadata)
+ if ((!profile
?
.metadata)
&& meAutoScheme) {
this.logger.debug(_scope, 'trying http fallback', { ctx });
me.protocol = 'http';
profile = await this.indieAuthCommunication.fetchProfile(me);
}
&& meAutoScheme) {
this.logger.debug(_scope, 'trying http fallback', { ctx });
me.protocol = 'http';
profile = await this.indieAuthCommunication.fetchProfile(me);
}
- if (!profile
|| !profile
.metadata) {
+ if (!profile
?
.metadata) {
this.logger.debug(_scope, 'failed to find any profile information at url', { ctx });
ctx.errors.push(`No profile information was found at '${me}'.`);
} else {
this.logger.debug(_scope, 'failed to find any profile information at url', { ctx });
ctx.errors.push(`No profile information was found at '${me}'.`);
} else {
diff --git
a/package.json
b/package.json
index 16fb07e66db9ae004359a3dbb3471e1a32db7636..9c6784ce3516c74f3d6754dfc9593ce0d5c6d7f0 100644
(file)
--- a/
package.json
+++ b/
package.json
@@
-20,7
+20,7
@@
"pam"
],
"engines": {
"pam"
],
"engines": {
- "node": "
>=14
"
+ "node": "
^14 >=14.18 || >=15.7
"
},
"author": "Justin Wind <jwind-npm@squeep.com>",
"license": "ISC",
},
"author": "Justin Wind <jwind-npm@squeep.com>",
"license": "ISC",