Skip to content

Commit 4ea6121

Browse files
Don't return actorId from /v1/sessions/restore (#1480)
1 parent 4f5177b commit 4ea6121

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/resources/sessions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
const { verifyPassword } = require('../util/crypto');
1111
const Problem = require('../util/problem');
12-
const { isBlank, noargs, omit } = require('../util/util');
12+
const { isBlank, noargs } = require('../util/util');
1313
const { getOrReject, rejectIf } = require('../util/promise');
1414
const { success } = require('../util/http');
1515
const { SESSION_COOKIE, createUserSession } = require('../http/sessions');
1616
const oidc = require('../util/oidc');
17-
const { partial } = require('ramda');
17+
const { pick } = require('ramda');
1818

1919
module.exports = (service, endpoint, anonymousEndpoint) => {
2020

@@ -44,7 +44,7 @@ module.exports = (service, endpoint, anonymousEndpoint) => {
4444

4545
service.get('/sessions/restore', endpoint((_, { auth }) =>
4646
auth.session
47-
.map(partial(omit, [['token', 'csrf']]))
47+
.map(pick(['createdAt', 'expiresAt']))
4848
.orElse(Problem.user.notFound())));
4949

5050
const logOut = (Sessions, auth, session) =>

test/assertions.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,11 @@ should.Assertion.add('ExtendedSubmissionDef', function() {
143143
should.Assertion.add('Session', function() {
144144
this.params = { operator: 'to be a Session' };
145145

146-
Object.keys(this.obj).should.containDeep([ 'expiresAt', 'createdAt', 'token' ]);
146+
Object.keys(this.obj).should.eqlInAnyOrder([ 'expiresAt', 'createdAt', 'token', 'csrf' ]);
147147
this.obj.expiresAt.should.be.an.isoDate();
148148
this.obj.createdAt.should.be.an.isoDate();
149149
this.obj.token.should.be.a.token();
150+
this.obj.csrf.should.be.a.token();
150151
});
151152

152153
should.Assertion.add('FieldKey', function() {

test/integration/api/sessions.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ describe('api: /sessions', () => {
171171
.set('Cookie', 'session=' + token)
172172
.expect(200)
173173
.then((restore) => {
174+
Object.keys(restore.body).should.eqlInAnyOrder(['createdAt', 'expiresAt']);
174175
restore.body.expiresAt.should.be.an.isoDate();
175176
restore.body.createdAt.should.be.an.isoDate();
176177
should(restore.body.token).be.undefined();

0 commit comments

Comments
 (0)