@whook/oauth2 18.0.3 → 19.0.0

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 (112) hide show
  1. package/README.md +36 -46
  2. package/dist/index.d.ts +8 -8
  3. package/dist/index.js +6 -6
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.test.js +19 -18
  6. package/dist/index.test.js.map +1 -1
  7. package/dist/routes/getOAuth2Authorize.d.ts +100 -0
  8. package/dist/{handlers → routes}/getOAuth2Authorize.js +39 -36
  9. package/dist/routes/getOAuth2Authorize.js.map +1 -0
  10. package/dist/{handlers → routes}/getOAuth2Authorize.test.js +14 -10
  11. package/dist/routes/getOAuth2Authorize.test.js.map +1 -0
  12. package/dist/routes/postAuthLogin.d.ts +89 -0
  13. package/dist/{handlers → routes}/postAuthLogin.js +40 -39
  14. package/dist/routes/postAuthLogin.js.map +1 -0
  15. package/dist/routes/postAuthLogin.test.js.map +1 -0
  16. package/dist/routes/postAuthLogout.d.ts +28 -0
  17. package/dist/{handlers → routes}/postAuthLogout.js +9 -9
  18. package/dist/routes/postAuthLogout.js.map +1 -0
  19. package/dist/{handlers → routes}/postAuthLogout.test.js +1 -1
  20. package/dist/routes/postAuthLogout.test.js.map +1 -0
  21. package/dist/routes/postAuthRefresh.d.ts +94 -0
  22. package/dist/{handlers → routes}/postAuthRefresh.js +43 -42
  23. package/dist/routes/postAuthRefresh.js.map +1 -0
  24. package/dist/routes/postAuthRefresh.test.js.map +1 -0
  25. package/dist/routes/postOAuth2Acknowledge.d.ts +97 -0
  26. package/dist/{handlers → routes}/postOAuth2Acknowledge.js +46 -44
  27. package/dist/routes/postOAuth2Acknowledge.js.map +1 -0
  28. package/dist/routes/postOAuth2Acknowledge.test.js.map +1 -0
  29. package/dist/routes/postOAuth2Token.d.ts +198 -0
  30. package/dist/{handlers → routes}/postOAuth2Token.js +36 -34
  31. package/dist/routes/postOAuth2Token.js.map +1 -0
  32. package/dist/routes/postOAuth2Token.test.js.map +1 -0
  33. package/dist/services/authCookies.d.ts +3 -3
  34. package/dist/services/authCookies.js.map +1 -1
  35. package/dist/services/oAuth2ClientCredentialsGranter.d.ts +8 -8
  36. package/dist/services/oAuth2ClientCredentialsGranter.js.map +1 -1
  37. package/dist/services/oAuth2CodeGranter.d.ts +4 -5
  38. package/dist/services/oAuth2CodeGranter.js +2 -0
  39. package/dist/services/oAuth2CodeGranter.js.map +1 -1
  40. package/dist/services/oAuth2CodeGranter.test.js +2 -2
  41. package/dist/services/oAuth2CodeGranter.test.js.map +1 -1
  42. package/dist/services/oAuth2Granters.d.ts +25 -25
  43. package/dist/services/oAuth2Granters.js +1 -1
  44. package/dist/services/oAuth2Granters.js.map +1 -1
  45. package/dist/services/oAuth2PasswordGranter.d.ts +4 -5
  46. package/dist/services/oAuth2PasswordGranter.js.map +1 -1
  47. package/dist/services/oAuth2RefreshTokenGranter.d.ts +4 -5
  48. package/dist/services/oAuth2RefreshTokenGranter.js.map +1 -1
  49. package/dist/services/oAuth2TokenGranter.d.ts +4 -5
  50. package/dist/services/oAuth2TokenGranter.js +4 -0
  51. package/dist/services/oAuth2TokenGranter.js.map +1 -1
  52. package/package.json +10 -9
  53. package/src/__snapshots__/index.test.ts.snap +1 -0
  54. package/src/index.test.ts +39 -52
  55. package/src/index.ts +20 -20
  56. package/src/{handlers → routes}/getOAuth2Authorize.test.ts +18 -14
  57. package/src/routes/getOAuth2Authorize.ts +217 -0
  58. package/src/{handlers → routes}/postAuthLogin.test.ts +3 -2
  59. package/src/routes/postAuthLogin.ts +118 -0
  60. package/src/{handlers → routes}/postAuthLogout.test.ts +2 -2
  61. package/src/routes/postAuthLogout.ts +38 -0
  62. package/src/{handlers → routes}/postAuthRefresh.test.ts +3 -2
  63. package/src/routes/postAuthRefresh.ts +138 -0
  64. package/src/{handlers → routes}/postOAuth2Acknowledge.test.ts +23 -39
  65. package/src/{handlers → routes}/postOAuth2Acknowledge.ts +88 -96
  66. package/src/{handlers → routes}/postOAuth2Token.test.ts +12 -11
  67. package/src/{handlers → routes}/postOAuth2Token.ts +124 -129
  68. package/src/services/authCookies.test.ts +1 -1
  69. package/src/services/authCookies.ts +3 -5
  70. package/src/services/oAuth2ClientCredentialsGranter.ts +10 -15
  71. package/src/services/oAuth2CodeGranter.test.ts +12 -21
  72. package/src/services/oAuth2CodeGranter.ts +9 -11
  73. package/src/services/oAuth2Granters.ts +35 -57
  74. package/src/services/oAuth2PasswordGranter.ts +7 -11
  75. package/src/services/oAuth2RefreshTokenGranter.ts +7 -11
  76. package/src/services/oAuth2TokenGranter.ts +12 -12
  77. package/src/types.d.ts +7 -0
  78. package/dist/handlers/getOAuth2Authorize.d.ts +0 -27
  79. package/dist/handlers/getOAuth2Authorize.js.map +0 -1
  80. package/dist/handlers/getOAuth2Authorize.test.js.map +0 -1
  81. package/dist/handlers/postAuthLogin.d.ts +0 -28
  82. package/dist/handlers/postAuthLogin.js.map +0 -1
  83. package/dist/handlers/postAuthLogin.test.js.map +0 -1
  84. package/dist/handlers/postAuthLogout.d.ts +0 -12
  85. package/dist/handlers/postAuthLogout.js.map +0 -1
  86. package/dist/handlers/postAuthLogout.test.js.map +0 -1
  87. package/dist/handlers/postAuthRefresh.d.ts +0 -28
  88. package/dist/handlers/postAuthRefresh.js.map +0 -1
  89. package/dist/handlers/postAuthRefresh.test.js.map +0 -1
  90. package/dist/handlers/postOAuth2Acknowledge.d.ts +0 -31
  91. package/dist/handlers/postOAuth2Acknowledge.js.map +0 -1
  92. package/dist/handlers/postOAuth2Acknowledge.test.js.map +0 -1
  93. package/dist/handlers/postOAuth2Token.d.ts +0 -36
  94. package/dist/handlers/postOAuth2Token.js.map +0 -1
  95. package/dist/handlers/postOAuth2Token.test.js.map +0 -1
  96. package/src/handlers/getOAuth2Authorize.ts +0 -214
  97. package/src/handlers/postAuthLogin.ts +0 -123
  98. package/src/handlers/postAuthLogout.ts +0 -38
  99. package/src/handlers/postAuthRefresh.ts +0 -143
  100. /package/dist/{handlers → routes}/getOAuth2Authorize.test.d.ts +0 -0
  101. /package/dist/{handlers → routes}/postAuthLogin.test.d.ts +0 -0
  102. /package/dist/{handlers → routes}/postAuthLogin.test.js +0 -0
  103. /package/dist/{handlers → routes}/postAuthLogout.test.d.ts +0 -0
  104. /package/dist/{handlers → routes}/postAuthRefresh.test.d.ts +0 -0
  105. /package/dist/{handlers → routes}/postAuthRefresh.test.js +0 -0
  106. /package/dist/{handlers → routes}/postOAuth2Acknowledge.test.d.ts +0 -0
  107. /package/dist/{handlers → routes}/postOAuth2Acknowledge.test.js +0 -0
  108. /package/dist/{handlers → routes}/postOAuth2Token.test.d.ts +0 -0
  109. /package/dist/{handlers → routes}/postOAuth2Token.test.js +0 -0
  110. /package/src/{handlers → routes}/__snapshots__/getOAuth2Authorize.test.ts.snap +0 -0
  111. /package/src/{handlers → routes}/__snapshots__/postOAuth2Acknowledge.test.ts.snap +0 -0
  112. /package/src/{handlers → routes}/__snapshots__/postOAuth2Token.test.ts.snap +0 -0
@@ -3,16 +3,11 @@ import initPostOAuth2Acknowledge from './postOAuth2Acknowledge.js';
3
3
  import { YError } from 'yerror';
4
4
  import { DEFAULT_ERRORS_DESCRIPTORS } from '@whook/whook';
5
5
  import { OAUTH2_ERRORS_DESCRIPTORS } from '../services/oAuth2Granters.js';
6
- import type { CheckApplicationService } from '../services/oAuth2Granters.js';
7
- import type { LogService } from 'common-services';
8
- import type { OAuth2GranterService } from '../services/oAuth2Granters.js';
9
- import type { BaseAuthenticationData } from '@whook/authorization';
10
- import type { OAuth2CodeGranterService } from '../services/oAuth2CodeGranter.js';
11
- import type { OAuth2TokenGranterService } from '../services/oAuth2TokenGranter.js';
12
-
13
- type CustomAuthenticationData = BaseAuthenticationData & {
14
- userId: string;
15
- };
6
+ import { type CheckApplicationService } from '../services/oAuth2Granters.js';
7
+ import { type LogService } from 'common-services';
8
+ import { type OAuth2GranterService } from '../services/oAuth2Granters.js';
9
+ import { type OAuth2CodeGranterService } from '../services/oAuth2CodeGranter.js';
10
+ import { type OAuth2TokenGranterService } from '../services/oAuth2TokenGranter.js';
16
11
 
17
12
  describe('postOAuth2Acknowledge', () => {
18
13
  const ERRORS_DESCRIPTORS = {
@@ -27,27 +22,21 @@ describe('postOAuth2Acknowledge', () => {
27
22
  responseType: 'code',
28
23
  authorize:
29
24
  jest.fn<
30
- NonNullable<
31
- OAuth2CodeGranterService<CustomAuthenticationData>['authorizer']
32
- >['authorize']
25
+ NonNullable<OAuth2CodeGranterService['authorizer']>['authorize']
33
26
  >(),
34
27
  },
35
28
  acknowledger: {
36
29
  acknowledgmentType: 'code',
37
30
  acknowledge:
38
31
  jest.fn<
39
- NonNullable<
40
- OAuth2CodeGranterService<CustomAuthenticationData>['acknowledger']
41
- >['acknowledge']
32
+ NonNullable<OAuth2CodeGranterService['acknowledger']>['acknowledge']
42
33
  >(),
43
34
  },
44
35
  authenticator: {
45
36
  grantType: 'authorization_code',
46
37
  authenticate:
47
38
  jest.fn<
48
- NonNullable<
49
- OAuth2CodeGranterService<CustomAuthenticationData>['authenticator']
50
- >['authenticate']
39
+ NonNullable<OAuth2CodeGranterService['authenticator']>['authenticate']
51
40
  >(),
52
41
  },
53
42
  };
@@ -58,7 +47,7 @@ describe('postOAuth2Acknowledge', () => {
58
47
  authorize:
59
48
  jest.fn<
60
49
  NonNullable<
61
- OAuth2TokenGranterService<CustomAuthenticationData>['authenticator']
50
+ OAuth2TokenGranterService['authenticator']
62
51
  >['authenticate']
63
52
  >(),
64
53
  },
@@ -66,9 +55,7 @@ describe('postOAuth2Acknowledge', () => {
66
55
  acknowledgmentType: 'token',
67
56
  acknowledge:
68
57
  jest.fn<
69
- NonNullable<
70
- OAuth2TokenGranterService<CustomAuthenticationData>['acknowledger']
71
- >['acknowledge']
58
+ NonNullable<OAuth2TokenGranterService['acknowledger']>['acknowledge']
72
59
  >(),
73
60
  },
74
61
  };
@@ -78,8 +65,7 @@ describe('postOAuth2Acknowledge', () => {
78
65
  ] as unknown as OAuth2GranterService<
79
66
  Record<string, unknown>,
80
67
  Record<string, unknown>,
81
- Record<string, unknown>,
82
- CustomAuthenticationData
68
+ Record<string, unknown>
83
69
  >[];
84
70
 
85
71
  beforeEach(() => {
@@ -110,13 +96,12 @@ describe('postOAuth2Acknowledge', () => {
110
96
  userId: '1',
111
97
  });
112
98
 
113
- const postOAuth2Acknowledge =
114
- await initPostOAuth2Acknowledge<CustomAuthenticationData>({
115
- ERRORS_DESCRIPTORS,
116
- oAuth2Granters,
117
- checkApplication,
118
- log,
119
- });
99
+ const postOAuth2Acknowledge = await initPostOAuth2Acknowledge({
100
+ ERRORS_DESCRIPTORS,
101
+ oAuth2Granters,
102
+ checkApplication,
103
+ log,
104
+ });
120
105
  const response = await postOAuth2Acknowledge({
121
106
  authenticationData: {
122
107
  applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
@@ -171,13 +156,12 @@ describe('postOAuth2Acknowledge', () => {
171
156
  mock.mockRejectedValueOnce(new YError('E_NOT_SUPPOSED_TO_BE_HERE')),
172
157
  );
173
158
 
174
- const postOAuth2Acknowledge =
175
- await initPostOAuth2Acknowledge<CustomAuthenticationData>({
176
- ERRORS_DESCRIPTORS,
177
- oAuth2Granters,
178
- checkApplication,
179
- log,
180
- });
159
+ const postOAuth2Acknowledge = await initPostOAuth2Acknowledge({
160
+ ERRORS_DESCRIPTORS,
161
+ oAuth2Granters,
162
+ checkApplication,
163
+ log,
164
+ });
181
165
  const response = await postOAuth2Acknowledge({
182
166
  authenticationData: {
183
167
  applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
@@ -1,33 +1,33 @@
1
- import { autoHandler, location } from 'knifecycle';
1
+ import { autoService, location } from 'knifecycle';
2
2
  import { printStackTrace, YError } from 'yerror';
3
3
  import { setURLError } from './getOAuth2Authorize.js';
4
- import type {
5
- WhookAPIHandlerDefinition,
6
- WhookErrorsDescriptors,
4
+ import {
5
+ type WhookRouteDefinition,
6
+ type WhookErrorsDescriptors,
7
7
  } from '@whook/whook';
8
- import type {
9
- CheckApplicationService,
10
- OAuth2GranterService,
8
+ import {
9
+ type CheckApplicationService,
10
+ type OAuth2GranterService,
11
11
  } from '../services/oAuth2Granters.js';
12
- import type { LogService } from 'common-services';
13
- import type { BaseAuthenticationData } from '@whook/authorization';
12
+ import { type LogService } from 'common-services';
13
+ import { type WhookAuthenticationData } from '@whook/authorization';
14
14
 
15
15
  /* Architecture Note #2: OAuth2 acknowledge
16
16
  This endpoint is to be used by the authentication SSR frontend
17
17
  to acknowlege that the user accepted the client request in it.
18
18
  */
19
19
 
20
- export const definition: WhookAPIHandlerDefinition = {
20
+ export const definition = {
21
21
  method: 'post',
22
22
  path: '/oauth2/acknowledge',
23
+ config: {
24
+ private: true,
25
+ },
23
26
  operation: {
24
27
  operationId: 'postOAuth2Acknowledge',
25
28
  summary: `Implements the logic that allow the authentication frontend
26
29
  to get the [Redirection Endpoint](https://tools.ietf.org/html/rfc6749#section-3.1.2).`,
27
30
  tags: ['oauth2'],
28
- 'x-whook': {
29
- private: true,
30
- },
31
31
  requestBody: {
32
32
  required: true,
33
33
  content: {
@@ -93,23 +93,20 @@ export const definition: WhookAPIHandlerDefinition = {
93
93
  },
94
94
  },
95
95
  },
96
- };
96
+ } as const satisfies WhookRouteDefinition;
97
97
 
98
- export type HandlerDependencies<
99
- AUTHENTICATION_DATA extends BaseAuthenticationData<string, string>,
100
- > = {
98
+ export type HandlerDependencies = {
101
99
  ERRORS_DESCRIPTORS: WhookErrorsDescriptors;
102
100
  oAuth2Granters: OAuth2GranterService<
103
101
  Record<string, unknown>,
104
102
  Record<string, unknown>,
105
- Record<string, unknown>,
106
- AUTHENTICATION_DATA
103
+ Record<string, unknown>
107
104
  >[];
108
105
  checkApplication: CheckApplicationService;
109
106
  log: LogService;
110
107
  };
111
- type HandlerParameters<AUTHENTICATION_DATA> = {
112
- authenticationData: AUTHENTICATION_DATA;
108
+ type HandlerParameters = {
109
+ authenticationData: WhookAuthenticationData;
113
110
  body: {
114
111
  responseType: string;
115
112
  clientId: string;
@@ -122,26 +119,21 @@ type HandlerParameters<AUTHENTICATION_DATA> = {
122
119
  };
123
120
 
124
121
  export default location(
125
- autoHandler(postOAuth2Acknowledge),
122
+ autoService(initPostOAuth2Acknowledge),
126
123
  import.meta.url,
127
- ) as unknown as <
128
- AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,
129
- >(
130
- dependencies: HandlerDependencies<AUTHENTICATION_DATA>,
124
+ ) as unknown as (
125
+ dependencies: HandlerDependencies,
131
126
  ) => (
132
- parameters: HandlerParameters<AUTHENTICATION_DATA>,
133
- ) => ReturnType<typeof postOAuth2Acknowledge>;
127
+ parameters: HandlerParameters,
128
+ ) => ReturnType<typeof initPostOAuth2Acknowledge>;
134
129
 
135
- async function postOAuth2Acknowledge<
136
- AUTHENTICATION_DATA extends BaseAuthenticationData = BaseAuthenticationData,
137
- >(
138
- {
139
- ERRORS_DESCRIPTORS,
140
- oAuth2Granters,
141
- checkApplication,
142
- log,
143
- }: HandlerDependencies<AUTHENTICATION_DATA>,
144
- {
130
+ async function initPostOAuth2Acknowledge({
131
+ ERRORS_DESCRIPTORS,
132
+ oAuth2Granters,
133
+ checkApplication,
134
+ log,
135
+ }: HandlerDependencies) {
136
+ return async ({
145
137
  authenticationData,
146
138
  body: {
147
139
  responseType,
@@ -152,73 +144,73 @@ async function postOAuth2Acknowledge<
152
144
  acknowledged = false,
153
145
  ...additionalParameters
154
146
  },
155
- }: HandlerParameters<AUTHENTICATION_DATA>,
156
- ) {
157
- if (!authenticationData) {
158
- throw new YError('E_UNAUTHORIZED');
159
- }
147
+ }: HandlerParameters) => {
148
+ if (!authenticationData) {
149
+ throw new YError('E_UNAUTHORIZED');
150
+ }
160
151
 
161
- // Here we check the applicationId has the right to authenticate a user
162
- // with the special type 'root'
163
- await checkApplication({
164
- applicationId: authenticationData.applicationId,
165
- type: 'root',
166
- scope: '',
167
- });
152
+ // Here we check the applicationId has the right to authenticate a user
153
+ // with the special type 'root'
154
+ await checkApplication({
155
+ applicationId: authenticationData.applicationId,
156
+ type: 'root',
157
+ scope: '',
158
+ });
168
159
 
169
- const url = new URL(redirectURI);
160
+ const url = new URL(redirectURI);
170
161
 
171
- try {
172
- if (!acknowledged) {
173
- throw new YError('E_ACCESS_DENIED', clientId);
174
- }
162
+ try {
163
+ if (!acknowledged) {
164
+ throw new YError('E_ACCESS_DENIED', clientId);
165
+ }
175
166
 
176
- const granter = oAuth2Granters.find(
177
- (granter) =>
178
- granter.acknowledger &&
179
- granter.acknowledger.acknowledgmentType === responseType,
180
- );
167
+ const granter = oAuth2Granters.find(
168
+ (granter) =>
169
+ granter.acknowledger &&
170
+ granter.acknowledger.acknowledgmentType === responseType,
171
+ );
181
172
 
182
- if (!granter || !granter.acknowledger) {
183
- throw new YError('E_UNKNOWN_ACKNOWLEDGOR_TYPE', responseType);
184
- }
173
+ if (!granter || !granter.acknowledger) {
174
+ throw new YError('E_UNKNOWN_ACKNOWLEDGOR_TYPE', responseType);
175
+ }
185
176
 
186
- const { applicationId, scope, ...additionalProperties } =
187
- await granter.acknowledger.acknowledge(
188
- authenticationData,
189
- {
190
- clientId,
191
- redirectURI,
192
- scope: demandedScope,
193
- },
194
- additionalParameters,
195
- );
177
+ const { applicationId, scope, ...additionalProperties } =
178
+ await granter.acknowledger.acknowledge(
179
+ authenticationData,
180
+ {
181
+ clientId,
182
+ redirectURI,
183
+ scope: demandedScope,
184
+ },
185
+ additionalParameters,
186
+ );
196
187
 
197
- url.searchParams.set('client_id', applicationId);
198
- url.searchParams.set('scope', scope);
199
- url.searchParams.set('state', state);
200
- Object.keys(additionalProperties).forEach((key) =>
201
- url.searchParams.set(
202
- snakeCase(key),
203
- additionalProperties[key] as unknown as string,
204
- ),
205
- );
206
- } catch (err) {
207
- log('debug', '👫 - OAuth2 acknowledge error', (err as YError).code);
208
- log('debug-stack', printStackTrace(err as Error));
188
+ url.searchParams.set('client_id', applicationId);
189
+ url.searchParams.set('scope', scope);
190
+ url.searchParams.set('state', state);
191
+ Object.keys(additionalProperties).forEach((key) =>
192
+ url.searchParams.set(
193
+ snakeCase(key),
194
+ additionalProperties[key] as unknown as string,
195
+ ),
196
+ );
197
+ } catch (err) {
198
+ log('debug', '👫 - OAuth2 acknowledge error', (err as YError).code);
199
+ log('debug-stack', printStackTrace(err as Error));
209
200
 
210
- setURLError(
211
- url,
212
- err as YError,
213
- ERRORS_DESCRIPTORS[(err as YError).code] || ERRORS_DESCRIPTORS.E_OAUTH2,
214
- );
215
- }
201
+ setURLError(
202
+ url,
203
+ err as YError,
204
+ ERRORS_DESCRIPTORS[(err as YError).code] || ERRORS_DESCRIPTORS.E_OAUTH2,
205
+ );
206
+ }
216
207
 
217
- return {
218
- status: 302,
219
- headers: {
220
- location: url.href,
221
- },
208
+ return {
209
+ status: 302,
210
+ headers: {
211
+ location: url.href,
212
+ },
213
+ };
222
214
  };
223
215
  }
224
216
 
@@ -1,16 +1,17 @@
1
1
  import { describe, test, beforeEach, jest, expect } from '@jest/globals';
2
2
  import initPostOAuth2Token from './postOAuth2Token.js';
3
3
  import { YError } from 'yerror';
4
- import type { LogService, TimeService } from 'common-services';
5
- import type {
6
- OAuth2GranterService,
7
- OAuth2AccessTokenService,
8
- OAuth2RefreshTokenService,
4
+ import { type LogService, type TimeService } from 'common-services';
5
+ import {
6
+ type OAuth2GranterService,
7
+ type OAuth2AccessTokenService,
8
+ type OAuth2RefreshTokenService,
9
9
  } from '../index.js';
10
- import type { OAuth2CodeGranterService } from '../services/oAuth2CodeGranter.js';
11
- import type { OAuth2TokenGranterService } from '../services/oAuth2TokenGranter.js';
12
- import type { OAuth2PasswordGranterService } from '../services/oAuth2PasswordGranter.js';
13
- import type { OAuth2RefreshTokenGranterService } from '../services/oAuth2RefreshTokenGranter.js';
10
+ import { type OAuth2CodeGranterService } from '../services/oAuth2CodeGranter.js';
11
+ import { type OAuth2TokenGranterService } from '../services/oAuth2TokenGranter.js';
12
+ import { type OAuth2PasswordGranterService } from '../services/oAuth2PasswordGranter.js';
13
+ import { type OAuth2RefreshTokenGranterService } from '../services/oAuth2RefreshTokenGranter.js';
14
+ import { type WhookAuthenticationData } from '@whook/authorization';
14
15
 
15
16
  describe('postOAuth2Token', () => {
16
17
  const log = jest.fn<LogService>();
@@ -152,7 +153,7 @@ describe('postOAuth2Token', () => {
152
153
  authenticationData: {
153
154
  applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
154
155
  scope: 'user',
155
- },
156
+ } as WhookAuthenticationData,
156
157
  body: {
157
158
  grant_type: 'authorization_code',
158
159
  code: '007',
@@ -182,7 +183,7 @@ describe('postOAuth2Token', () => {
182
183
  authenticationData: {
183
184
  applicationId: 'abbacaca-abba-caca-abba-cacaabbacaca',
184
185
  scope: 'user',
185
- },
186
+ } as WhookAuthenticationData,
186
187
  body: {
187
188
  grant_type: 'yolo',
188
189
  code: '007',