@midwayjs/passport 3.4.0-beta.1 → 3.4.0-beta.12
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.
- package/LICENSE +21 -0
- package/dist/config/config.default.d.ts +2 -0
- package/dist/config/config.default.js +2 -0
- package/dist/configuration.js +2 -11
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/interface.d.ts +62 -8
- package/dist/interface.js +1 -4
- package/dist/passport/authenticator.d.ts +125 -0
- package/dist/passport/authenticator.js +463 -0
- package/dist/passport/passport.service.d.ts +6 -0
- package/dist/passport/passport.service.js +393 -0
- package/dist/passport/pause.d.ts +19 -0
- package/dist/passport/pause.js +50 -0
- package/dist/passport/request.d.ts +2 -0
- package/dist/{proxy/framework → passport}/request.js +17 -25
- package/dist/passport/session.stratey.d.ts +34 -0
- package/dist/passport/session.stratey.js +68 -0
- package/dist/passport/strategy.d.ts +14 -0
- package/dist/passport/strategy.js +10 -0
- package/index.d.ts +2 -2
- package/package.json +11 -14
- package/CHANGELOG.md +0 -384
- package/dist/proxy/framework/koa.d.ts +0 -39
- package/dist/proxy/framework/koa.js +0 -190
- package/dist/proxy/framework/request.d.ts +0 -11
- package/dist/proxy/index.d.ts +0 -7
- package/dist/proxy/index.js +0 -21
- package/dist/service/passport.service.d.ts +0 -6
- package/dist/service/passport.service.js +0 -226
- package/dist/util.d.ts +0 -3
- package/dist/util.js +0 -16
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/passport",
|
|
3
3
|
"description": "midway passport component",
|
|
4
|
-
"version": "3.4.0-beta.
|
|
4
|
+
"version": "3.4.0-beta.12",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -22,21 +22,18 @@
|
|
|
22
22
|
"author": "Nawbc",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@midwayjs/core": "^3.4.0-beta.
|
|
26
|
-
"@midwayjs/decorator": "^3.4.0-beta.
|
|
27
|
-
"@midwayjs/express": "^3.4.0-beta.
|
|
28
|
-
"@midwayjs/jwt": "^3.4.0-beta.
|
|
29
|
-
"@midwayjs/koa": "^3.4.0-beta.
|
|
30
|
-
"@midwayjs/mock": "^3.4.0-beta.
|
|
31
|
-
"@midwayjs/web": "^3.4.0-beta.
|
|
32
|
-
"@types/passport": "1.0.8",
|
|
25
|
+
"@midwayjs/core": "^3.4.0-beta.12",
|
|
26
|
+
"@midwayjs/decorator": "^3.4.0-beta.12",
|
|
27
|
+
"@midwayjs/express": "^3.4.0-beta.12",
|
|
28
|
+
"@midwayjs/jwt": "^3.4.0-beta.12",
|
|
29
|
+
"@midwayjs/koa": "^3.4.0-beta.12",
|
|
30
|
+
"@midwayjs/mock": "^3.4.0-beta.12",
|
|
31
|
+
"@midwayjs/web": "^3.4.0-beta.12",
|
|
33
32
|
"@types/passport-local": "1.0.34",
|
|
34
33
|
"express-session": "1.17.3",
|
|
35
|
-
"passport": "0.5.2",
|
|
36
34
|
"passport-jwt": "4.0.0",
|
|
37
|
-
"passport-local": "1.0.0"
|
|
35
|
+
"passport-local": "1.0.0",
|
|
36
|
+
"passport-openidconnect": "0.1.1"
|
|
38
37
|
},
|
|
39
|
-
"
|
|
40
|
-
"passport": "^0.5.0"
|
|
41
|
-
}
|
|
38
|
+
"gitHead": "cb639763ececfc7928221eaafbd515bfd93c6ca1"
|
|
42
39
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [3.3.13](https://github.com/midwayjs/midway/compare/v3.3.12...v3.3.13) (2022-06-06)
|
|
7
|
-
|
|
8
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## [3.3.11](https://github.com/midwayjs/midway/compare/v3.3.10...v3.3.11) (2022-05-27)
|
|
15
|
-
|
|
16
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
## [3.3.9](https://github.com/midwayjs/midway/compare/v3.3.8...v3.3.9) (2022-05-25)
|
|
23
|
-
|
|
24
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
## [3.3.6](https://github.com/midwayjs/midway/compare/v3.3.5...v3.3.6) (2022-05-11)
|
|
31
|
-
|
|
32
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
## [3.3.5](https://github.com/midwayjs/midway/compare/v3.3.4...v3.3.5) (2022-04-27)
|
|
39
|
-
|
|
40
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
## [3.3.4](https://github.com/midwayjs/midway/compare/v3.3.3...v3.3.4) (2022-04-21)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
### Bug Fixes
|
|
50
|
-
|
|
51
|
-
* is express method got error result ([#1919](https://github.com/midwayjs/midway/issues/1919)) ([7ca9359](https://github.com/midwayjs/midway/commit/7ca9359c8421f77f1f410c56730cb8babaf65a8c))
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
## [3.3.3](https://github.com/midwayjs/midway/compare/v3.3.2...v3.3.3) (2022-04-14)
|
|
58
|
-
|
|
59
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
## [3.3.2](https://github.com/midwayjs/midway/compare/v3.3.1...v3.3.2) (2022-04-13)
|
|
66
|
-
|
|
67
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## [3.3.1](https://github.com/midwayjs/midway/compare/v3.3.0...v3.3.1) (2022-04-11)
|
|
74
|
-
|
|
75
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
# [3.3.0](https://github.com/midwayjs/midway/compare/v3.2.2...v3.3.0) (2022-04-07)
|
|
82
|
-
|
|
83
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
## [3.2.2](https://github.com/midwayjs/midway/compare/v3.2.1...v3.2.2) (2022-03-30)
|
|
90
|
-
|
|
91
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
## [3.2.1](https://github.com/midwayjs/midway/compare/v3.2.0...v3.2.1) (2022-03-27)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### Bug Fixes
|
|
101
|
-
|
|
102
|
-
* swagger ui replace json path ([#1860](https://github.com/midwayjs/midway/issues/1860)) ([0f3728d](https://github.com/midwayjs/midway/commit/0f3728daccba12923f23f5b498c7dda13ced36d7))
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
# [3.2.0](https://github.com/midwayjs/midway/compare/v3.1.6...v3.2.0) (2022-03-25)
|
|
109
|
-
|
|
110
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
## [3.1.6](https://github.com/midwayjs/midway/compare/v3.1.5...v3.1.6) (2022-03-21)
|
|
117
|
-
|
|
118
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
## [3.1.5](https://github.com/midwayjs/midway/compare/v3.1.4...v3.1.5) (2022-03-18)
|
|
125
|
-
|
|
126
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
## [3.1.4](https://github.com/midwayjs/midway/compare/v3.1.3...v3.1.4) (2022-03-16)
|
|
133
|
-
|
|
134
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
## [3.1.3](https://github.com/midwayjs/midway/compare/v3.1.2...v3.1.3) (2022-03-15)
|
|
141
|
-
|
|
142
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
## [3.1.2](https://github.com/midwayjs/midway/compare/v3.1.1...v3.1.2) (2022-03-15)
|
|
149
|
-
|
|
150
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
## [3.1.1](https://github.com/midwayjs/midway/compare/v3.1.0...v3.1.1) (2022-03-09)
|
|
157
|
-
|
|
158
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
# [3.1.0](https://github.com/midwayjs/midway/compare/v3.0.13...v3.1.0) (2022-03-07)
|
|
165
|
-
|
|
166
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
## [3.0.13](https://github.com/midwayjs/midway/compare/v3.0.12...v3.0.13) (2022-03-01)
|
|
173
|
-
|
|
174
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
## [3.0.11](https://github.com/midwayjs/midway/compare/v3.0.10...v3.0.11) (2022-02-25)
|
|
181
|
-
|
|
182
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
## [3.0.10](https://github.com/midwayjs/midway/compare/v3.0.9...v3.0.10) (2022-02-24)
|
|
189
|
-
|
|
190
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
## [3.0.9](https://github.com/midwayjs/midway/compare/v3.0.8...v3.0.9) (2022-02-21)
|
|
197
|
-
|
|
198
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
## [3.0.8](https://github.com/midwayjs/midway/compare/v3.0.7...v3.0.8) (2022-02-19)
|
|
205
|
-
|
|
206
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
## [3.0.7](https://github.com/midwayjs/midway/compare/v3.0.6...v3.0.7) (2022-02-17)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
### Bug Fixes
|
|
216
|
-
|
|
217
|
-
* passport middleware definition ([#1701](https://github.com/midwayjs/midway/issues/1701)) ([bca3860](https://github.com/midwayjs/midway/commit/bca38603437f7645603feba3cd47ad9b696f8db7))
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
## [3.0.6](https://github.com/midwayjs/midway/compare/v3.0.5...v3.0.6) (2022-02-13)
|
|
224
|
-
|
|
225
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
## [3.0.5](https://github.com/midwayjs/midway/compare/v3.0.4...v3.0.5) (2022-02-10)
|
|
232
|
-
|
|
233
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
## [3.0.4](https://github.com/midwayjs/midway/compare/v3.0.3...v3.0.4) (2022-02-09)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
### Bug Fixes
|
|
243
|
-
|
|
244
|
-
* supertest typings and createFunctionApp ([#1642](https://github.com/midwayjs/midway/issues/1642)) ([484f4f4](https://github.com/midwayjs/midway/commit/484f4f41b3b9e889d4d285f4871a0b37fa51e73f))
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
## [3.0.3](https://github.com/midwayjs/midway/compare/v3.0.2...v3.0.3) (2022-01-28)
|
|
251
|
-
|
|
252
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
## [3.0.2](https://github.com/midwayjs/midway/compare/v3.0.1...v3.0.2) (2022-01-24)
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
### Bug Fixes
|
|
262
|
-
|
|
263
|
-
* singleton invoke request scope not valid ([#1622](https://github.com/midwayjs/midway/issues/1622)) ([f97c063](https://github.com/midwayjs/midway/commit/f97c0632107b47cf357d17774a4e4bb5233bba57))
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
## [3.0.1](https://github.com/midwayjs/midway/compare/v3.0.0...v3.0.1) (2022-01-24)
|
|
270
|
-
|
|
271
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
# [3.0.0](https://github.com/midwayjs/midway/compare/v3.0.0-beta.17...v3.0.0) (2022-01-20)
|
|
278
|
-
|
|
279
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
# [3.0.0-beta.17](https://github.com/midwayjs/midway/compare/v3.0.0-beta.16...v3.0.0-beta.17) (2022-01-18)
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
### Bug Fixes
|
|
289
|
-
|
|
290
|
-
* move register to on server ready ([#1576](https://github.com/midwayjs/midway/issues/1576)) ([b5f8256](https://github.com/midwayjs/midway/commit/b5f8256d8cab103e3b9c7f22d5fc66bd5fa6c525))
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
### Features
|
|
294
|
-
|
|
295
|
-
* Allows the user to provide the response after authentication fa… ([#1567](https://github.com/midwayjs/midway/issues/1567)) ([57efdee](https://github.com/midwayjs/midway/commit/57efdee91ba81d02be6d0e0e0c2566ba30577386))
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
# [3.0.0-beta.16](https://github.com/midwayjs/midway/compare/v3.0.0-beta.15...v3.0.0-beta.16) (2022-01-11)
|
|
302
|
-
|
|
303
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
# [3.0.0-beta.15](https://github.com/midwayjs/midway/compare/v3.0.0-beta.14...v3.0.0-beta.15) (2022-01-07)
|
|
310
|
-
|
|
311
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
# [3.0.0-beta.14](https://github.com/midwayjs/midway/compare/v3.0.0-beta.13...v3.0.0-beta.14) (2022-01-04)
|
|
318
|
-
|
|
319
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
# [3.0.0-beta.13](https://github.com/midwayjs/midway/compare/v3.0.0-beta.12...v3.0.0-beta.13) (2021-12-30)
|
|
326
|
-
|
|
327
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
# [3.0.0-beta.12](https://github.com/midwayjs/midway/compare/v3.0.0-beta.11...v3.0.0-beta.12) (2021-12-28)
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
### Features
|
|
337
|
-
|
|
338
|
-
* support throw err status ([#1440](https://github.com/midwayjs/midway/issues/1440)) ([7b98110](https://github.com/midwayjs/midway/commit/7b98110d65c5287a8fcb3eb5356dea2d7a32cee9))
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
# [3.0.0-beta.11](https://github.com/midwayjs/midway/compare/v3.0.0-beta.10...v3.0.0-beta.11) (2021-12-21)
|
|
345
|
-
|
|
346
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
# [3.0.0-beta.10](https://github.com/midwayjs/midway/compare/v3.0.0-beta.9...v3.0.0-beta.10) (2021-12-20)
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
### Features
|
|
356
|
-
|
|
357
|
-
* default add session & bodyparser support for koa/express/faas ([#1420](https://github.com/midwayjs/midway/issues/1420)) ([cdaff31](https://github.com/midwayjs/midway/commit/cdaff317c3e862a95494a167995a28280af639bf))
|
|
358
|
-
* implement i18n for validate ([#1426](https://github.com/midwayjs/midway/issues/1426)) ([4c7ed2f](https://github.com/midwayjs/midway/commit/4c7ed2ff2e7ccf10f88f62abad230f92f5e76b97))
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
# [3.0.0-beta.9](https://github.com/midwayjs/midway/compare/v3.0.0-beta.8...v3.0.0-beta.9) (2021-12-09)
|
|
365
|
-
|
|
366
|
-
**Note:** Version bump only for package @midwayjs/passport
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
# [3.0.0-beta.8](https://github.com/midwayjs/midway/compare/v3.0.0-beta.7...v3.0.0-beta.8) (2021-12-08)
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
### Bug Fixes
|
|
376
|
-
|
|
377
|
-
* express routing middleware takes effect at the controller level ([#1364](https://github.com/midwayjs/midway/issues/1364)) ([b9272e0](https://github.com/midwayjs/midway/commit/b9272e0971003443304b0c53815be31a0061b4bd))
|
|
378
|
-
* passport missing proxy file ([#1405](https://github.com/midwayjs/midway/issues/1405)) ([5c9bdae](https://github.com/midwayjs/midway/commit/5c9bdae8323b41ead72c3d3f867aa11150bb3e78))
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
### Features
|
|
382
|
-
|
|
383
|
-
* passport add presetProperty ([#1358](https://github.com/midwayjs/midway/issues/1358)) ([4db8eda](https://github.com/midwayjs/midway/commit/4db8eda592c0486898edabcacbc9a69eb2d87004))
|
|
384
|
-
* support passport and jwt ([#1343](https://github.com/midwayjs/midway/issues/1343)) ([f26af4f](https://github.com/midwayjs/midway/commit/f26af4f3e16507d6f3ffe0467f8f5be69e6306d7))
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Module dependencies.
|
|
3
|
-
*/
|
|
4
|
-
declare const passport: any;
|
|
5
|
-
/**
|
|
6
|
-
* Passport's default/connect middleware.
|
|
7
|
-
*/
|
|
8
|
-
declare const _initialize: any;
|
|
9
|
-
declare const _authenticate: any;
|
|
10
|
-
declare const createReqMock: any;
|
|
11
|
-
/**
|
|
12
|
-
* Passport's initialization middleware for Koa.
|
|
13
|
-
*
|
|
14
|
-
* @return {GeneratorFunction}
|
|
15
|
-
* @api private
|
|
16
|
-
*/
|
|
17
|
-
declare function initialize(passport: any): (ctx: any, next: any) => Promise<any>;
|
|
18
|
-
/**
|
|
19
|
-
* Passport's authenticate middleware for Koa.
|
|
20
|
-
*
|
|
21
|
-
* @param {String|Array} name
|
|
22
|
-
* @param {Object} options
|
|
23
|
-
* @param {GeneratorFunction} callback
|
|
24
|
-
* @return {GeneratorFunction}
|
|
25
|
-
* @api private
|
|
26
|
-
*/
|
|
27
|
-
declare function authenticate(passport: any, name: any, options: any, callback: any): (ctx: any, next: any) => Promise<any>;
|
|
28
|
-
/**
|
|
29
|
-
* Passport's authorize middleware for Koa.
|
|
30
|
-
*
|
|
31
|
-
* @param {String|Array} name
|
|
32
|
-
* @param {Object} options
|
|
33
|
-
* @param {GeneratorFunction} callback
|
|
34
|
-
* @return {GeneratorFunction}
|
|
35
|
-
* @api private
|
|
36
|
-
*/
|
|
37
|
-
declare function authorize(passport: any, name: any, options: any, callback: any): (ctx: any, next: any) => Promise<any>;
|
|
38
|
-
declare function promisify(expressMiddleware: any): (req: any, res: any) => Promise<unknown>;
|
|
39
|
-
//# sourceMappingURL=koa.d.ts.map
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* Module dependencies.
|
|
4
|
-
*/
|
|
5
|
-
const passport = require('passport');
|
|
6
|
-
/**
|
|
7
|
-
* Passport's default/connect middleware.
|
|
8
|
-
*/
|
|
9
|
-
const _initialize = require('passport/lib/middleware/initialize');
|
|
10
|
-
const _authenticate = require('passport/lib/middleware/authenticate');
|
|
11
|
-
const createReqMock = require('./request').create;
|
|
12
|
-
/**
|
|
13
|
-
* Passport's initialization middleware for Koa.
|
|
14
|
-
*
|
|
15
|
-
* @return {GeneratorFunction}
|
|
16
|
-
* @api private
|
|
17
|
-
*/
|
|
18
|
-
function initialize(passport) {
|
|
19
|
-
const middleware = promisify(_initialize(passport));
|
|
20
|
-
return function passportInitialize(ctx, next) {
|
|
21
|
-
// koa <-> connect compatibility:
|
|
22
|
-
const userProperty = passport._userProperty || 'user';
|
|
23
|
-
// check ctx.req has the userProperty
|
|
24
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
25
|
-
if (!ctx.req.hasOwnProperty(userProperty)) {
|
|
26
|
-
Object.defineProperty(ctx.req, userProperty, {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return ctx.state[userProperty];
|
|
30
|
-
},
|
|
31
|
-
set: function (val) {
|
|
32
|
-
ctx.state[userProperty] = val;
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
// create mock object for express' req object
|
|
37
|
-
const req = createReqMock(ctx, userProperty);
|
|
38
|
-
// add Promise-based login method
|
|
39
|
-
const login = req.login;
|
|
40
|
-
ctx.login = ctx.logIn = function (user, options) {
|
|
41
|
-
return new Promise((resolve, reject) => {
|
|
42
|
-
// fix session manager missing
|
|
43
|
-
if (!req._sessionManager) {
|
|
44
|
-
req._sessionManager = passport._sm;
|
|
45
|
-
}
|
|
46
|
-
login.call(req, user, options, err => {
|
|
47
|
-
if (err)
|
|
48
|
-
reject(err);
|
|
49
|
-
else
|
|
50
|
-
resolve();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
// add aliases for passport's request extensions to Koa's context
|
|
55
|
-
ctx.logout = ctx.logOut = req.logout.bind(req);
|
|
56
|
-
ctx.isAuthenticated = req.isAuthenticated.bind(req);
|
|
57
|
-
ctx.isUnauthenticated = req.isUnauthenticated.bind(req);
|
|
58
|
-
return middleware(req, ctx).then(() => {
|
|
59
|
-
return next();
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Passport's authenticate middleware for Koa.
|
|
65
|
-
*
|
|
66
|
-
* @param {String|Array} name
|
|
67
|
-
* @param {Object} options
|
|
68
|
-
* @param {GeneratorFunction} callback
|
|
69
|
-
* @return {GeneratorFunction}
|
|
70
|
-
* @api private
|
|
71
|
-
*/
|
|
72
|
-
function authenticate(passport, name, options, callback) {
|
|
73
|
-
// normalize arguments
|
|
74
|
-
if (typeof options === 'function') {
|
|
75
|
-
callback = options;
|
|
76
|
-
options = {};
|
|
77
|
-
}
|
|
78
|
-
options = options || {};
|
|
79
|
-
if (callback) {
|
|
80
|
-
// When the callback is set, neither `next`, `res.redirect` or `res.end`
|
|
81
|
-
// are called. That is, a workaround to catch the `callback` is required.
|
|
82
|
-
// The `passportAuthenticate()` method below will therefore set
|
|
83
|
-
// `callback.resolve` and `callback.reject`. Then, once the authentication
|
|
84
|
-
// finishes, the modified callback calls the original one and afterwards
|
|
85
|
-
// triggers either `callback.resolve` or `callback.reject` to inform
|
|
86
|
-
// `passportAuthenticate()` that we are ready.
|
|
87
|
-
const _callback = callback;
|
|
88
|
-
callback = function (err, user, info, status) {
|
|
89
|
-
try {
|
|
90
|
-
Promise.resolve(_callback(err, user, info, status))
|
|
91
|
-
.then(() => callback.resolve(false))
|
|
92
|
-
.catch(err => callback.reject(err));
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
callback.reject(err);
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
const middleware = promisify(_authenticate(passport, name, options, callback));
|
|
100
|
-
return function passportAuthenticate(ctx, next) {
|
|
101
|
-
// this functions wraps the connect middleware
|
|
102
|
-
// to catch `next`, `res.redirect` and `res.end` calls
|
|
103
|
-
const p = new Promise((resolve, reject) => {
|
|
104
|
-
// mock the `req` object
|
|
105
|
-
const req = createReqMock(ctx, options.assignProperty || passport._userProperty || 'user');
|
|
106
|
-
function setBodyAndResolve(content) {
|
|
107
|
-
if (content)
|
|
108
|
-
ctx.body = content;
|
|
109
|
-
resolve(false);
|
|
110
|
-
}
|
|
111
|
-
// mock the `res` object
|
|
112
|
-
const res = {
|
|
113
|
-
redirect: function (url) {
|
|
114
|
-
ctx.redirect(url);
|
|
115
|
-
resolve(false);
|
|
116
|
-
},
|
|
117
|
-
set: ctx.set.bind(ctx),
|
|
118
|
-
setHeader: ctx.set.bind(ctx),
|
|
119
|
-
end: setBodyAndResolve,
|
|
120
|
-
send: setBodyAndResolve,
|
|
121
|
-
set statusCode(status) {
|
|
122
|
-
ctx.status = status;
|
|
123
|
-
},
|
|
124
|
-
get statusCode() {
|
|
125
|
-
return ctx.status;
|
|
126
|
-
},
|
|
127
|
-
};
|
|
128
|
-
req.res = res;
|
|
129
|
-
// update the custom callback above
|
|
130
|
-
if (callback) {
|
|
131
|
-
callback.resolve = resolve;
|
|
132
|
-
callback.reject = reject;
|
|
133
|
-
}
|
|
134
|
-
// call the connect middleware
|
|
135
|
-
middleware(req, res).then(resolve, reject);
|
|
136
|
-
});
|
|
137
|
-
return p.then(cont => {
|
|
138
|
-
// cont equals `false` when `res.redirect` or `res.end` got called
|
|
139
|
-
// in this case, call next to continue through Koa's middleware stack
|
|
140
|
-
if (cont !== false) {
|
|
141
|
-
return next();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Passport's authorize middleware for Koa.
|
|
148
|
-
*
|
|
149
|
-
* @param {String|Array} name
|
|
150
|
-
* @param {Object} options
|
|
151
|
-
* @param {GeneratorFunction} callback
|
|
152
|
-
* @return {GeneratorFunction}
|
|
153
|
-
* @api private
|
|
154
|
-
*/
|
|
155
|
-
function authorize(passport, name, options, callback) {
|
|
156
|
-
options = options || {};
|
|
157
|
-
options.assignProperty = 'account';
|
|
158
|
-
return authenticate(passport, name, options, callback);
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Framework support for Koa.
|
|
162
|
-
*
|
|
163
|
-
* This module provides support for using Passport with Koa. It exposes
|
|
164
|
-
* middleware that conform to the `fn*(next)` signature and extends
|
|
165
|
-
* Node's built-in HTTP request object with useful authentication-related
|
|
166
|
-
* functions.
|
|
167
|
-
*
|
|
168
|
-
* @return {Object}
|
|
169
|
-
* @api protected
|
|
170
|
-
*/
|
|
171
|
-
module.exports = function () {
|
|
172
|
-
return {
|
|
173
|
-
initialize: initialize,
|
|
174
|
-
authenticate: authenticate,
|
|
175
|
-
authorize: authorize,
|
|
176
|
-
};
|
|
177
|
-
};
|
|
178
|
-
function promisify(expressMiddleware) {
|
|
179
|
-
return function (req, res) {
|
|
180
|
-
return new Promise((resolve, reject) => {
|
|
181
|
-
expressMiddleware(req, res, (err, result) => {
|
|
182
|
-
if (err)
|
|
183
|
-
reject(err);
|
|
184
|
-
else
|
|
185
|
-
resolve(result);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
//# sourceMappingURL=koa.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
declare let keys: string[];
|
|
2
|
-
declare const properties: {
|
|
3
|
-
app: {
|
|
4
|
-
get: () => {
|
|
5
|
-
get: (key: any) => any;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
declare function getObject(ctx: any, key: any): any;
|
|
10
|
-
declare const IncomingMessageExt: any;
|
|
11
|
-
//# sourceMappingURL=request.d.ts.map
|
package/dist/proxy/index.d.ts
DELETED
package/dist/proxy/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.passport = exports.KoaPassport = void 0;
|
|
4
|
-
// prevent passport from monkey patching
|
|
5
|
-
const connect = require('passport/lib/framework/connect');
|
|
6
|
-
connect.__monkeypatchNode = function () { };
|
|
7
|
-
// load passport and add the koa framework
|
|
8
|
-
const originPassport = require('passport');
|
|
9
|
-
const Passport = require('passport').Passport;
|
|
10
|
-
const framework = require('./framework/koa')();
|
|
11
|
-
originPassport.framework(framework);
|
|
12
|
-
class KoaPassport extends Passport {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
this.framework(framework);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.KoaPassport = KoaPassport;
|
|
19
|
-
// Export default singleton.
|
|
20
|
-
exports.passport = originPassport;
|
|
21
|
-
//# sourceMappingURL=index.js.map
|