@whook/oauth2 25.2.0 → 26.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 (173) hide show
  1. package/README.md +147 -98
  2. package/dist/index.d.ts +30 -11
  3. package/dist/index.js +15 -8
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.test.js +1258 -399
  6. package/dist/index.test.js.map +1 -1
  7. package/dist/libs/clients.d.ts +2 -0
  8. package/dist/libs/clients.js +13 -0
  9. package/dist/libs/clients.js.map +1 -0
  10. package/dist/libs/errors.d.ts +113 -0
  11. package/dist/libs/errors.js +178 -0
  12. package/dist/libs/errors.js.map +1 -0
  13. package/dist/libs/grants.d.ts +2 -0
  14. package/dist/libs/grants.js +10 -0
  15. package/dist/libs/grants.js.map +1 -0
  16. package/dist/libs/redirectURI.d.ts +7 -0
  17. package/dist/libs/redirectURI.js +78 -0
  18. package/dist/libs/redirectURI.js.map +1 -0
  19. package/dist/libs/schemas.d.ts +23 -0
  20. package/dist/libs/schemas.js +25 -0
  21. package/dist/libs/schemas.js.map +1 -0
  22. package/dist/libs/scopes.d.ts +16 -0
  23. package/dist/libs/scopes.js +37 -0
  24. package/dist/libs/scopes.js.map +1 -1
  25. package/dist/libs/utils.d.ts +2 -0
  26. package/dist/libs/utils.js +17 -0
  27. package/dist/libs/utils.js.map +1 -0
  28. package/dist/libs/verifier.d.ts +7 -0
  29. package/dist/libs/verifier.js +37 -0
  30. package/dist/libs/verifier.js.map +1 -0
  31. package/dist/libs/verifier.test.js +21 -0
  32. package/dist/libs/verifier.test.js.map +1 -0
  33. package/dist/routes/getOAuth2Authorize.d.ts +13 -50
  34. package/dist/routes/getOAuth2Authorize.js +60 -86
  35. package/dist/routes/getOAuth2Authorize.js.map +1 -1
  36. package/dist/routes/getOAuth2Authorize.test.js +147 -68
  37. package/dist/routes/getOAuth2Authorize.test.js.map +1 -1
  38. package/dist/routes/getOAuth2WellKnownMetadata.d.ts +8 -8
  39. package/dist/routes/getOAuth2WellKnownMetadata.js +20 -9
  40. package/dist/routes/getOAuth2WellKnownMetadata.js.map +1 -1
  41. package/dist/routes/getOAuth2WellKnownMetadata.test.js +38 -37
  42. package/dist/routes/getOAuth2WellKnownMetadata.test.js.map +1 -1
  43. package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.d.ts +3 -6
  44. package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.js +3 -6
  45. package/dist/routes/getOAuth2WellKnownProtectedResourceMetadata.js.map +1 -1
  46. package/dist/routes/postAuthLogin.d.ts +14 -9
  47. package/dist/routes/postAuthLogin.js +10 -5
  48. package/dist/routes/postAuthLogin.js.map +1 -1
  49. package/dist/routes/postAuthLogin.test.js +79 -55
  50. package/dist/routes/postAuthLogin.test.js.map +1 -1
  51. package/dist/routes/postAuthLogout.d.ts +5 -2
  52. package/dist/routes/postAuthLogout.js +12 -7
  53. package/dist/routes/postAuthLogout.js.map +1 -1
  54. package/dist/routes/postAuthLogout.test.js +35 -17
  55. package/dist/routes/postAuthLogout.test.js.map +1 -1
  56. package/dist/routes/postAuthRefresh.d.ts +14 -9
  57. package/dist/routes/postAuthRefresh.js +10 -6
  58. package/dist/routes/postAuthRefresh.js.map +1 -1
  59. package/dist/routes/postAuthRefresh.test.js +90 -59
  60. package/dist/routes/postAuthRefresh.test.js.map +1 -1
  61. package/dist/routes/postOAuth2Acknowledge.d.ts +20 -10
  62. package/dist/routes/postOAuth2Acknowledge.js +54 -38
  63. package/dist/routes/postOAuth2Acknowledge.js.map +1 -1
  64. package/dist/routes/postOAuth2Acknowledge.test.js +137 -72
  65. package/dist/routes/postOAuth2Acknowledge.test.js.map +1 -1
  66. package/dist/routes/postOAuth2Revoke.d.ts +99 -0
  67. package/dist/routes/postOAuth2Revoke.js +102 -0
  68. package/dist/routes/postOAuth2Revoke.js.map +1 -0
  69. package/dist/routes/postOAuth2Revoke.test.d.ts +1 -0
  70. package/dist/routes/postOAuth2Revoke.test.js +161 -0
  71. package/dist/routes/postOAuth2Revoke.test.js.map +1 -0
  72. package/dist/routes/postOAuth2Token.d.ts +35 -108
  73. package/dist/routes/postOAuth2Token.js +53 -114
  74. package/dist/routes/postOAuth2Token.js.map +1 -1
  75. package/dist/routes/postOAuth2Token.test.js +493 -61
  76. package/dist/routes/postOAuth2Token.test.js.map +1 -1
  77. package/dist/services/authCookies.d.ts +9 -13
  78. package/dist/services/authCookies.js +1 -1
  79. package/dist/services/authCookies.js.map +1 -1
  80. package/dist/services/authCookies.test.js.map +1 -1
  81. package/dist/services/oAuth2AuthorizationCodeGranter.d.ts +129 -0
  82. package/dist/services/oAuth2AuthorizationCodeGranter.js +221 -0
  83. package/dist/services/oAuth2AuthorizationCodeGranter.js.map +1 -0
  84. package/dist/services/oAuth2AuthorizationCodeGranter.test.d.ts +1 -0
  85. package/dist/services/oAuth2AuthorizationCodeGranter.test.js +474 -0
  86. package/dist/services/oAuth2AuthorizationCodeGranter.test.js.map +1 -0
  87. package/dist/services/oAuth2ClientCredentialsGranter.d.ts +28 -12
  88. package/dist/services/oAuth2ClientCredentialsGranter.js +39 -21
  89. package/dist/services/oAuth2ClientCredentialsGranter.js.map +1 -1
  90. package/dist/services/oAuth2ClientCredentialsGranter.test.d.ts +1 -0
  91. package/dist/services/oAuth2ClientCredentialsGranter.test.js +265 -0
  92. package/dist/services/oAuth2ClientCredentialsGranter.test.js.map +1 -0
  93. package/dist/services/oAuth2Granters.d.ts +81 -86
  94. package/dist/services/oAuth2Granters.js +2 -67
  95. package/dist/services/oAuth2Granters.js.map +1 -1
  96. package/dist/services/oAuth2ImplicitGranter.d.ts +38 -0
  97. package/dist/services/oAuth2ImplicitGranter.js +72 -0
  98. package/dist/services/oAuth2ImplicitGranter.js.map +1 -0
  99. package/dist/services/oAuth2ImplicitGranter.test.d.ts +1 -0
  100. package/dist/services/oAuth2ImplicitGranter.test.js +727 -0
  101. package/dist/services/oAuth2ImplicitGranter.test.js.map +1 -0
  102. package/dist/services/oAuth2PasswordGranter.d.ts +43 -10
  103. package/dist/services/oAuth2PasswordGranter.js +53 -18
  104. package/dist/services/oAuth2PasswordGranter.js.map +1 -1
  105. package/dist/services/oAuth2PasswordGranter.test.d.ts +1 -0
  106. package/dist/services/oAuth2PasswordGranter.test.js +455 -0
  107. package/dist/services/oAuth2PasswordGranter.test.js.map +1 -0
  108. package/dist/services/oAuth2RefreshTokenGranter.d.ts +42 -9
  109. package/dist/services/oAuth2RefreshTokenGranter.js +60 -21
  110. package/dist/services/oAuth2RefreshTokenGranter.js.map +1 -1
  111. package/dist/services/oAuth2RefreshTokenGranter.test.d.ts +1 -0
  112. package/dist/services/oAuth2RefreshTokenGranter.test.js +403 -0
  113. package/dist/services/oAuth2RefreshTokenGranter.test.js.map +1 -0
  114. package/package.json +11 -11
  115. package/src/index.test.ts +1314 -404
  116. package/src/index.ts +46 -53
  117. package/src/libs/clients.ts +22 -0
  118. package/src/libs/errors.ts +325 -0
  119. package/src/libs/grants.ts +15 -0
  120. package/src/libs/redirectURI.ts +120 -0
  121. package/src/libs/schemas.ts +27 -0
  122. package/src/libs/scopes.ts +49 -0
  123. package/src/libs/utils.ts +24 -0
  124. package/src/libs/verifier.test.ts +37 -0
  125. package/src/libs/verifier.ts +57 -0
  126. package/src/routes/getOAuth2Authorize.test.ts +179 -96
  127. package/src/routes/getOAuth2Authorize.ts +97 -124
  128. package/src/routes/getOAuth2WellKnownMetadata.test.ts +58 -60
  129. package/src/routes/getOAuth2WellKnownMetadata.ts +26 -11
  130. package/src/routes/getOAuth2WellKnownProtectedResourceMetadata.ts +4 -6
  131. package/src/routes/postAuthLogin.test.ts +86 -57
  132. package/src/routes/postAuthLogin.ts +24 -14
  133. package/src/routes/postAuthLogout.test.ts +42 -18
  134. package/src/routes/postAuthLogout.ts +22 -8
  135. package/src/routes/postAuthRefresh.test.ts +98 -61
  136. package/src/routes/postAuthRefresh.ts +25 -13
  137. package/src/routes/postOAuth2Acknowledge.test.ts +169 -110
  138. package/src/routes/postOAuth2Acknowledge.ts +101 -61
  139. package/src/routes/postOAuth2Revoke.test.ts +179 -0
  140. package/src/routes/postOAuth2Revoke.ts +156 -0
  141. package/src/routes/postOAuth2Token.test.ts +570 -108
  142. package/src/routes/postOAuth2Token.ts +92 -136
  143. package/src/services/authCookies.test.ts +5 -5
  144. package/src/services/authCookies.ts +16 -18
  145. package/src/services/oAuth2AuthorizationCodeGranter.test.ts +564 -0
  146. package/src/services/oAuth2AuthorizationCodeGranter.ts +388 -0
  147. package/src/services/oAuth2ClientCredentialsGranter.test.ts +303 -0
  148. package/src/services/oAuth2ClientCredentialsGranter.ts +68 -43
  149. package/src/services/oAuth2Granters.ts +101 -195
  150. package/src/services/oAuth2ImplicitGranter.test.ts +811 -0
  151. package/src/services/oAuth2ImplicitGranter.ts +163 -0
  152. package/src/services/oAuth2PasswordGranter.test.ts +493 -0
  153. package/src/services/oAuth2PasswordGranter.ts +116 -40
  154. package/src/services/oAuth2RefreshTokenGranter.test.ts +441 -0
  155. package/src/services/oAuth2RefreshTokenGranter.ts +118 -51
  156. package/src/types.d.ts +1 -0
  157. package/dist/services/oAuth2CodeGranter.d.ts +0 -41
  158. package/dist/services/oAuth2CodeGranter.js +0 -105
  159. package/dist/services/oAuth2CodeGranter.js.map +0 -1
  160. package/dist/services/oAuth2CodeGranter.test.js +0 -123
  161. package/dist/services/oAuth2CodeGranter.test.js.map +0 -1
  162. package/dist/services/oAuth2TokenGranter.d.ts +0 -22
  163. package/dist/services/oAuth2TokenGranter.js +0 -64
  164. package/dist/services/oAuth2TokenGranter.js.map +0 -1
  165. package/src/__snapshots__/index.test.ts.snap +0 -401
  166. package/src/routes/__snapshots__/getOAuth2Authorize.test.ts.snap +0 -37
  167. package/src/routes/__snapshots__/postOAuth2Acknowledge.test.ts.snap +0 -61
  168. package/src/routes/__snapshots__/postOAuth2Token.test.ts.snap +0 -52
  169. package/src/services/__snapshots__/oAuth2CodeGranter.test.ts.snap +0 -52
  170. package/src/services/oAuth2CodeGranter.test.ts +0 -176
  171. package/src/services/oAuth2CodeGranter.ts +0 -210
  172. package/src/services/oAuth2TokenGranter.ts +0 -119
  173. /package/dist/{services/oAuth2CodeGranter.test.d.ts → libs/verifier.test.d.ts} +0 -0
@@ -1,401 +0,0 @@
1
- // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
-
3
- exports[`OAuth2 server with the client credentials flow should produce new tokens 2`] = `
4
- {
5
- "authenticationCheckCalls": [
6
- [
7
- "basic",
8
- {
9
- "hash": "YWxpOm9wZW5fc2VzYW1l",
10
- "password": "open_sesame",
11
- "username": "ali",
12
- },
13
- ],
14
- ],
15
- "checkApplicationCalls": [
16
- [
17
- {
18
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
19
- "scope": "user",
20
- "type": "client_credentials",
21
- },
22
- ],
23
- ],
24
- "oAuth2AccessTokenCheckCalls": [],
25
- "oAuth2AccessTokenCreateCalls": [
26
- [
27
- {
28
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
29
- "scope": "user,oauth",
30
- "userId": "2",
31
- },
32
- {
33
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
34
- "scope": "user",
35
- "userId": "2",
36
- },
37
- ],
38
- ],
39
- "oAuth2CodeCheckCalls": [],
40
- "oAuth2CodeCreateCalls": [],
41
- "oAuth2PasswordCheckCalls": [],
42
- "oAuth2RefreshTokenCheckCalls": [],
43
- "oAuth2RefreshTokenCreateCalls": [
44
- [
45
- {
46
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
47
- "scope": "user,oauth",
48
- "userId": "2",
49
- },
50
- {
51
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
52
- "scope": "user",
53
- "userId": "2",
54
- },
55
- ],
56
- ],
57
- }
58
- `;
59
-
60
- exports[`OAuth2 server with the code flow should build the authorization redirection 2`] = `
61
- {
62
- "authenticationCheckCalls": [],
63
- "checkApplicationCalls": [
64
- [
65
- {
66
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
67
- "redirectURI": "https://example.com/oauth2/callback?a_param=a_param_value",
68
- "scope": "user",
69
- "type": "code",
70
- },
71
- ],
72
- ],
73
- "oAuth2AccessTokenCheckCalls": [],
74
- "oAuth2AccessTokenCreateCalls": [],
75
- "oAuth2CodeCheckCalls": [],
76
- "oAuth2CodeCreateCalls": [],
77
- "oAuth2PasswordCheckCalls": [],
78
- "oAuth2RefreshTokenCheckCalls": [],
79
- "oAuth2RefreshTokenCreateCalls": [],
80
- }
81
- `;
82
-
83
- exports[`OAuth2 server with the code flow should produce new tokens 2`] = `
84
- {
85
- "authenticationCheckCalls": [
86
- [
87
- "basic",
88
- {
89
- "hash": "YWxpOm9wZW5fc2VzYW1l",
90
- "password": "open_sesame",
91
- "username": "ali",
92
- },
93
- ],
94
- ],
95
- "checkApplicationCalls": [
96
- [
97
- {
98
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
99
- "scope": "",
100
- "type": "code",
101
- },
102
- ],
103
- ],
104
- "oAuth2AccessTokenCheckCalls": [],
105
- "oAuth2AccessTokenCreateCalls": [
106
- [
107
- {
108
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
109
- "scope": "user,oauth",
110
- "userId": "2",
111
- },
112
- {
113
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
114
- "redirectURI": "http://redirect.example.com/yolo",
115
- "scope": "user,auth",
116
- "userId": "1",
117
- },
118
- ],
119
- ],
120
- "oAuth2CodeCheckCalls": [
121
- [
122
- {
123
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
124
- "scope": "user,oauth",
125
- "userId": "2",
126
- },
127
- "a_grant_code",
128
- "http://redirect.example.com/yolo",
129
- undefined,
130
- ],
131
- ],
132
- "oAuth2CodeCreateCalls": [],
133
- "oAuth2PasswordCheckCalls": [],
134
- "oAuth2RefreshTokenCheckCalls": [],
135
- "oAuth2RefreshTokenCreateCalls": [
136
- [
137
- {
138
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
139
- "scope": "user,oauth",
140
- "userId": "2",
141
- },
142
- {
143
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
144
- "redirectURI": "http://redirect.example.com/yolo",
145
- "scope": "user,auth",
146
- "userId": "1",
147
- },
148
- ],
149
- ],
150
- }
151
- `;
152
-
153
- exports[`OAuth2 server with the code flow should redirect with a code 2`] = `
154
- {
155
- "authenticationCheckCalls": [
156
- [
157
- "bearer",
158
- {
159
- "hash": "yolo",
160
- },
161
- ],
162
- ],
163
- "checkApplicationCalls": [
164
- [
165
- {
166
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
167
- "scope": "",
168
- "type": "root",
169
- },
170
- ],
171
- ],
172
- "oAuth2AccessTokenCheckCalls": [],
173
- "oAuth2AccessTokenCreateCalls": [],
174
- "oAuth2CodeCheckCalls": [],
175
- "oAuth2CodeCreateCalls": [
176
- [
177
- {
178
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
179
- "scope": "user",
180
- "userId": "2",
181
- },
182
- "http://redirect.example.com/yolo?a_param=a_value",
183
- undefined,
184
- undefined,
185
- {},
186
- ],
187
- ],
188
- "oAuth2PasswordCheckCalls": [],
189
- "oAuth2RefreshTokenCheckCalls": [],
190
- "oAuth2RefreshTokenCreateCalls": [],
191
- }
192
- `;
193
-
194
- exports[`OAuth2 server with the implicit flow should build the authorization redirection 2`] = `
195
- {
196
- "authenticationCheckCalls": [],
197
- "checkApplicationCalls": [
198
- [
199
- {
200
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
201
- "redirectURI": "http://redirect.example.com/yolo",
202
- "scope": "user",
203
- "type": "token",
204
- },
205
- ],
206
- ],
207
- "oAuth2AccessTokenCheckCalls": [],
208
- "oAuth2AccessTokenCreateCalls": [],
209
- "oAuth2CodeCheckCalls": [],
210
- "oAuth2CodeCreateCalls": [],
211
- "oAuth2PasswordCheckCalls": [],
212
- "oAuth2RefreshTokenCheckCalls": [],
213
- "oAuth2RefreshTokenCreateCalls": [],
214
- }
215
- `;
216
-
217
- exports[`OAuth2 server with the implicit flow should redirect with a token 2`] = `
218
- {
219
- "authenticationCheckCalls": [
220
- [
221
- "bearer",
222
- {
223
- "hash": "yolo",
224
- },
225
- ],
226
- ],
227
- "checkApplicationCalls": [
228
- [
229
- {
230
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
231
- "scope": "",
232
- "type": "root",
233
- },
234
- ],
235
- [
236
- {
237
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
238
- "redirectURI": "http://redirect.example.com/yolo?a_param=a_value",
239
- "scope": "user",
240
- "type": "token",
241
- },
242
- ],
243
- ],
244
- "oAuth2AccessTokenCheckCalls": [],
245
- "oAuth2AccessTokenCreateCalls": [
246
- [
247
- {
248
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
249
- "scope": "user,oauth",
250
- "userId": "2",
251
- },
252
- {
253
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
254
- "scope": "user",
255
- "userId": "2",
256
- },
257
- {},
258
- ],
259
- ],
260
- "oAuth2CodeCheckCalls": [],
261
- "oAuth2CodeCreateCalls": [],
262
- "oAuth2PasswordCheckCalls": [],
263
- "oAuth2RefreshTokenCheckCalls": [],
264
- "oAuth2RefreshTokenCreateCalls": [],
265
- }
266
- `;
267
-
268
- exports[`OAuth2 server with the password flow should produce new tokens 2`] = `
269
- {
270
- "authenticationCheckCalls": [
271
- [
272
- "basic",
273
- {
274
- "hash": "YWxpOm9wZW5fc2VzYW1l",
275
- "password": "open_sesame",
276
- "username": "ali",
277
- },
278
- ],
279
- ],
280
- "checkApplicationCalls": [
281
- [
282
- {
283
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
284
- "scope": "user",
285
- "type": "password",
286
- },
287
- ],
288
- ],
289
- "oAuth2AccessTokenCheckCalls": [],
290
- "oAuth2AccessTokenCreateCalls": [
291
- [
292
- {
293
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
294
- "scope": "user,oauth",
295
- "userId": "2",
296
- },
297
- {
298
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
299
- "scope": "user,auth",
300
- "userId": "1",
301
- },
302
- ],
303
- ],
304
- "oAuth2CodeCheckCalls": [],
305
- "oAuth2CodeCreateCalls": [],
306
- "oAuth2PasswordCheckCalls": [
307
- [
308
- {
309
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
310
- "scope": "user,oauth",
311
- "userId": "2",
312
- },
313
- "me@example.com",
314
- "udelawli",
315
- "user",
316
- ],
317
- ],
318
- "oAuth2RefreshTokenCheckCalls": [],
319
- "oAuth2RefreshTokenCreateCalls": [
320
- [
321
- {
322
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
323
- "scope": "user,oauth",
324
- "userId": "2",
325
- },
326
- {
327
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
328
- "scope": "user,auth",
329
- "userId": "1",
330
- },
331
- ],
332
- ],
333
- }
334
- `;
335
-
336
- exports[`OAuth2 server with the refresh token flow should produce new tokens 2`] = `
337
- {
338
- "authenticationCheckCalls": [
339
- [
340
- "basic",
341
- {
342
- "hash": "YWxpOm9wZW5fc2VzYW1l",
343
- "password": "open_sesame",
344
- "username": "ali",
345
- },
346
- ],
347
- ],
348
- "checkApplicationCalls": [
349
- [
350
- {
351
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
352
- "scope": "user",
353
- "type": "refresh",
354
- },
355
- ],
356
- ],
357
- "oAuth2AccessTokenCheckCalls": [],
358
- "oAuth2AccessTokenCreateCalls": [
359
- [
360
- {
361
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
362
- "scope": "user,oauth",
363
- "userId": "2",
364
- },
365
- {
366
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
367
- "scope": "user,auth",
368
- "userId": "1",
369
- },
370
- ],
371
- ],
372
- "oAuth2CodeCheckCalls": [],
373
- "oAuth2CodeCreateCalls": [],
374
- "oAuth2PasswordCheckCalls": [],
375
- "oAuth2RefreshTokenCheckCalls": [
376
- [
377
- {
378
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
379
- "scope": "user,oauth",
380
- "userId": "2",
381
- },
382
- "a_refresh_token",
383
- "user",
384
- ],
385
- ],
386
- "oAuth2RefreshTokenCreateCalls": [
387
- [
388
- {
389
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
390
- "scope": "user,oauth",
391
- "userId": "2",
392
- },
393
- {
394
- "applicationId": "acdc41ce-acdc-41ce-acdc-41ceacdc41ce",
395
- "scope": "user,auth",
396
- "userId": "1",
397
- },
398
- ],
399
- ],
400
- }
401
- `;
@@ -1,37 +0,0 @@
1
- // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
-
3
- exports[`getOAuth2Authorize should redirect 2`] = `
4
- {
5
- "codeGranterAcknowledgerAcknowledgeCalls": [],
6
- "codeGranterAuthenticatorAuthenticateCalls": [],
7
- "codeGranterAuthorizerAuthorizeCalls": [
8
- [
9
- {
10
- "clientId": "abbacaca-abba-caca-abba-cacaabbacaca",
11
- "redirectURI": "https://www.example.com",
12
- "scope": "user",
13
- },
14
- {},
15
- ],
16
- ],
17
- "logCalls": [],
18
- "tokenGranterAcknowledgerAcknowledgeCalls": [],
19
- "tokenGranterAuthorizerAuthorizeCalls": [],
20
- }
21
- `;
22
-
23
- exports[`getOAuth2Authorize should redirect with an error when some 2`] = `
24
- {
25
- "codeGranterAcknowledgerAcknowledgeCalls": [],
26
- "codeGranterAuthenticatorAuthenticateCalls": [],
27
- "codeGranterAuthorizerAuthorizeCalls": [],
28
- "logCalls": [
29
- [
30
- "debug",
31
- "👫 - OAuth2 authorize error.",
32
- ],
33
- ],
34
- "tokenGranterAcknowledgerAcknowledgeCalls": [],
35
- "tokenGranterAuthorizerAuthorizeCalls": [],
36
- }
37
- `;
@@ -1,61 +0,0 @@
1
- // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
-
3
- exports[`postOAuth2Acknowledge should redirect 2`] = `
4
- {
5
- "checkApplicationCalls": [
6
- [
7
- {
8
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
9
- "scope": "",
10
- "type": "root",
11
- },
12
- ],
13
- ],
14
- "codeGranterAcknowledgerAcknowledgeCalls": [
15
- [
16
- {
17
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
18
- "scope": "auth",
19
- "userId": "1",
20
- },
21
- {
22
- "clientId": "abbacaca-abba-caca-abba-cacaabbacaca",
23
- "redirectURI": "https://www.example.com",
24
- "scope": "user",
25
- },
26
- {},
27
- ],
28
- ],
29
- "codeGranterAuthenticatorAuthenticateCalls": [],
30
- "codeGranterAuthorizerAuthorizeCalls": [],
31
- "logCalls": [],
32
- "tokenGranterAcknowledgerAcknowledgeCalls": [],
33
- "tokenGranterAuthorizerAuthorizeCalls": [],
34
- }
35
- `;
36
-
37
- exports[`postOAuth2Acknowledge should redirect errors too 2`] = `
38
- {
39
- "checkApplicationCalls": [
40
- [
41
- {
42
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
43
- "scope": "",
44
- "type": "root",
45
- },
46
- ],
47
- ],
48
- "codeGranterAcknowledgerAcknowledgeCalls": [],
49
- "codeGranterAuthenticatorAuthenticateCalls": [],
50
- "codeGranterAuthorizerAuthorizeCalls": [],
51
- "logCalls": [
52
- [
53
- "debug",
54
- "👫 - OAuth2 acknowledge error",
55
- "E_UNKNOWN_ACKNOWLEDGER_TYPE",
56
- ],
57
- ],
58
- "tokenGranterAcknowledgerAcknowledgeCalls": [],
59
- "tokenGranterAuthorizerAuthorizeCalls": [],
60
- }
61
- `;
@@ -1,52 +0,0 @@
1
- // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
-
3
- exports[`postOAuth2Token should create a token 1`] = `
4
- {
5
- "logCalls": [],
6
- "oAuth2AccessTokenCreateCalls": [
7
- [
8
- {
9
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
10
- "scope": "user",
11
- },
12
- undefined,
13
- ],
14
- ],
15
- "oAuth2RefreshTokenCreateCalls": [
16
- [
17
- {
18
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
19
- "scope": "user",
20
- },
21
- undefined,
22
- ],
23
- ],
24
- "response": {
25
- "body": {
26
- "access_token": "an_access_token",
27
- "expiration_date": "2010-03-07T00:00:00.000Z",
28
- "expires_in": 86400,
29
- "refresh_token": "a_refresh_token",
30
- "refresh_token_expiration_date": "2180-03-06T00:00:00.000Z",
31
- "refresh_token_expires_in": 5364748800,
32
- "token_type": "bearer",
33
- },
34
- "headers": {},
35
- "status": 200,
36
- },
37
- }
38
- `;
39
-
40
- exports[`postOAuth2Token should fail with a bad grant type 2`] = `
41
- {
42
- "logCalls": [
43
- [
44
- "debug",
45
- "👫 - OAuth2 token issuing error",
46
- "E_UNKNOWN_AUTHENTICATOR_TYPE",
47
- ],
48
- ],
49
- "oAuth2AccessTokenCreateCalls": [],
50
- "oAuth2RefreshTokenCreateCalls": [],
51
- }
52
- `;
@@ -1,52 +0,0 @@
1
- // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
-
3
- exports[`OAuth2CodeGranter should work with a complete valid flow 2`] = `
4
- {
5
- "checkApplicationCalls": [
6
- [
7
- {
8
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
9
- "redirectURI": "https://www.example.com/oauth2/code",
10
- "scope": "user",
11
- "type": "code",
12
- },
13
- ],
14
- [
15
- {
16
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
17
- "scope": "",
18
- "type": "code",
19
- },
20
- ],
21
- ],
22
- "logCalls": [
23
- [
24
- "debug",
25
- "👫 - OAuth2CodeGranter Service Initialized!",
26
- ],
27
- ],
28
- "oAuth2CodeCheckCalls": [
29
- [
30
- {
31
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
32
- "scope": "user",
33
- },
34
- "yolo",
35
- "https://www.example.com/oauth2/code",
36
- "",
37
- ],
38
- ],
39
- "oAuth2CodeCreateCalls": [
40
- [
41
- {
42
- "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
43
- "scope": "user",
44
- },
45
- "https://www.example.com/oauth2/code",
46
- "",
47
- "plain",
48
- {},
49
- ],
50
- ],
51
- }
52
- `;