@midwayjs/passport 3.5.3 → 3.7.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.
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ $ npm i @types/passport --save-dev
|
|
|
29
29
|
import { join } from 'path';
|
|
30
30
|
import * as jwt from '@midwayjs/jwt';
|
|
31
31
|
import { ILifeCycle,} from '@midwayjs/core';
|
|
32
|
-
import { Configuration } from '@midwayjs/
|
|
32
|
+
import { Configuration } from '@midwayjs/core';
|
|
33
33
|
import * as passport from '@midwayjs/passport';
|
|
34
34
|
|
|
35
35
|
@Configuration({
|
|
@@ -83,7 +83,7 @@ export class LocalStrategy extends PassportStrategy(Strategy) {
|
|
|
83
83
|
```typescript
|
|
84
84
|
// local-middleware.ts
|
|
85
85
|
|
|
86
|
-
import { Inject, Provide } from '@midwayjs/
|
|
86
|
+
import { Inject, Provide } from '@midwayjs/core';
|
|
87
87
|
import { PassportMiddleware } from '@midwayjs/passport';
|
|
88
88
|
import { Context } from '@midwayjs/express';
|
|
89
89
|
|
|
@@ -101,7 +101,7 @@ export class LocalPassportMiddleware extends PassportMiddleware(LocalStrategy) {
|
|
|
101
101
|
```typescript
|
|
102
102
|
// controller.ts
|
|
103
103
|
|
|
104
|
-
import { Provide, Post, Inject, Controller } from '@midwayjs/
|
|
104
|
+
import { Provide, Post, Inject, Controller } from '@midwayjs/core';
|
|
105
105
|
|
|
106
106
|
@Provide()
|
|
107
107
|
@Controller('/')
|
|
@@ -159,7 +159,7 @@ export class JwtStrategy extends PassportStrategy(
|
|
|
159
159
|
```typescript
|
|
160
160
|
// jwt-middleware.ts
|
|
161
161
|
|
|
162
|
-
import { Provide } from '@midwayjs/
|
|
162
|
+
import { Provide } from '@midwayjs/core';
|
|
163
163
|
import { PassportMiddleware } from '@midwayjs/passport';
|
|
164
164
|
import { JwtStrategy } from './strategy/jwt-strategy';
|
|
165
165
|
|
|
@@ -172,8 +172,8 @@ export class JwtPassportMiddleware extends PassportMiddleware(JwtStrategy) {
|
|
|
172
172
|
|
|
173
173
|
```
|
|
174
174
|
```typescript
|
|
175
|
-
import { Provide, Post, Inject } from '@midwayjs/
|
|
176
|
-
import { Controller, Post } from '@midwayjs/
|
|
175
|
+
import { Provide, Post, Inject } from '@midwayjs/core';
|
|
176
|
+
import { Controller, Post } from '@midwayjs/core';
|
|
177
177
|
import { Jwt } from '@midwayjs/jwt';
|
|
178
178
|
|
|
179
179
|
@Provide()
|
|
@@ -251,7 +251,7 @@ export class GithubPassportMiddleware extends PassportMiddleware {
|
|
|
251
251
|
```typescript
|
|
252
252
|
// controller.ts
|
|
253
253
|
|
|
254
|
-
import { Provide, Get, Inject } from '@midwayjs/
|
|
254
|
+
import { Provide, Get, Inject } from '@midwayjs/core';
|
|
255
255
|
|
|
256
256
|
@Provide()
|
|
257
257
|
@Controller('/oauth')
|
package/dist/configuration.js
CHANGED
|
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PassportConfiguration = void 0;
|
|
13
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
14
13
|
const DefaultConfig = require("./config/config.default");
|
|
15
14
|
const core_1 = require("@midwayjs/core");
|
|
16
15
|
const authenticator_1 = require("./passport/authenticator");
|
|
@@ -20,15 +19,15 @@ let PassportConfiguration = class PassportConfiguration {
|
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
21
|
__decorate([
|
|
23
|
-
(0,
|
|
22
|
+
(0, core_1.Inject)(),
|
|
24
23
|
__metadata("design:type", core_1.MidwayApplicationManager)
|
|
25
24
|
], PassportConfiguration.prototype, "applicationManager", void 0);
|
|
26
25
|
__decorate([
|
|
27
|
-
(0,
|
|
26
|
+
(0, core_1.Inject)(),
|
|
28
27
|
__metadata("design:type", core_1.MidwayConfigService)
|
|
29
28
|
], PassportConfiguration.prototype, "configService", void 0);
|
|
30
29
|
PassportConfiguration = __decorate([
|
|
31
|
-
(0,
|
|
30
|
+
(0, core_1.Configuration)({
|
|
32
31
|
namespace: 'passport',
|
|
33
32
|
importConfigs: [
|
|
34
33
|
{
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CustomStrategy = void 0;
|
|
4
|
-
const
|
|
4
|
+
const core_1 = require("@midwayjs/core");
|
|
5
5
|
function CustomStrategy() {
|
|
6
6
|
return target => {
|
|
7
|
-
(0,
|
|
8
|
-
(0,
|
|
7
|
+
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)(target);
|
|
8
|
+
(0, core_1.Provide)()(target);
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
exports.CustomStrategy = CustomStrategy;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { IMidwayContainer } from '@midwayjs/core';
|
|
2
3
|
import { AuthenticateOptions } from '../interface';
|
|
3
4
|
import { Strategy } from './strategy';
|
|
4
|
-
import { IMidwayContainer } from '@midwayjs/core';
|
|
5
5
|
import { IncomingMessage } from 'http';
|
|
6
6
|
export declare class PassportAuthenticator {
|
|
7
7
|
private strategies;
|
|
@@ -10,9 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PassportAuthenticator = void 0;
|
|
13
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
14
|
-
const session_stratey_1 = require("./session.stratey");
|
|
15
13
|
const core_1 = require("@midwayjs/core");
|
|
14
|
+
const session_stratey_1 = require("./session.stratey");
|
|
16
15
|
let PassportAuthenticator = class PassportAuthenticator {
|
|
17
16
|
constructor() {
|
|
18
17
|
this.strategies = new Map();
|
|
@@ -418,22 +417,22 @@ let PassportAuthenticator = class PassportAuthenticator {
|
|
|
418
417
|
}
|
|
419
418
|
};
|
|
420
419
|
__decorate([
|
|
421
|
-
(0,
|
|
420
|
+
(0, core_1.ApplicationContext)(),
|
|
422
421
|
__metadata("design:type", Object)
|
|
423
422
|
], PassportAuthenticator.prototype, "applicationContext", void 0);
|
|
424
423
|
__decorate([
|
|
425
|
-
(0,
|
|
424
|
+
(0, core_1.Config)('passport'),
|
|
426
425
|
__metadata("design:type", Object)
|
|
427
426
|
], PassportAuthenticator.prototype, "passportConfig", void 0);
|
|
428
427
|
__decorate([
|
|
429
|
-
(0,
|
|
428
|
+
(0, core_1.Init)(),
|
|
430
429
|
__metadata("design:type", Function),
|
|
431
430
|
__metadata("design:paramtypes", []),
|
|
432
431
|
__metadata("design:returntype", void 0)
|
|
433
432
|
], PassportAuthenticator.prototype, "init", null);
|
|
434
433
|
PassportAuthenticator = __decorate([
|
|
435
|
-
(0,
|
|
436
|
-
(0,
|
|
434
|
+
(0, core_1.Provide)(),
|
|
435
|
+
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
|
437
436
|
], PassportAuthenticator);
|
|
438
437
|
exports.PassportAuthenticator = PassportAuthenticator;
|
|
439
438
|
//# sourceMappingURL=authenticator.js.map
|
|
@@ -10,9 +10,8 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PassportMiddleware = exports.PassportStrategy = void 0;
|
|
13
|
-
const decorator_1 = require("@midwayjs/decorator");
|
|
14
|
-
const interface_1 = require("../interface");
|
|
15
13
|
const core_1 = require("@midwayjs/core");
|
|
14
|
+
const interface_1 = require("../interface");
|
|
16
15
|
const authenticator_1 = require("./authenticator");
|
|
17
16
|
const strategy_1 = require("./strategy");
|
|
18
17
|
const request_1 = require("./request");
|
|
@@ -59,11 +58,11 @@ function PassportStrategy(Strategy, name) {
|
|
|
59
58
|
}
|
|
60
59
|
}
|
|
61
60
|
__decorate([
|
|
62
|
-
(0,
|
|
61
|
+
(0, core_1.Inject)(),
|
|
63
62
|
__metadata("design:type", authenticator_1.PassportAuthenticator)
|
|
64
63
|
], InnerStrategyAbstractClass.prototype, "passport", void 0);
|
|
65
64
|
__decorate([
|
|
66
|
-
(0,
|
|
65
|
+
(0, core_1.Init)(),
|
|
67
66
|
__metadata("design:type", Function),
|
|
68
67
|
__metadata("design:paramtypes", []),
|
|
69
68
|
__metadata("design:returntype", Promise)
|
|
@@ -403,15 +402,15 @@ function PassportMiddleware(strategy) {
|
|
|
403
402
|
}
|
|
404
403
|
}
|
|
405
404
|
__decorate([
|
|
406
|
-
(0,
|
|
405
|
+
(0, core_1.Config)('passport'),
|
|
407
406
|
__metadata("design:type", Object)
|
|
408
407
|
], InnerPassportMiddleware.prototype, "passportConfig", void 0);
|
|
409
408
|
__decorate([
|
|
410
|
-
(0,
|
|
409
|
+
(0, core_1.App)(),
|
|
411
410
|
__metadata("design:type", Object)
|
|
412
411
|
], InnerPassportMiddleware.prototype, "app", void 0);
|
|
413
412
|
__decorate([
|
|
414
|
-
(0,
|
|
413
|
+
(0, core_1.Inject)(),
|
|
415
414
|
__metadata("design:type", authenticator_1.PassportAuthenticator)
|
|
416
415
|
], InnerPassportMiddleware.prototype, "passport", void 0);
|
|
417
416
|
return InnerPassportMiddleware;
|
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
|
+
"version": "3.7.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -22,18 +22,17 @@
|
|
|
22
22
|
"author": "Nawbc",
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@midwayjs/core": "^3.
|
|
26
|
-
"@midwayjs/
|
|
27
|
-
"@midwayjs/
|
|
28
|
-
"@midwayjs/
|
|
29
|
-
"@midwayjs/
|
|
30
|
-
"@midwayjs/
|
|
31
|
-
"@midwayjs/web": "^3.5.3",
|
|
25
|
+
"@midwayjs/core": "^3.7.0",
|
|
26
|
+
"@midwayjs/express": "^3.7.0",
|
|
27
|
+
"@midwayjs/jwt": "^3.7.0",
|
|
28
|
+
"@midwayjs/koa": "^3.7.0",
|
|
29
|
+
"@midwayjs/mock": "^3.7.0",
|
|
30
|
+
"@midwayjs/web": "^3.7.0",
|
|
32
31
|
"@types/passport-local": "1.0.34",
|
|
33
32
|
"express-session": "1.17.3",
|
|
34
33
|
"passport-jwt": "4.0.0",
|
|
35
34
|
"passport-local": "1.0.0",
|
|
36
35
|
"passport-openidconnect": "0.1.1"
|
|
37
36
|
},
|
|
38
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "99386083ee26b386fd508b9c892091c914e77535"
|
|
39
38
|
}
|