@proteinjs/user-server 1.22.4 → 1.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/generated/index.js +1 -1
  3. package/dist/generated/index.js.map +1 -1
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/src/routes/executePasswordReset.js +3 -1
  8. package/dist/src/routes/executePasswordReset.js.map +1 -1
  9. package/dist/src/routes/initiatePasswordReset.d.ts.map +1 -1
  10. package/dist/src/routes/initiatePasswordReset.js +14 -12
  11. package/dist/src/routes/initiatePasswordReset.js.map +1 -1
  12. package/dist/src/routes/login.js +18 -14
  13. package/dist/src/routes/login.js.map +1 -1
  14. package/dist/src/throttle/MemoryThrottleWindowStore.d.ts +28 -0
  15. package/dist/src/throttle/MemoryThrottleWindowStore.d.ts.map +1 -0
  16. package/dist/src/throttle/MemoryThrottleWindowStore.js +108 -0
  17. package/dist/src/throttle/MemoryThrottleWindowStore.js.map +1 -0
  18. package/dist/src/throttle/PasswordResetThrottle.d.ts +9 -8
  19. package/dist/src/throttle/PasswordResetThrottle.d.ts.map +1 -1
  20. package/dist/src/throttle/PasswordResetThrottle.js +63 -15
  21. package/dist/src/throttle/PasswordResetThrottle.js.map +1 -1
  22. package/dist/src/throttle/SignInThrottle.d.ts +21 -15
  23. package/dist/src/throttle/SignInThrottle.d.ts.map +1 -1
  24. package/dist/src/throttle/SignInThrottle.js +94 -25
  25. package/dist/src/throttle/SignInThrottle.js.map +1 -1
  26. package/dist/src/throttle/SlidingWindow.d.ts +6 -4
  27. package/dist/src/throttle/SlidingWindow.d.ts.map +1 -1
  28. package/dist/src/throttle/SlidingWindow.js +6 -4
  29. package/dist/src/throttle/SlidingWindow.js.map +1 -1
  30. package/dist/src/throttle/StoredWindow.d.ts +59 -0
  31. package/dist/src/throttle/StoredWindow.d.ts.map +1 -0
  32. package/dist/src/throttle/StoredWindow.js +209 -0
  33. package/dist/src/throttle/StoredWindow.js.map +1 -0
  34. package/dist/src/throttle/ThrottleWindowStore.d.ts +38 -0
  35. package/dist/src/throttle/ThrottleWindowStore.d.ts.map +1 -0
  36. package/dist/src/throttle/ThrottleWindowStore.js +3 -0
  37. package/dist/src/throttle/ThrottleWindowStore.js.map +1 -0
  38. package/dist/test/MemoryThrottleWindowStore.test.d.ts +2 -0
  39. package/dist/test/MemoryThrottleWindowStore.test.d.ts.map +1 -0
  40. package/dist/test/MemoryThrottleWindowStore.test.js +210 -0
  41. package/dist/test/MemoryThrottleWindowStore.test.js.map +1 -0
  42. package/dist/test/SharedThrottleWindows.integration.test.d.ts +2 -0
  43. package/dist/test/SharedThrottleWindows.integration.test.d.ts.map +1 -0
  44. package/dist/test/SharedThrottleWindows.integration.test.js +756 -0
  45. package/dist/test/SharedThrottleWindows.integration.test.js.map +1 -0
  46. package/dist/test/UserServerTestEnvironment.d.ts.map +1 -1
  47. package/dist/test/UserServerTestEnvironment.js +3 -0
  48. package/dist/test/UserServerTestEnvironment.js.map +1 -1
  49. package/generated/index.ts +1 -1
  50. package/index.ts +4 -0
  51. package/package.json +5 -5
  52. package/src/routes/executePasswordReset.ts +1 -1
  53. package/src/routes/initiatePasswordReset.ts +2 -1
  54. package/src/routes/login.ts +2 -2
  55. package/src/throttle/MemoryThrottleWindowStore.ts +60 -0
  56. package/src/throttle/PasswordResetThrottle.ts +14 -11
  57. package/src/throttle/SignInThrottle.ts +27 -19
  58. package/src/throttle/SlidingWindow.ts +6 -4
  59. package/src/throttle/StoredWindow.ts +132 -0
  60. package/src/throttle/ThrottleWindowStore.ts +41 -0
  61. package/test/MemoryThrottleWindowStore.test.ts +74 -0
  62. package/test/SharedThrottleWindows.integration.test.ts +407 -0
  63. package/test/UserServerTestEnvironment.ts +3 -0
@@ -0,0 +1,407 @@
1
+ import { getDbAsSystem } from '@proteinjs/db';
2
+ import { MailSink } from '@proteinjs/email-server';
3
+ import { SourceRepository } from '@proteinjs/reflection';
4
+ import { tables } from '@proteinjs/user';
5
+ import { RequestDigests as UtilRequestDigests } from '@proteinjs/util-node';
6
+ import { login } from '../src/routes/login';
7
+ import { initiatePasswordReset } from '../src/routes/initiatePasswordReset';
8
+ import { PasswordHasher } from '../src/authentication/PasswordHasher';
9
+ import { PasswordResetToken } from '../src/authentication/PasswordResetToken';
10
+ import { RequestDigests } from '../src/throttle/RequestDigests';
11
+ import { SignInThrottle } from '../src/throttle/SignInThrottle';
12
+ import { PasswordResetThrottle } from '../src/throttle/PasswordResetThrottle';
13
+ import { createPassportRequest } from './passportSessionHarness';
14
+ import { UserServerTestEnvironment } from './UserServerTestEnvironment';
15
+ import { LogCapture } from './LogCapture';
16
+
17
+ const testEnv = new UserServerTestEnvironment();
18
+
19
+ /**
20
+ * The windows keyed on something other than the device — the sign-in door's per-account window
21
+ * and the reset door's per-address window — counted in ONE store that every server process shares
22
+ * (a store registered through `@proteinjs/user-server/DefaultThrottleWindowStoreFactory`), so the
23
+ * count is one across replicas and survives a deploy. Against the Spanner emulator, outcomes only:
24
+ * - two "pods" (the door in this process, and a second process's throttle) count as one: ten wrong
25
+ * passwords through the door, and the second pod refuses the eleventh;
26
+ * - a deploy (a new process with a new store instance over the same backing store) sees the old
27
+ * count, and the window's expiry (its TTL — equal to the window: 15 minutes per account, an hour
28
+ * per reset address) clears it;
29
+ * - a success on one pod clears the account's window for every pod;
30
+ * - the reset door's per-address window is one count across pods;
31
+ * - the store failing or stalling is the NAMED FALLBACK: the door counts in this process's memory
32
+ * window until the store answers again — ten wrong passwords are judged wrong and the eleventh is
33
+ * refused, the right password signs in, a stalled store is judged within its deadline, the reset
34
+ * door still mints and mails — and the outage is one WARN line per window saying so, once however
35
+ * many tries meet it, and one INFO line when the store answers again;
36
+ * - an outage's boundary continues from this process's own count (every try the store answered was
37
+ * counted in memory too): nine wrong in the store, then the store fails, and the eleventh is
38
+ * refused; on recovery the store counts from what it holds (the outage's tries were this
39
+ * process's own and never reach it).
40
+ *
41
+ * The backing store here is a stand-in for the shared one (a map every instance reads and writes,
42
+ * the way every process reads and writes one Redis), with its own clock for the TTL.
43
+ */
44
+
45
+ const WRONG = 'User name or password incorrect';
46
+ const THROTTLED = 'Too many attempts. Try again in a few minutes.';
47
+ const RIGHT_PASSWORD = 'the right horse battery';
48
+ const MINUTE = 60 * 1000;
49
+ const FACTORY = '@proteinjs/user-server/DefaultThrottleWindowStoreFactory';
50
+
51
+ /** Every instance reads and writes one backing map: a new instance is a new process on the same store. */
52
+ class SharedBackingStore {
53
+ static readonly backing = new Map<string, { count: number; expiresAt: number }>();
54
+ /** key → the window (TTL) its first count was given. */
55
+ static readonly windows = new Map<string, number>();
56
+ static now = () => Date.now();
57
+
58
+ async increment(key: string, windowMs: number): Promise<number> {
59
+ const live = this.live(key);
60
+ const entry = live ?? { count: 0, expiresAt: SharedBackingStore.now() + windowMs };
61
+ if (!live) {
62
+ SharedBackingStore.windows.set(key, windowMs);
63
+ }
64
+ entry.count++;
65
+ SharedBackingStore.backing.set(key, entry);
66
+ return entry.count;
67
+ }
68
+
69
+ async read(key: string): Promise<number> {
70
+ return this.live(key)?.count ?? 0;
71
+ }
72
+
73
+ async clear(key: string): Promise<void> {
74
+ SharedBackingStore.backing.delete(key);
75
+ }
76
+
77
+ private live(key: string) {
78
+ const entry = SharedBackingStore.backing.get(key);
79
+ if (entry && entry.expiresAt <= SharedBackingStore.now()) {
80
+ SharedBackingStore.backing.delete(key);
81
+ return undefined;
82
+ }
83
+ return entry;
84
+ }
85
+ }
86
+
87
+ /** A store that is down: every call fails the way a lost connection does. */
88
+ class DownStore {
89
+ async increment(): Promise<number> {
90
+ throw new Error('Connection is closed.');
91
+ }
92
+ async read(): Promise<number> {
93
+ throw new Error('Connection is closed.');
94
+ }
95
+ async clear(): Promise<void> {
96
+ throw new Error('Connection is closed.');
97
+ }
98
+ }
99
+
100
+ /** A store that never answers (a client queueing commands while it reconnects). */
101
+ class StalledStore {
102
+ increment(): Promise<number> {
103
+ return new Promise(() => undefined);
104
+ }
105
+ read(): Promise<number> {
106
+ return new Promise(() => undefined);
107
+ }
108
+ clear(): Promise<void> {
109
+ return new Promise(() => undefined);
110
+ }
111
+ }
112
+
113
+ type SourceRepositoryInternals = { objectCache: Record<string, unknown[]> };
114
+ const register = (store: () => unknown) => {
115
+ (SourceRepository.get() as unknown as SourceRepositoryInternals).objectCache[FACTORY] = [{ getStore: store }];
116
+ };
117
+
118
+ let run = 0;
119
+ /** A fresh address per test, so the counts of one test never meet another's. */
120
+ const address = (label: string) => `shared-${label}-${Date.now()}-${++run}@test.local`;
121
+ let ipSeed = 0;
122
+ /** A fresh client address per try, so the per-device window (per pod, by design) never decides. */
123
+ const freshIp = () => {
124
+ ipSeed++;
125
+ return `10.${(ipSeed >> 16) & 255}.${(ipSeed >> 8) & 255}.${ipSeed & 255}`;
126
+ };
127
+
128
+ type Attempt = { sent: any; signedInAs?: string };
129
+
130
+ /** One sign-in try through pod A's door (this process's `POST /user/login`). */
131
+ const signIn = async (email: string, password: string, ip = freshIp()): Promise<Attempt> => {
132
+ let sent: any;
133
+ const response: any = {
134
+ send: (body: any) => {
135
+ sent = body;
136
+ },
137
+ status: () => response,
138
+ };
139
+ const { request } = await createPassportRequest({
140
+ body: { email, password },
141
+ headers: {},
142
+ socket: { remoteAddress: ip },
143
+ app: { get: () => false },
144
+ });
145
+ await login.onRequest(request, response);
146
+ return { sent, signedInAs: request.session.passport?.user };
147
+ };
148
+
149
+ const wrongTries = async (count: number, email: string) => {
150
+ const answers: string[] = [];
151
+ for (let i = 0; i < count; i++) {
152
+ answers.push((await signIn(email, 'wrong guess')).sent?.error);
153
+ }
154
+ return answers;
155
+ };
156
+
157
+ /** One reset request through pod A's door (`POST /user/initiate-password-reset`). */
158
+ const requestReset = async (email: string, ip = freshIp()) => {
159
+ let sent: any;
160
+ const response: any = {
161
+ send: (body: any) => {
162
+ sent = body;
163
+ },
164
+ status: () => response,
165
+ };
166
+ await initiatePasswordReset.onRequest(
167
+ { body: { email }, headers: {}, socket: { remoteAddress: ip }, app: { get: () => false } } as never,
168
+ response
169
+ );
170
+ // The door answers first and works after; let the work settle before reading the row.
171
+ await new Promise((resolve) => setTimeout(resolve, 300));
172
+ return sent;
173
+ };
174
+
175
+ const createAccount = async (email: string) => {
176
+ const user = await testEnv.createUser({ name: 'Shared Window User', email });
177
+ await getDbAsSystem().update(tables.User, { id: user.id, password: await new PasswordHasher().hash(RIGHT_PASSWORD) });
178
+ return user;
179
+ };
180
+
181
+ const coarseIp = () => new RequestDigests().coarseIp(freshIp());
182
+
183
+ describe('the account and reset-address windows, one count across server processes', () => {
184
+ const originalTransport = process.env.EMAIL_TRANSPORT;
185
+
186
+ beforeAll(async () => {
187
+ await testEnv.beforeAll();
188
+ const objectCache = (SourceRepository.get() as unknown as SourceRepositoryInternals).objectCache;
189
+ objectCache['@proteinjs/email-server/DefaultEmailConfigFactory'] = [
190
+ {
191
+ getEmailConfig: () => ({
192
+ host: 'smtp.test.local',
193
+ port: 465,
194
+ secure: true,
195
+ from: '"Example" <hi@example.com>',
196
+ }),
197
+ },
198
+ ];
199
+ objectCache['@proteinjs/email-server/DefaultPasswordResetEmailConfigFactory'] = [
200
+ { getConfig: () => ({ getEmailContent: (path: string) => ({ text: `Reset: https://app.test.local/${path}` }) }) },
201
+ ];
202
+ process.env.EMAIL_TRANSPORT = 'sink';
203
+ }, 120000);
204
+
205
+ beforeEach(() => {
206
+ SharedBackingStore.now = () => Date.now();
207
+ register(() => new SharedBackingStore());
208
+ });
209
+
210
+ afterAll(async () => {
211
+ delete (SourceRepository.get() as unknown as SourceRepositoryInternals).objectCache[FACTORY];
212
+ if (originalTransport === undefined) {
213
+ delete process.env.EMAIL_TRANSPORT;
214
+ } else {
215
+ process.env.EMAIL_TRANSPORT = originalTransport;
216
+ }
217
+ await testEnv.afterAll();
218
+ });
219
+
220
+ it('two pods count as one: ten wrong passwords through the door, and the second pod refuses the eleventh', async () => {
221
+ const email = address('two-pods');
222
+ await createAccount(email);
223
+ const podB = new SignInThrottle();
224
+
225
+ expect(await wrongTries(10, email)).toEqual(Array(10).fill(WRONG));
226
+
227
+ expect(await podB.admit(coarseIp(), new RequestDigests().account(email))).toBe('account');
228
+ // And back through the door: the right password is refused too, and no session is made.
229
+ const right = await signIn(email, RIGHT_PASSWORD);
230
+ expect(right.sent).toEqual({ error: THROTTLED });
231
+ expect(right.signedInAs).toBeUndefined();
232
+ });
233
+
234
+ it('interleaved across two pods, the eleventh wrong password is refused wherever it lands', async () => {
235
+ const email = address('interleaved');
236
+ const account = new RequestDigests().account(email);
237
+ const podB = new SignInThrottle();
238
+
239
+ for (let i = 0; i < 5; i++) {
240
+ expect((await signIn(email, 'wrong guess')).sent).toEqual({ error: WRONG });
241
+ expect(await podB.admit(coarseIp(), account)).toBeUndefined();
242
+ }
243
+
244
+ expect((await signIn(email, 'wrong guess')).sent).toEqual({ error: THROTTLED });
245
+ });
246
+
247
+ it('a deploy sees the old count (a new process, a new store instance, the same store) — and the window’s expiry clears it', async () => {
248
+ const email = address('deploy');
249
+ const account = new RequestDigests().account(email);
250
+ expect(await wrongTries(10, email)).toEqual(Array(10).fill(WRONG));
251
+
252
+ const afterDeploy = new SignInThrottle();
253
+ expect(await afterDeploy.admit(coarseIp(), account)).toBe('account');
254
+
255
+ // The TTL is the window: fifteen minutes after the first counted try, the count is gone.
256
+ const counted = Array.from(SharedBackingStore.windows.entries()).filter(([key]) => key.includes(account));
257
+ expect(counted.map(([, windowMs]) => windowMs)).toEqual([15 * MINUTE]);
258
+ const start = Date.now();
259
+ SharedBackingStore.now = () => start + 15 * MINUTE + 1;
260
+ expect(await afterDeploy.admit(coarseIp(), account)).toBeUndefined();
261
+ });
262
+
263
+ it("a success on one pod clears the account's window for every pod", async () => {
264
+ const email = address('cleared');
265
+ await createAccount(email);
266
+ const account = new RequestDigests().account(email);
267
+ const podB = new SignInThrottle();
268
+ expect(await wrongTries(9, email)).toEqual(Array(9).fill(WRONG));
269
+
270
+ // Pod B sees the account prove itself (a sign-in there, or a reset link redeemed there).
271
+ await podB.recordSuccess(account);
272
+
273
+ expect(await wrongTries(10, email)).toEqual(Array(10).fill(WRONG));
274
+ expect((await signIn(email, 'wrong guess')).sent).toEqual({ error: THROTTLED });
275
+ });
276
+
277
+ it("the reset door's per-address window is one count across pods, with the hour as its TTL", async () => {
278
+ const email = address('reset');
279
+ await createAccount(email);
280
+ const account = new UtilRequestDigests().account(email);
281
+ const podB = new PasswordResetThrottle();
282
+
283
+ for (let i = 0; i < 3; i++) {
284
+ await requestReset(email);
285
+ }
286
+
287
+ expect(await podB.admit(new UtilRequestDigests().coarseIp(freshIp()), account)).toBe('account');
288
+ const counted = Array.from(SharedBackingStore.windows.entries()).filter(([key]) => key.includes(account));
289
+ expect(counted.map(([, windowMs]) => windowMs)).toEqual([60 * MINUTE]);
290
+ });
291
+
292
+ it('windows sharing one store never meet: three reset requests for an address leave its ten sign-in tries whole', async () => {
293
+ const email = address('never-meet');
294
+ await createAccount(email);
295
+
296
+ for (let i = 0; i < 3; i++) {
297
+ await requestReset(email);
298
+ }
299
+
300
+ expect(await wrongTries(10, email)).toEqual(Array(10).fill(WRONG));
301
+ expect((await signIn(email, 'wrong guess')).sent).toEqual({ error: THROTTLED });
302
+ });
303
+
304
+ describe("when the store fails, the counted doors count in this process's memory until it answers", () => {
305
+ it('a store that is down: the right password signs in, ten wrong passwords are judged wrong, the eleventh is refused (the right password too, no session) — one WARN saying so until the store answers again', async () => {
306
+ const email = address('down');
307
+ await createAccount(email);
308
+ register(() => new DownStore());
309
+
310
+ const log = await LogCapture.during(async () => {
311
+ const first = await signIn(email, RIGHT_PASSWORD);
312
+ expect(first.sent).toEqual({});
313
+ expect(first.signedInAs).toBe(email);
314
+ expect(await wrongTries(10, email)).toEqual(Array(10).fill(WRONG));
315
+ const eleventh = await signIn(email, RIGHT_PASSWORD);
316
+ expect(eleventh.sent).toEqual({ error: THROTTLED });
317
+ expect(eleventh.signedInAs).toBeUndefined();
318
+ });
319
+ const unavailable = log.linesContaining('Throttle window store unavailable');
320
+ expect(unavailable.lines).toHaveLength(1);
321
+ expect(unavailable.text).toContain("counting in this process's memory until it answers");
322
+ expect(unavailable.text).toContain('sign-in-account');
323
+ expect(log.addresses).toEqual([]);
324
+
325
+ // The store answers again: the door counts there again (the outage's tries were this process's
326
+ // own), the right password signs in — and its success clears the memory window too.
327
+ register(() => new SharedBackingStore());
328
+ const recovered = await LogCapture.during(async () => {
329
+ const right = await signIn(email, RIGHT_PASSWORD);
330
+ expect(right.sent).toEqual({});
331
+ expect(right.signedInAs).toBe(email);
332
+ });
333
+ expect(recovered.linesContaining('Throttle window store answering again').lines).toHaveLength(1);
334
+
335
+ // The next outage is its own line, and the memory window starts clean.
336
+ register(() => new DownStore());
337
+ const again = await LogCapture.during(async () => {
338
+ expect((await signIn(email, 'wrong guess')).sent).toEqual({ error: WRONG });
339
+ });
340
+ expect(again.linesContaining('Throttle window store unavailable').lines).toHaveLength(1);
341
+ });
342
+
343
+ it("the store fails after nine wrong tries: the memory window continues from this process's own nine — the tenth is judged wrong, the eleventh refused; one WARN", async () => {
344
+ const email = address('boundary');
345
+ await createAccount(email);
346
+ expect(await wrongTries(9, email)).toEqual(Array(9).fill(WRONG));
347
+
348
+ register(() => new DownStore());
349
+ const log = await LogCapture.during(async () => {
350
+ expect(await wrongTries(2, email)).toEqual([WRONG, THROTTLED]);
351
+ const right = await signIn(email, RIGHT_PASSWORD);
352
+ expect(right.sent).toEqual({ error: THROTTLED });
353
+ expect(right.signedInAs).toBeUndefined();
354
+ });
355
+ expect(log.linesContaining('Throttle window store unavailable').lines).toHaveLength(1);
356
+ expect(log.addresses).toEqual([]);
357
+ });
358
+
359
+ it("on recovery the store counts from what it holds: the outage's five wrong tries never reach the shared count (ten fresh before the refusal, one INFO) — and this process's own count, kept all along, refuses at once in the next outage", async () => {
360
+ const email = address('recovery');
361
+ await createAccount(email);
362
+ register(() => new DownStore());
363
+ expect(await wrongTries(5, email)).toEqual(Array(5).fill(WRONG));
364
+
365
+ register(() => new SharedBackingStore());
366
+ const recovered = await LogCapture.during(async () => {
367
+ expect(await wrongTries(11, email)).toEqual([...Array(10).fill(WRONG), THROTTLED]);
368
+ });
369
+ expect(recovered.linesContaining('Throttle window store answering again').lines).toHaveLength(1);
370
+
371
+ // Sixteen tries met this process within the window (five in the outage, eleven while the store
372
+ // answered): when the store fails again, memory judges from all sixteen.
373
+ register(() => new DownStore());
374
+ expect((await signIn(email, 'wrong guess')).sent).toEqual({ error: THROTTLED });
375
+ });
376
+
377
+ it('a store that never answers: the door judges the try within the store deadline — not never, and not a refusal', async () => {
378
+ const email = address('stalled');
379
+ register(() => new StalledStore());
380
+
381
+ const started = Date.now();
382
+ const answer = await signIn(email, 'wrong guess');
383
+
384
+ expect(answer.sent).toEqual({ error: WRONG });
385
+ expect(Date.now() - started).toBeLessThan(5000);
386
+ });
387
+
388
+ it('the reset door with the store down: the one answer as always, AND the link minted and mailed', async () => {
389
+ const email = address('reset-down');
390
+ const user = await createAccount(email);
391
+ register(() => new DownStore());
392
+ MailSink.get().clear();
393
+
394
+ expect(await requestReset(email)).toEqual({
395
+ message: 'If that address has an account, a reset link is on its way.',
396
+ });
397
+
398
+ const row = await getDbAsSystem().get(tables.User, { id: user.id });
399
+ expect(new PasswordResetToken().mintedAt(row)).toBeDefined();
400
+ expect(
401
+ MailSink.get()
402
+ .list()
403
+ .map((mail) => mail.to)
404
+ ).toEqual([[email]]);
405
+ });
406
+ });
407
+ });
@@ -50,6 +50,9 @@ export class UserServerTestEnvironment {
50
50
  const objectCache = (SourceRepository.get() as unknown as SourceRepositoryInternals).objectCache;
51
51
  objectCache['@proteinjs/server-api/SessionDataStorage'] = [new TestSessionDataStorage()];
52
52
  objectCache['@proteinjs/db/DefaultDbDriverFactory'] = [{ getDbDriver: () => this.spannerDriver }];
53
+ // No shared window store registered: the counted throttle windows use the library's own
54
+ // per-process store (the suites load src, never the generated source graph).
55
+ objectCache['@proteinjs/user-server/DefaultThrottleWindowStoreFactory'] = [];
53
56
  Session.setData({
54
57
  sessionId: 'test-session',
55
58
  user: 'guest',