Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a229750
Changed error page to display the Databrowser instead
jaxoncreed Aug 18, 2021
1929d84
Fixed error page tests
jaxoncreed Aug 18, 2021
ab0c68e
Updated more tests
jaxoncreed Aug 18, 2021
623187f
Merge branch 'main' of github.com:solid/node-solid-server into auth-u…
jaxoncreed Aug 20, 2021
ed2ccbf
Fix tests
jaxoncreed Aug 20, 2021
8a1da0f
Fixed test suite tests
jaxoncreed Aug 24, 2021
a344ad8
Update test/resources/accounts/localhost/index.html
jaxoncreed Aug 27, 2021
a755b7d
Update test/resources/accounts/single-user/index.html
jaxoncreed Aug 27, 2021
5b3bf27
upgrade to mashlib@1.7.5-alpha
bourgeoa Aug 30, 2021
7f0ba85
Cleared user from session when not authenticated
jaxoncreed Aug 31, 2021
c8fd750
Merge branch 'auth-upgrade' of github.com:solid/node-solid-server int…
jaxoncreed Aug 31, 2021
32d7477
Fixed tests
jaxoncreed Sep 3, 2021
4aa0951
Added request to dependencies
jaxoncreed Sep 6, 2021
e2f407c
Hackily removed sendFile so that test suite passes
jaxoncreed Sep 7, 2021
38b129c
Made the logout route remove the user
jaxoncreed Sep 10, 2021
9187936
mashlib@1.7.5-alpha-2-98ed3958
bourgeoa Sep 11, 2021
a5c6e3b
mashlib@1.7.5-alpha-3-98ed3958
bourgeoa Sep 13, 2021
e2b50c1
v5.6.9-alpha-d9bd19aa
bourgeoa Sep 16, 2021
9038152
v5.6.9-alpha-23942afd
bourgeoa Sep 30, 2021
eb89caa
v5.6.9-beta
bourgeoa Sep 30, 2021
d5a0d85
mashlib@1.7.5-beta-1
bourgeoa Oct 9, 2021
3347ce8
add solid-auth-client
bourgeoa Oct 9, 2021
5e042c7
mashlib@1.7.5-beta.2
bourgeoa Oct 9, 2021
338c399
merge main
bourgeoa Oct 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/create-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand Down
32 changes: 28 additions & 4 deletions lib/handlers/error-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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')
}
}

/**
Expand All @@ -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')
}
}

/**
Expand Down
Loading