Skip to content

Commit 95701d9

Browse files
RubenVerborghdmitrizagidulin
authored andcommitted
Only set User header with WebID-TLS.
Closes #523. Breaking change, needs new semver-major.
1 parent 60a14ef commit 95701d9

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

lib/api/authn/index.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,8 @@ function overrideWith (forceUserId) {
1616
}
1717
}
1818

19-
/**
20-
* Sets the `User:` response header if the user has been authenticated.
21-
*/
22-
function setUserHeader (req, res, next) {
23-
let session = req.session
24-
let webId = session.identified && session.userId
25-
26-
res.set('User', webId || '')
27-
next()
28-
}
29-
3019
module.exports = {
3120
oidc: require('./webid-oidc'),
3221
tls: require('./webid-tls'),
33-
overrideWith,
34-
setUserHeader
22+
overrideWith
3523
}

lib/create-app.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ function initAuthentication (argv, app) {
205205
// Enforce authentication with WebID-OIDC on all LDP routes
206206
app.use('/', oidc.rs.authenticate())
207207

208-
app.use('/', API.authn.setUserHeader)
209-
210208
break
211209
default:
212210
throw new TypeError('Unsupported authentication scheme')

test/integration/acl-oidc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ describe('ACL HTTP', function () {
7979
done()
8080
})
8181
})
82-
it('should have `User` set in the Response Header', function (done) {
82+
it('should not have the `User` set in the Response Header', function (done) {
8383
var options = createOptions('/no-acl/', 'user1')
8484
request(options, function (error, response, body) {
8585
assert.equal(error, null)
86-
assert.equal(response.statusCode, 403)
86+
assert.notProperty(response.headers, 'user')
8787
done()
8888
})
8989
})

0 commit comments

Comments
 (0)