Skip to content

Commit 2740f88

Browse files
kjetilkrubensworks
authored andcommitted
Say Unauthenticated for 401
1 parent b709be5 commit 2740f88

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

lib/acl-checker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ class ACLChecker {
6969
const accessDenied = aclCheck.accessDenied(this.acl.graph, resource, directory, aclFile, agent, modes, origin, trustedOrigins)
7070
console.log('ACCESS DENIED', accessDenied, '\n\n')
7171
if (accessDenied && user) {
72-
throw new HTTPError(403, `Access to ${this.resource} denied for ${user}`)
72+
throw new HTTPError(403, accessDenied)
7373
} else if (accessDenied) {
74-
throw new HTTPError(401, `Access to ${this.resource} requires authorization`)
74+
throw new HTTPError(401, 'Unauthenticated')
7575
}
7676
return Promise.resolve(true)
7777
}

lib/http-error.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module.exports = HTTPError
22

33
function HTTPError (status, message) {
4+
console.log('DAAAAHUT: ', status, message)
45
if (!(this instanceof HTTPError)) {
56
return new HTTPError(status, message)
67
}

test/integration/acl-oidc-test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
247247
})
248248
})
249249

250-
describe('Origin', function () {
250+
describe.only('Origin', function () {
251251
before(function () {
252252
rm('/accounts-acl/tim.localhost/origin/test-folder/.acl')
253253
})
@@ -332,6 +332,7 @@ describe('ACL with WebID+OIDC over HTTP', function () {
332332
options.headers.origin = origin2
333333

334334
request.head(options, function (error, response, body) {
335+
console.log(response)
335336
assert.equal(error, null)
336337
assert.equal(response.statusCode, 403)
337338
assert.equal(response.statusMessage, 'Origin Unauthorized')

0 commit comments

Comments
 (0)