@midwayjs/passport 3.12.3 → 3.12.8
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.
|
@@ -88,12 +88,13 @@ let PassportAuthenticator = class PassportAuthenticator {
|
|
|
88
88
|
const failures = [];
|
|
89
89
|
let shouldBreak = false;
|
|
90
90
|
let successResult, redirectResult;
|
|
91
|
-
for (const
|
|
91
|
+
for (const strategyOrigin of []
|
|
92
92
|
.concat(Array.from(this.strategies.values()))
|
|
93
93
|
.concat(strategies)) {
|
|
94
94
|
if (shouldBreak) {
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
97
|
+
const strategy = Object.create(strategyOrigin);
|
|
97
98
|
await new Promise((resolve, reject) => {
|
|
98
99
|
// ----- BEGIN STRATEGY AUGMENTATION -----
|
|
99
100
|
// Augment the new strategy instance with action functions. These action
|
|
@@ -18,20 +18,20 @@ const request_1 = require("./request");
|
|
|
18
18
|
function PassportStrategy(Strategy, name) {
|
|
19
19
|
class InnerStrategyAbstractClass extends strategy_1.AbstractStrategyWrapper {
|
|
20
20
|
async init() {
|
|
21
|
-
const cb =
|
|
21
|
+
const cb = (...params) => {
|
|
22
22
|
const done = params[params.length - 1];
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Promise.resolve(this.validate(...params))
|
|
24
|
+
.then(result => {
|
|
25
25
|
if (Array.isArray(result)) {
|
|
26
26
|
done(null, ...result);
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
done(null, result);
|
|
30
30
|
}
|
|
31
|
-
}
|
|
32
|
-
|
|
31
|
+
})
|
|
32
|
+
.catch(err => {
|
|
33
33
|
done(err, null);
|
|
34
|
-
}
|
|
34
|
+
});
|
|
35
35
|
};
|
|
36
36
|
Object.defineProperty(cb, 'length', {
|
|
37
37
|
value: this.validate.length + 1,
|
|
@@ -91,16 +91,12 @@ function PassportMiddleware(strategy) {
|
|
|
91
91
|
...this.passportConfig,
|
|
92
92
|
...options,
|
|
93
93
|
};
|
|
94
|
-
const strategyList = [];
|
|
95
94
|
for (const strategySingle of strategy) {
|
|
96
|
-
//
|
|
97
|
-
|
|
98
|
-
.getApplicationContext()
|
|
99
|
-
.getAsync(strategySingle);
|
|
100
|
-
strategyList.push(strategyInstance.getStrategy());
|
|
95
|
+
// int strategy
|
|
96
|
+
await this.app.getApplicationContext().getAsync(strategySingle);
|
|
101
97
|
}
|
|
102
98
|
// authenticate
|
|
103
|
-
const authenticate = this.passport.authenticate(
|
|
99
|
+
const authenticate = this.passport.authenticate([], authOptions);
|
|
104
100
|
let authenticateResult;
|
|
105
101
|
try {
|
|
106
102
|
authenticateResult = await authenticate(req);
|
|
@@ -170,16 +166,12 @@ function PassportMiddleware(strategy) {
|
|
|
170
166
|
...this.passportConfig,
|
|
171
167
|
...options,
|
|
172
168
|
};
|
|
173
|
-
const strategyList = [];
|
|
174
169
|
for (const strategySingle of strategy) {
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
.getApplicationContext()
|
|
178
|
-
.getAsync(strategySingle);
|
|
179
|
-
strategyList.push(strategyInstance.getStrategy());
|
|
170
|
+
// int strategy
|
|
171
|
+
await this.app.getApplicationContext().getAsync(strategySingle);
|
|
180
172
|
}
|
|
181
173
|
// authenticate
|
|
182
|
-
const authenticate = this.passport.authenticate(
|
|
174
|
+
const authenticate = this.passport.authenticate([], authOptions);
|
|
183
175
|
let authenticateResult;
|
|
184
176
|
try {
|
|
185
177
|
authenticateResult = await authenticate(req);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/passport",
|
|
3
3
|
"description": "midway passport component",
|
|
4
|
-
"version": "3.12.
|
|
4
|
+
"version": "3.12.8",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@midwayjs/core": "^3.12.3",
|
|
26
|
-
"@midwayjs/express": "^3.12.
|
|
27
|
-
"@midwayjs/jwt": "^3.12.
|
|
28
|
-
"@midwayjs/koa": "^3.12.
|
|
29
|
-
"@midwayjs/mock": "^3.12.
|
|
30
|
-
"@midwayjs/web": "^3.12.
|
|
31
|
-
"@types/passport-local": "1.0.
|
|
26
|
+
"@midwayjs/express": "^3.12.8",
|
|
27
|
+
"@midwayjs/jwt": "^3.12.8",
|
|
28
|
+
"@midwayjs/koa": "^3.12.8",
|
|
29
|
+
"@midwayjs/mock": "^3.12.8",
|
|
30
|
+
"@midwayjs/web": "^3.12.8",
|
|
31
|
+
"@types/passport-local": "1.0.37",
|
|
32
32
|
"express-session": "1.17.3",
|
|
33
33
|
"passport-jwt": "4.0.1",
|
|
34
34
|
"passport-local": "1.0.0",
|
|
35
35
|
"passport-openidconnect": "0.1.1"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "598bf3584d655d41889237010edd8b3223d8f059"
|
|
38
38
|
}
|