@tsed/passport 6.101.0 → 6.102.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/lib/cjs/PassportModule.js +5 -1
- package/lib/cjs/PassportModule.js.map +1 -1
- package/lib/cjs/interfaces/index.js.map +1 -1
- package/lib/esm/PassportModule.js +5 -1
- package/lib/esm/PassportModule.js.map +1 -1
- package/lib/esm/interfaces/index.js.map +1 -1
- package/lib/types/PassportModule.d.ts +1 -0
- package/lib/types/interfaces/index.d.ts +3 -0
- package/package.json +10 -10
|
@@ -27,7 +27,7 @@ let PassportModule = class PassportModule {
|
|
|
27
27
|
switch (this.platformName) {
|
|
28
28
|
case "express":
|
|
29
29
|
this.app.use(passport_1.default.initialize({ userProperty }));
|
|
30
|
-
this.app.use(passport_1.default.session({ pauseStream }));
|
|
30
|
+
!this.disableSession && this.app.use(passport_1.default.session({ pauseStream }));
|
|
31
31
|
return;
|
|
32
32
|
default:
|
|
33
33
|
this.logger.warn(`Platform "${this.platformName}" not supported by @tsed/passport`);
|
|
@@ -42,6 +42,10 @@ let PassportModule = class PassportModule {
|
|
|
42
42
|
(0, common_1.Constant)("passport.pauseStream"),
|
|
43
43
|
(0, tslib_1.__metadata)("design:type", Boolean)
|
|
44
44
|
], PassportModule.prototype, "pauseStream", void 0);
|
|
45
|
+
(0, tslib_1.__decorate)([
|
|
46
|
+
(0, common_1.Constant)("passport.disableSession", false),
|
|
47
|
+
(0, tslib_1.__metadata)("design:type", Boolean)
|
|
48
|
+
], PassportModule.prototype, "disableSession", void 0);
|
|
45
49
|
(0, tslib_1.__decorate)([
|
|
46
50
|
(0, common_1.Constant)("PLATFORM_NAME"),
|
|
47
51
|
(0, tslib_1.__metadata)("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PassportModule.js","sourceRoot":"","sources":["../../src/PassportModule.ts"],"names":[],"mappings":";;;;AAAA,yCAAsI;AACtI,qEAAgC;AAChC,o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AC,cAAc,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAQ,CAAC,OAAO,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC,CAAC;gBAEtE,OAAO;YAET;gBACE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,YAAY,mCAAmC,CAAC,CAAC;SACvF;IACH,CAAC;CACF,CAAA;AA3CC;IADC,IAAA,iBAAQ,EAAC,uBAAuB,CAAC;;oDACb;AAGrB;IADC,IAAA,iBAAQ,EAAC,sBAAsB,CAAC;;mDACZ;AAGrB;IADC,IAAA,iBAAQ,EAAC,yBAAyB,EAAE,KAAK,CAAC;;sDACnB;AAGxB;IADC,IAAA,iBAAQ,EAAC,eAAe,CAAC;;oDACL;AAGrB;IADC,IAAA,eAAM,GAAE;2CACD,eAAM;8CAAC;AAdJ,cAAc;IAH1B,IAAA,eAAM,EAAC;QACN,KAAK,EAAE,sBAAa,CAAC,SAAS;KAC/B,CAAC;kDAkBe,4BAAmB;QACN,mCAAgB;QACd,qDAAyB;GAnB5C,cAAc,CA6C1B;AA7CY,wCAAc","sourcesContent":["import {BeforeRoutesInit, Constant, Inject, Module, OnInit, PlatformApplication, Provider, ProviderScope, Logger} from \"@tsed/common\";\nimport Passport from \"passport\";\nimport {PassportSerializerService} from \"./services/PassportSerializerService\";\nimport {ProtocolsService} from \"./services/ProtocolsService\";\n\n/**\n * @ignore\n */\n@Module({\n scope: ProviderScope.SINGLETON\n})\nexport class PassportModule implements OnInit, BeforeRoutesInit {\n @Constant(\"passport.userProperty\")\n userProperty: string;\n\n @Constant(\"passport.pauseStream\")\n pauseStream: boolean;\n\n @Constant(\"passport.disableSession\", false)\n disableSession: boolean;\n\n @Constant(\"PLATFORM_NAME\")\n platformName: string;\n\n @Inject()\n logger: Logger;\n\n constructor(\n private app: PlatformApplication,\n private protocolsService: ProtocolsService,\n private passportSerializer: PassportSerializerService\n ) {}\n\n async $onInit(): Promise<any> {\n Passport.serializeUser(this.passportSerializer.serialize.bind(this.passportSerializer));\n Passport.deserializeUser(this.passportSerializer.deserialize.bind(this.passportSerializer));\n\n const promises = this.protocolsService.getProtocols().map((provider: Provider) => this.protocolsService.invoke(provider));\n\n await Promise.all(promises);\n return undefined;\n }\n\n $beforeRoutesInit(): void | Promise<any> {\n const {userProperty, pauseStream} = this;\n switch (this.platformName) {\n case \"express\":\n this.app.use(Passport.initialize({userProperty}));\n !this.disableSession && this.app.use(Passport.session({pauseStream}));\n\n return;\n\n default:\n this.logger.warn(`Platform \"${this.platformName}\" not supported by @tsed/passport`);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAqBA,iEAAkC;AAClC,iEAAkC;AAClC,2DAA4B;AAC5B,0DAA2B;AAC3B,+DAAgC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {PassportStatic} from \"passport\";\nimport {ProtocolOptions} from \"./ProtocolOptions\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n passport: {\n userProperty?: string;\n pauseStream?: string;\n disableSession?: boolean;\n userInfoModel?: Type<any> | false;\n module?: PassportStatic;\n protocols?: {\n [protocolName: string]: Partial<ProtocolOptions>;\n };\n };\n }\n }\n}\n\nexport * from \"./ProtocolOptions\";\nexport * from \"./ProtocolMethods\";\nexport * from \"./OnInstall\";\nexport * from \"./OnVerify\";\nexport * from \"./BeforeInstall\";\n"]}
|
|
@@ -24,7 +24,7 @@ let PassportModule = class PassportModule {
|
|
|
24
24
|
switch (this.platformName) {
|
|
25
25
|
case "express":
|
|
26
26
|
this.app.use(Passport.initialize({ userProperty }));
|
|
27
|
-
this.app.use(Passport.session({ pauseStream }));
|
|
27
|
+
!this.disableSession && this.app.use(Passport.session({ pauseStream }));
|
|
28
28
|
return;
|
|
29
29
|
default:
|
|
30
30
|
this.logger.warn(`Platform "${this.platformName}" not supported by @tsed/passport`);
|
|
@@ -39,6 +39,10 @@ __decorate([
|
|
|
39
39
|
Constant("passport.pauseStream"),
|
|
40
40
|
__metadata("design:type", Boolean)
|
|
41
41
|
], PassportModule.prototype, "pauseStream", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
Constant("passport.disableSession", false),
|
|
44
|
+
__metadata("design:type", Boolean)
|
|
45
|
+
], PassportModule.prototype, "disableSession", void 0);
|
|
42
46
|
__decorate([
|
|
43
47
|
Constant("PLATFORM_NAME"),
|
|
44
48
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PassportModule.js","sourceRoot":"","sources":["../../src/PassportModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAU,mBAAmB,EAAY,aAAa,EAAE,MAAM,EAAC,MAAM,cAAc,CAAC;AACtI,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,yBAAyB,EAAC,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AAE7D;;GAEG;AAIH,IAAa,cAAc,GAA3B,MAAa,cAAc;
|
|
1
|
+
{"version":3,"file":"PassportModule.js","sourceRoot":"","sources":["../../src/PassportModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAmB,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAU,mBAAmB,EAAY,aAAa,EAAE,MAAM,EAAC,MAAM,cAAc,CAAC;AACtI,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,yBAAyB,EAAC,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAC;AAE7D;;GAEG;AAIH,IAAa,cAAc,GAA3B,MAAa,cAAc;IAgBzB,YACU,GAAwB,EACxB,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;IADC,QAAQ,CAAC,sBAAsB,CAAC;;mDACZ;AAGrB;IADC,QAAQ,CAAC,yBAAyB,EAAE,KAAK,CAAC;;sDACnB;AAGxB;IADC,QAAQ,CAAC,eAAe,CAAC;;oDACL;AAGrB;IADC,MAAM,EAAE;8BACD,MAAM;8CAAC;AAdJ,cAAc;IAH1B,MAAM,CAAC;QACN,KAAK,EAAE,aAAa,CAAC,SAAS;KAC/B,CAAC;qCAkBe,mBAAmB;QACN,gBAAgB;QACd,yBAAyB;GAnB5C,cAAc,CA6C1B;SA7CY,cAAc","sourcesContent":["import {BeforeRoutesInit, Constant, Inject, Module, OnInit, PlatformApplication, Provider, ProviderScope, Logger} from \"@tsed/common\";\nimport Passport from \"passport\";\nimport {PassportSerializerService} from \"./services/PassportSerializerService\";\nimport {ProtocolsService} from \"./services/ProtocolsService\";\n\n/**\n * @ignore\n */\n@Module({\n scope: ProviderScope.SINGLETON\n})\nexport class PassportModule implements OnInit, BeforeRoutesInit {\n @Constant(\"passport.userProperty\")\n userProperty: string;\n\n @Constant(\"passport.pauseStream\")\n pauseStream: boolean;\n\n @Constant(\"passport.disableSession\", false)\n disableSession: boolean;\n\n @Constant(\"PLATFORM_NAME\")\n platformName: string;\n\n @Inject()\n logger: Logger;\n\n constructor(\n private app: PlatformApplication,\n private protocolsService: ProtocolsService,\n private passportSerializer: PassportSerializerService\n ) {}\n\n async $onInit(): Promise<any> {\n Passport.serializeUser(this.passportSerializer.serialize.bind(this.passportSerializer));\n Passport.deserializeUser(this.passportSerializer.deserialize.bind(this.passportSerializer));\n\n const promises = this.protocolsService.getProtocols().map((provider: Provider) => this.protocolsService.invoke(provider));\n\n await Promise.all(promises);\n return undefined;\n }\n\n $beforeRoutesInit(): void | Promise<any> {\n const {userProperty, pauseStream} = this;\n switch (this.platformName) {\n case \"express\":\n this.app.use(Passport.initialize({userProperty}));\n !this.disableSession && this.app.use(Passport.session({pauseStream}));\n\n return;\n\n default:\n this.logger.warn(`Platform \"${this.platformName}\" not supported by @tsed/passport`);\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAqBA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {PassportStatic} from \"passport\";\nimport {ProtocolOptions} from \"./ProtocolOptions\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n passport: {\n userProperty?: string;\n pauseStream?: string;\n disableSession?: boolean;\n userInfoModel?: Type<any> | false;\n module?: PassportStatic;\n protocols?: {\n [protocolName: string]: Partial<ProtocolOptions>;\n };\n };\n }\n }\n}\n\nexport * from \"./ProtocolOptions\";\nexport * from \"./ProtocolMethods\";\nexport * from \"./OnInstall\";\nexport * from \"./OnVerify\";\nexport * from \"./BeforeInstall\";\n"]}
|
|
@@ -10,6 +10,7 @@ export declare class PassportModule implements OnInit, BeforeRoutesInit {
|
|
|
10
10
|
private passportSerializer;
|
|
11
11
|
userProperty: string;
|
|
12
12
|
pauseStream: boolean;
|
|
13
|
+
disableSession: boolean;
|
|
13
14
|
platformName: string;
|
|
14
15
|
logger: Logger;
|
|
15
16
|
constructor(app: PlatformApplication, protocolsService: ProtocolsService, passportSerializer: PassportSerializerService);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Type } from "@tsed/core";
|
|
2
|
+
import { PassportStatic } from "passport";
|
|
2
3
|
import { ProtocolOptions } from "./ProtocolOptions";
|
|
3
4
|
declare global {
|
|
4
5
|
namespace TsED {
|
|
@@ -6,7 +7,9 @@ declare global {
|
|
|
6
7
|
passport: {
|
|
7
8
|
userProperty?: string;
|
|
8
9
|
pauseStream?: string;
|
|
10
|
+
disableSession?: boolean;
|
|
9
11
|
userInfoModel?: Type<any> | false;
|
|
12
|
+
module?: PassportStatic;
|
|
10
13
|
protocols?: {
|
|
11
14
|
[protocolName: string]: Partial<ProtocolOptions>;
|
|
12
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/passport",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.102.0",
|
|
4
4
|
"description": "Passport package for Ts.ED framework",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"tslib": "2.2.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@tsed/common": "6.
|
|
26
|
-
"@tsed/core": "6.
|
|
27
|
-
"@tsed/di": "6.
|
|
25
|
+
"@tsed/common": "6.102.0",
|
|
26
|
+
"@tsed/core": "6.102.0",
|
|
27
|
+
"@tsed/di": "6.102.0",
|
|
28
28
|
"@types/passport": "1.0.4",
|
|
29
29
|
"@types/passport-http": "0.3.8",
|
|
30
30
|
"@types/passport-local": "1.0.34",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"passport-strategy": "1.0.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@tsed/common": "^6.
|
|
39
|
-
"@tsed/core": "^6.
|
|
40
|
-
"@tsed/di": "^6.
|
|
41
|
-
"@tsed/json-mapper": "^6.
|
|
38
|
+
"@tsed/common": "^6.102.0",
|
|
39
|
+
"@tsed/core": "^6.102.0",
|
|
40
|
+
"@tsed/di": "^6.102.0",
|
|
41
|
+
"@tsed/json-mapper": "^6.102.0",
|
|
42
42
|
"@tsed/logger": ">=6.0.0",
|
|
43
|
-
"@tsed/openspec": "^6.
|
|
44
|
-
"@tsed/schema": "^6.
|
|
43
|
+
"@tsed/openspec": "^6.102.0",
|
|
44
|
+
"@tsed/schema": "^6.102.0",
|
|
45
45
|
"passport": ">=0.4.1",
|
|
46
46
|
"passport-http": ">=0.3.0",
|
|
47
47
|
"passport-local": ">=1.0.0",
|