diff --git a/lib/create-app.js b/lib/create-app.js index a31d90016..ff8336ef9 100644 --- a/lib/create-app.js +++ b/lib/create-app.js @@ -236,6 +236,9 @@ function initWebId (argv, app, ldp) { // Ensure this modified session is not saved req.session.save = (done) => done() } + if (isLogoutRequest(req)) { + delete req.session.userId + } next() }) diff --git a/lib/handlers/error-pages.js b/lib/handlers/error-pages.js index dee1bf5a6..d964ab114 100644 --- a/lib/handlers/error-pages.js +++ b/lib/handlers/error-pages.js @@ -125,6 +125,24 @@ function sendErrorPage (statusCode, res, err, ldp) { }) } +/** + * Renders the databrowser + * + * @param req {IncomingRequest} + * @param res {ServerResponse} + */ +function renderDataBrowser (req, res) { + res.set('Content-Type', 'text/html') + const ldp = req.app.locals.ldp + const defaultDataBrowser = require.resolve('mashlib/dist/databrowser.html') + const dataBrowserPath = ldp.dataBrowserPath === 'default' ? defaultDataBrowser : ldp.dataBrowserPath + debug(' sending data browser file: ' + dataBrowserPath) + const dataBrowserHtml = fs.readFileSync(dataBrowserPath, 'utf8') + // Note: This must be done instead of sendFile because the test suite doesn't accept 412 responses + res.set('content-type', 'text/html') + res.send(dataBrowserHtml) +} + /** * Renders a 401 response explaining that a login is required. * @@ -136,7 +154,11 @@ function renderLoginRequired (req, res, err) { debug(`Display login-required for ${currentUrl}`) res.statusMessage = err.message res.status(401) - res.render('auth/login-required', { currentUrl }) + if (req.accepts('html')) { + renderDataBrowser(req, res) + } else { + res.send('Not Authenticated') + } } /** @@ -147,12 +169,14 @@ function renderLoginRequired (req, res, err) { */ function renderNoPermission (req, res, err) { const currentUrl = util.fullUrlForReq(req) - let webId = '' - if (req.session) webId = req.session.userId debug(`Display no-permission for ${currentUrl}`) res.statusMessage = err.message res.status(403) - res.render('auth/no-permission', { currentUrl, webId }) + if (req.accepts('html')) { + renderDataBrowser(req, res) + } else { + res.send('Not Authorized') + } } /** diff --git a/package-lock.json b/package-lock.json index ded2812ee..2ea32d359 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1290,8 +1290,7 @@ "asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", - "dev": true + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=" }, "asn1.js": { "version": "5.4.1", @@ -1310,6 +1309,13 @@ "integrity": "sha512-t9u0dU0rJN4ML+uxgN6VM2Z4H5jWIYm0w8LsZLzMJaQsgL3IJNbxHgmbWDvJAwspyHpDFuzUaUFh4c05UB4+6g==", "requires": { "pvutils": "^1.0.17" + }, + "dependencies": { + "pvutils": { + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.0.17.tgz", + "integrity": "sha512-wLHYUQxWaXVQvKnwIDWFVKDJku9XDCvyhhxoq8dc5MFdIlRenyPI9eSfEtcvgHgD7FlvCyGAlWgOzRnZD99GZQ==" + } } }, "assert": { @@ -1323,6 +1329,11 @@ "util": "^0.12.0" } }, + "assert-plus": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -1348,19 +1359,33 @@ "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", - "dev": true + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, "at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" }, + "auth-header": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/auth-header/-/auth-header-1.0.0.tgz", + "integrity": "sha512-CPPazq09YVDUNNVWo4oSPTQmtwIzHusZhQmahCKvIsk0/xH6U3QsMAv3sM+7+Q0B1K2KJ/Q38OND317uXs4NHA==" + }, "available-typed-arrays": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==" }, + "aws-sign2": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", + "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" + }, + "aws4": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.11.0.tgz", + "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==" + }, "b64-lite": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/b64-lite/-/b64-lite-1.4.0.tgz", @@ -2151,6 +2176,14 @@ "resolved": "https://registry.npmjs.org/base64url/-/base64url-3.0.1.tgz", "integrity": "sha512-ir1UPr3dkwexU7FdV8qBBbNDRUhMmIekYMFZfi+C/sLNnRESKPl23nB9b2pltqfOQNnGzsDdId90AEtG5tCx4A==" }, + "bcrypt-pbkdf": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "requires": { + "tweetnacl": "^0.14.3" + } + }, "bcryptjs": { "version": "2.4.3", "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", @@ -2425,6 +2458,11 @@ "resolved": "https://registry.npmjs.org/canonicalize/-/canonicalize-1.0.5.tgz", "integrity": "sha512-mAjKJPIyP0xqqv6IAkvso07StOmz6cmGtNDg3pXCSzXVZOqka7StIkAhJl/zHOi4M2CgpYfD6aeRWbnrmtvBEA==" }, + "caseless": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" + }, "chai": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", @@ -2619,7 +2657,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "requires": { "delayed-stream": "~1.0.0" } @@ -2920,6 +2957,14 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.0.9.tgz", "integrity": "sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==" }, + "dashdash": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "data-uri-to-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz", @@ -2982,8 +3027,7 @@ "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "depd": { "version": "1.1.2", @@ -3076,6 +3120,15 @@ "domhandler": "^4.2.0" } }, + "ecc-jsbn": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "requires": { + "jsbn": "~0.1.0", + "safer-buffer": "^2.1.0" + } + }, "ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -3912,6 +3965,11 @@ "tmp": "^0.0.33" } }, + "extsprintf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", + "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3933,8 +3991,7 @@ "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "fast-levenshtein": { "version": "2.0.6", @@ -4102,6 +4159,11 @@ "signal-exit": "^3.0.2" } }, + "forever-agent": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" + }, "form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", @@ -4274,6 +4336,14 @@ "get-intrinsic": "^1.1.1" } }, + "getpass": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "requires": { + "assert-plus": "^1.0.0" + } + }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", @@ -4334,6 +4404,38 @@ "wordwrap": "^1.0.0" } }, + "har-schema": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", + "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" + }, + "har-validator": { + "version": "5.1.5", + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", + "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", + "requires": { + "ajv": "^6.12.3", + "har-schema": "^2.0.0" + }, + "dependencies": { + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + } + } + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -4534,6 +4636,16 @@ "micromatch": "^4.0.2" } }, + "http-signature": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", + "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "requires": { + "assert-plus": "^1.0.0", + "jsprim": "^1.2.2", + "sshpk": "^1.7.0" + } + }, "hyphenate-style-name": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz", @@ -4888,8 +5000,7 @@ "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", - "dev": true + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, "is-unicode-supported": { "version": "0.1.0", @@ -4921,6 +5032,15 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "requires": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "isomorphic-webcrypto": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/isomorphic-webcrypto/-/isomorphic-webcrypto-2.3.8.tgz", @@ -4939,6 +5059,11 @@ "webcrypto-shim": "^0.1.4" } }, + "isstream": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" + }, "issue-pane": { "version": "2.4.7", "resolved": "https://registry.npmjs.org/issue-pane/-/issue-pane-2.4.7.tgz", @@ -5064,6 +5189,11 @@ "esprima": "^4.0.0" } }, + "jsbn": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" + }, "jsesc": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", @@ -5075,6 +5205,11 @@ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, + "json-schema": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + }, "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", @@ -5089,8 +5224,7 @@ "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, "json5": { "version": "0.5.1", @@ -5134,6 +5268,17 @@ "semver": "^5.6.0" } }, + "jsprim": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", + "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "requires": { + "assert-plus": "1.0.0", + "extsprintf": "1.3.0", + "json-schema": "0.2.3", + "verror": "1.10.0" + } + }, "jss": { "version": "10.8.0", "resolved": "https://registry.npmjs.org/jss/-/jss-10.8.0.tgz", @@ -6211,6 +6356,11 @@ } } }, + "oauth-sign": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", + "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -6568,6 +6718,11 @@ "sha.js": "^2.4.8" } }, + "performance-now": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", + "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" + }, "picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -6926,6 +7081,11 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "psl": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", + "integrity": "sha512-RIdOzyoavK+hA18OGGWDqUTsCLhtA7IcZ/6NCs4fFJaHBDab+pDDmDIByWFRQJq2Cd7r1OoQxBGKOaztq+hjIQ==" + }, "public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", @@ -6952,11 +7112,6 @@ "tslib": "^2.3.1" } }, - "pvutils": { - "version": "1.0.17", - "resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.0.17.tgz", - "integrity": "sha512-wLHYUQxWaXVQvKnwIDWFVKDJku9XDCvyhhxoq8dc5MFdIlRenyPI9eSfEtcvgHgD7FlvCyGAlWgOzRnZD99GZQ==" - }, "qs": { "version": "6.10.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", @@ -7283,6 +7438,55 @@ "mdast-util-from-markdown": "^0.8.0" } }, + "request": { + "version": "2.88.2", + "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", + "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", + "requires": { + "aws-sign2": "~0.7.0", + "aws4": "^1.8.0", + "caseless": "~0.12.0", + "combined-stream": "~1.0.6", + "extend": "~3.0.2", + "forever-agent": "~0.6.1", + "form-data": "~2.3.2", + "har-validator": "~5.1.3", + "http-signature": "~1.2.0", + "is-typedarray": "~1.0.0", + "isstream": "~0.1.2", + "json-stringify-safe": "~5.0.1", + "mime-types": "~2.1.19", + "oauth-sign": "~0.9.0", + "performance-now": "^2.1.0", + "qs": "~6.5.2", + "safe-buffer": "^5.1.2", + "tough-cookie": "~2.5.0", + "tunnel-agent": "^0.6.0", + "uuid": "^3.3.2" + }, + "dependencies": { + "form-data": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", + "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.6", + "mime-types": "^2.1.12" + } + }, + "qs": { + "version": "6.5.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", + "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" + }, + "uuid": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", + "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==" + } + } + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -7562,6 +7766,25 @@ "integrity": "sha512-74RuQLRB2lIDoS3dFY/XXRsPJvL1qr5t7LisJ10q5O2wLi4ISEyNU39XPICVOj+kg1eT30CjKUecMzF+9P2xfQ==", "dev": true }, + "solid-auth-client": { + "version": "2.5.6", + "resolved": "https://registry.npmjs.org/solid-auth-client/-/solid-auth-client-2.5.6.tgz", + "integrity": "sha512-AFLitty7kNN1PVtaFM+5MIzo0RwFvt71MCTrWaC/Onk3/UdOdOnYH2rh8LD2YIiIDUceQ+ypRkIhP5V507rDSQ==", + "requires": { + "@babel/runtime": "^7.12.1", + "@solid/oidc-rp": "^0.11.6", + "auth-header": "^1.0.0", + "commander": "^6.2.0", + "isomorphic-fetch": "^3.0.0" + }, + "dependencies": { + "commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==" + } + } + }, "solid-logic": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/solid-logic/-/solid-logic-1.3.7.tgz", @@ -7713,6 +7936,22 @@ "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "dev": true }, + "sshpk": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", + "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", + "requires": { + "asn1": "~0.2.3", + "assert-plus": "^1.0.0", + "bcrypt-pbkdf": "^1.0.0", + "dashdash": "^1.12.0", + "ecc-jsbn": "~0.1.1", + "getpass": "^0.1.1", + "jsbn": "~0.1.0", + "safer-buffer": "^2.0.2", + "tweetnacl": "~0.14.0" + } + }, "standard": { "version": "16.0.4", "resolved": "https://registry.npmjs.org/standard/-/standard-16.0.4.tgz", @@ -8134,6 +8373,15 @@ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" }, + "tough-cookie": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", + "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", + "requires": { + "psl": "^1.1.28", + "punycode": "^2.1.1" + } + }, "tr46": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz", @@ -8186,6 +8434,14 @@ "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" }, + "tunnel-agent": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "requires": { + "safe-buffer": "^5.0.1" + } + }, "turtle-validator": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/turtle-validator/-/turtle-validator-1.1.1.tgz", @@ -8195,6 +8451,11 @@ "n3": "^1.4.0" } }, + "tweetnacl": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -8415,6 +8676,23 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" }, + "verror": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", + "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", + "requires": { + "assert-plus": "^1.0.0", + "core-util-is": "1.0.2", + "extsprintf": "^1.2.0" + }, + "dependencies": { + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" + } + } + }, "vfile": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz", @@ -8470,6 +8748,11 @@ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz", "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==" }, + "whatwg-fetch": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==" + }, "whatwg-url": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-10.0.0.tgz", diff --git a/package.json b/package.json index cfce4c88d..593d9d1dd 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,9 @@ "owasp-password-strength-test": "^1.3.0", "rdflib": "^2.2.7", "recursive-readdir": "^2.2.2", + "request": "^2.88.2", "rimraf": "^3.0.2", + "solid-auth-client": "^2.5.6", "solid-namespace": "^0.5.1", "solid-ws": "^0.4.3", "text-encoder-lite": "^2.0.0", diff --git a/test/integration/authentication-oidc-test.js b/test/integration/authentication-oidc-test.js index 57ca89e0e..834de2f74 100644 --- a/test/integration/authentication-oidc-test.js +++ b/test/integration/authentication-oidc-test.js @@ -513,7 +513,7 @@ describe.skip('Authentication API (OIDC)', () => { bob.get('/shared-with-alice.txt') .end((err, { status, text }) => { expect(status).to.equal(401) - expect(text).to.contain('Log in') + expect(text).to.contain('GlobalDashboard') done(err) }) }) diff --git a/test/integration/authentication-oidc-with-strict-origins-turned-off-test.js b/test/integration/authentication-oidc-with-strict-origins-turned-off-test.js index 7e1b71cd3..47529fe36 100644 --- a/test/integration/authentication-oidc-with-strict-origins-turned-off-test.js +++ b/test/integration/authentication-oidc-with-strict-origins-turned-off-test.js @@ -382,10 +382,10 @@ describe('Authentication API (OIDC) - With strict origins turned off', () => { describe('Browser login workflow', () => { it('401 Unauthorized asking the user to log in', (done) => { - bob.get('/shared-with-alice.txt') + bob.get('/shared-with-alice.txt', { headers: { accept: 'text/html' } }) .end((err, { status, text }) => { expect(status).to.equal(401) - expect(text).to.contain('Log in') + expect(text).to.contain('GlobalDashboard') done(err) }) }) diff --git a/test/integration/errors-oidc-test.js b/test/integration/errors-oidc-test.js index 89ef5838f..9ab9b863f 100644 --- a/test/integration/errors-oidc-test.js +++ b/test/integration/errors-oidc-test.js @@ -52,7 +52,7 @@ describe('OIDC error handling', function () { .set('Accept', 'text/html') .expect('Content-Type', 'text/html; charset=utf-8') .then(res => { - expect(res.text).to.match(/Log in/) + expect(res.text).to.match(/GlobalDashboard/) }) }) }) diff --git a/test/integration/patch-test.js b/test/integration/patch-test.js index e2b795c6b..8c29bb9db 100644 --- a/test/integration/patch-test.js +++ b/test/integration/patch-test.js @@ -90,7 +90,7 @@ describe('PATCH', () => { solid:inserts { . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with append-only access', describePatch({ @@ -144,7 +144,7 @@ describe('PATCH', () => { solid:where { ?a . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with append-only access', describePatch({ @@ -154,7 +154,7 @@ describe('PATCH', () => { solid:where { ?a . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with write-only access', describePatch({ @@ -167,7 +167,7 @@ describe('PATCH', () => { // thereby inappropriately giving the user (guess-based) read access; // therefore, we need to return 403. status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with read-append access', () => { @@ -234,7 +234,7 @@ describe('PATCH', () => { solid:deletes { . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with append-only access', describePatch({ @@ -243,7 +243,7 @@ describe('PATCH', () => { solid:deletes { . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with write-only access', describePatch({ @@ -255,7 +255,7 @@ describe('PATCH', () => { // thereby inappropriately giving the user (guess-based) read access; // therefore, we need to return 403. status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with read-append access', describePatch({ @@ -264,7 +264,7 @@ describe('PATCH', () => { solid:deletes { . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with read-write access', () => { @@ -329,7 +329,7 @@ describe('PATCH', () => { solid:deletes { . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with append-only access', describePatch({ @@ -339,7 +339,7 @@ describe('PATCH', () => { solid:deletes { . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with write-only access', describePatch({ @@ -352,7 +352,7 @@ describe('PATCH', () => { // thereby inappropriately giving the user (guess-based) read access; // therefore, we need to return 403. status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with read-append access', describePatch({ @@ -362,7 +362,7 @@ describe('PATCH', () => { solid:deletes { . }.` }, { // expected: status: 403, - text: 'No permission' + text: 'GlobalDashboard' })) describe('on a resource with read-write access', () => { diff --git a/test/resources/accounts/localhost/.acl b/test/resources/accounts/localhost/.acl new file mode 100644 index 000000000..05a9842d9 --- /dev/null +++ b/test/resources/accounts/localhost/.acl @@ -0,0 +1,10 @@ +# Root ACL resource for the root +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + acl:agentClass foaf:Agent; # everyone + acl:accessTo ; + acl:default ; + acl:mode acl:Read. diff --git a/test/resources/accounts/localhost/.well-known/.acl b/test/resources/accounts/localhost/.well-known/.acl new file mode 100644 index 000000000..6cacb3779 --- /dev/null +++ b/test/resources/accounts/localhost/.well-known/.acl @@ -0,0 +1,15 @@ +# ACL for the default .well-known/ resource +# Server operators will be able to override it as they wish +# Public-readable + +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + + acl:agentClass foaf:Agent; # everyone + + acl:accessTo ; + + acl:mode acl:Read. diff --git a/test/resources/accounts/localhost/favicon.ico b/test/resources/accounts/localhost/favicon.ico new file mode 100644 index 000000000..764acb205 Binary files /dev/null and b/test/resources/accounts/localhost/favicon.ico differ diff --git a/test/resources/accounts/localhost/favicon.ico.acl b/test/resources/accounts/localhost/favicon.ico.acl new file mode 100644 index 000000000..e76838bb8 --- /dev/null +++ b/test/resources/accounts/localhost/favicon.ico.acl @@ -0,0 +1,15 @@ +# ACL for the default favicon.ico resource +# Server operators will be able to override it as they wish +# Public-readable + +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + + acl:agentClass foaf:Agent; # everyone + + acl:accessTo ; + + acl:mode acl:Read. diff --git a/test/resources/accounts/localhost/index.html b/test/resources/accounts/localhost/index.html new file mode 100644 index 000000000..344b1e2b2 --- /dev/null +++ b/test/resources/accounts/localhost/index.html @@ -0,0 +1,50 @@ + + + + + + Welcome to Solid + + + + + + + + + diff --git a/test/resources/accounts/localhost/robots.txt b/test/resources/accounts/localhost/robots.txt new file mode 100644 index 000000000..8c27a0227 --- /dev/null +++ b/test/resources/accounts/localhost/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +# Allow all crawling (subject to ACLs as usual, of course) +Disallow: diff --git a/test/resources/accounts/localhost/robots.txt.acl b/test/resources/accounts/localhost/robots.txt.acl new file mode 100644 index 000000000..1eaabc201 --- /dev/null +++ b/test/resources/accounts/localhost/robots.txt.acl @@ -0,0 +1,15 @@ +# ACL for the default robots.txt resource +# Server operators will be able to override it as they wish +# Public-readable + +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + + acl:agentClass foaf:Agent; # everyone + + acl:accessTo ; + + acl:mode acl:Read. diff --git a/test/resources/accounts/single-user/.acl b/test/resources/accounts/single-user/.acl new file mode 100644 index 000000000..05a9842d9 --- /dev/null +++ b/test/resources/accounts/single-user/.acl @@ -0,0 +1,10 @@ +# Root ACL resource for the root +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + acl:agentClass foaf:Agent; # everyone + acl:accessTo ; + acl:default ; + acl:mode acl:Read. diff --git a/test/resources/accounts/single-user/.well-known/.acl b/test/resources/accounts/single-user/.well-known/.acl new file mode 100644 index 000000000..6cacb3779 --- /dev/null +++ b/test/resources/accounts/single-user/.well-known/.acl @@ -0,0 +1,15 @@ +# ACL for the default .well-known/ resource +# Server operators will be able to override it as they wish +# Public-readable + +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + + acl:agentClass foaf:Agent; # everyone + + acl:accessTo ; + + acl:mode acl:Read. diff --git a/test/resources/accounts/single-user/favicon.ico b/test/resources/accounts/single-user/favicon.ico new file mode 100644 index 000000000..764acb205 Binary files /dev/null and b/test/resources/accounts/single-user/favicon.ico differ diff --git a/test/resources/accounts/single-user/favicon.ico.acl b/test/resources/accounts/single-user/favicon.ico.acl new file mode 100644 index 000000000..e76838bb8 --- /dev/null +++ b/test/resources/accounts/single-user/favicon.ico.acl @@ -0,0 +1,15 @@ +# ACL for the default favicon.ico resource +# Server operators will be able to override it as they wish +# Public-readable + +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + + acl:agentClass foaf:Agent; # everyone + + acl:accessTo ; + + acl:mode acl:Read. diff --git a/test/resources/accounts/single-user/index.html b/test/resources/accounts/single-user/index.html new file mode 100644 index 000000000..344b1e2b2 --- /dev/null +++ b/test/resources/accounts/single-user/index.html @@ -0,0 +1,50 @@ + + + + + + Welcome to Solid + + + + +
+ + +

+ This is a prototype implementation of a Solid server. +

+

+ It is a fully functional server, but there are no security or stability guarantees. +

+

+ If you have not already done so, please create an account. +

+ + + +
+

Server info

+
+
Name
+
localhost
+
Details
+
Running on Solid 5.6.8
+
+
+
+ + + + diff --git a/test/resources/accounts/single-user/robots.txt b/test/resources/accounts/single-user/robots.txt new file mode 100644 index 000000000..8c27a0227 --- /dev/null +++ b/test/resources/accounts/single-user/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +# Allow all crawling (subject to ACLs as usual, of course) +Disallow: diff --git a/test/resources/accounts/single-user/robots.txt.acl b/test/resources/accounts/single-user/robots.txt.acl new file mode 100644 index 000000000..1eaabc201 --- /dev/null +++ b/test/resources/accounts/single-user/robots.txt.acl @@ -0,0 +1,15 @@ +# ACL for the default robots.txt resource +# Server operators will be able to override it as they wish +# Public-readable + +@prefix acl: . +@prefix foaf: . + +<#public> + a acl:Authorization; + + acl:agentClass foaf:Agent; # everyone + + acl:accessTo ; + + acl:mode acl:Read.