@tsed/passport 7.0.0-beta.3 → 7.0.0-beta.4
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/jest.config.js +14 -0
- package/lib/cjs/PassportModule.js +19 -14
- package/lib/cjs/PassportModule.js.map +1 -1
- package/lib/cjs/contants/{index.js → constants.js} +1 -1
- package/lib/cjs/contants/constants.js.map +1 -0
- package/lib/cjs/decorators/protocol.js +2 -2
- package/lib/cjs/decorators/protocol.js.map +1 -1
- package/lib/cjs/domain/UserInfo.js +6 -6
- package/lib/cjs/index.js +21 -16
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/interfaces/BeforeInstall.js +3 -0
- package/lib/cjs/interfaces/BeforeInstall.js.map +1 -0
- package/lib/cjs/interfaces/OnInstall.js.map +1 -1
- package/lib/cjs/interfaces/ProtocolMethods.js +3 -0
- package/lib/cjs/interfaces/ProtocolMethods.js.map +1 -0
- package/lib/cjs/interfaces/ProtocolOptions.js.map +1 -1
- package/lib/cjs/interfaces/{IProtocol.js → interfaces.js} +1 -1
- package/lib/cjs/interfaces/interfaces.js.map +1 -0
- package/lib/cjs/middlewares/PassportMiddleware.js +8 -8
- package/lib/cjs/middlewares/PassportMiddleware.js.map +1 -1
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/services/PassportSerializerService.js +3 -3
- package/lib/cjs/services/ProtocolsService.js +22 -14
- package/lib/cjs/services/ProtocolsService.js.map +1 -1
- package/lib/esm/PassportModule.js +10 -5
- package/lib/esm/PassportModule.js.map +1 -1
- package/lib/esm/contants/{index.js → constants.js} +1 -1
- package/lib/esm/contants/constants.js.map +1 -0
- package/lib/esm/decorators/authenticate.js +1 -1
- package/lib/esm/decorators/authorize.js +1 -1
- package/lib/esm/decorators/protocol.js +1 -1
- package/lib/esm/decorators/protocol.js.map +1 -1
- package/lib/esm/index.js +21 -16
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/interfaces/BeforeInstall.js +2 -0
- package/lib/esm/interfaces/BeforeInstall.js.map +1 -0
- package/lib/esm/interfaces/OnInstall.js.map +1 -1
- package/lib/esm/interfaces/ProtocolMethods.js +2 -0
- package/lib/esm/interfaces/ProtocolMethods.js.map +1 -0
- package/lib/esm/interfaces/ProtocolOptions.js.map +1 -1
- package/lib/esm/interfaces/interfaces.js +2 -0
- package/lib/esm/interfaces/interfaces.js.map +1 -0
- package/lib/esm/middlewares/PassportMiddleware.js +2 -2
- package/lib/esm/package.json +3 -0
- package/lib/esm/services/PassportSerializerService.js +1 -1
- package/lib/esm/services/ProtocolsService.js +20 -12
- package/lib/esm/services/ProtocolsService.js.map +1 -1
- package/lib/types/PassportModule.d.ts +2 -1
- package/lib/types/contants/{index.d.ts → constants.d.ts} +0 -0
- package/lib/types/index.d.ts +15 -6
- package/lib/types/interfaces/BeforeInstall.d.ts +3 -0
- package/lib/types/interfaces/OnInstall.d.ts +1 -1
- package/lib/types/interfaces/ProtocolMethods.d.ts +10 -0
- package/lib/types/interfaces/ProtocolOptions.d.ts +2 -2
- package/lib/types/interfaces/{index.d.ts → interfaces.d.ts} +3 -4
- package/lib/types/services/ProtocolsService.d.ts +2 -1
- package/package.json +21 -21
- package/readme.md +15 -17
- package/tsconfig.compile.esm.json +1 -12
- package/lib/cjs/contants/index.js.map +0 -1
- package/lib/cjs/interfaces/IProtocol.js.map +0 -1
- package/lib/cjs/interfaces/index.js +0 -8
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/esm/contants/index.js.map +0 -1
- package/lib/esm/interfaces/IProtocol.js +0 -2
- package/lib/esm/interfaces/IProtocol.js.map +0 -1
- package/lib/esm/interfaces/index.js +0 -5
- package/lib/esm/interfaces/index.js.map +0 -1
- package/lib/types/interfaces/IProtocol.d.ts +0 -4
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iCAAiC,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./PassportModule\";\nexport * from \"./contants/constants\";\nexport * from \"./decorators/args\";\nexport * from \"./decorators/authenticate\";\nexport * from \"./decorators/authorize\";\nexport * from \"./decorators/protocol\";\nexport * from \"./domain/UserInfo\";\nexport * from \"./errors/PassportException\";\nexport * from \"./interfaces/BeforeInstall\";\nexport * from \"./interfaces/OnInstall\";\nexport * from \"./interfaces/OnVerify\";\nexport * from \"./interfaces/ProtocolMethods\";\nexport * from \"./interfaces/ProtocolOptions\";\nexport * from \"./interfaces/interfaces\";\nexport * from \"./middlewares/PassportMiddleware\";\nexport * from \"./services/PassportSerializerService\";\nexport * from \"./services/ProtocolsService\";\nexport * from \"./utils/getProtocolsFromRequest\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BeforeInstall.js","sourceRoot":"","sources":["../../../src/interfaces/BeforeInstall.ts"],"names":[],"mappings":"","sourcesContent":["export interface BeforeInstall<Settings = any> {\n $beforeInstall(setting: Settings): Promise<Settings> | Settings | void;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnInstall.js","sourceRoot":"","sources":["../../../src/interfaces/OnInstall.ts"],"names":[],"mappings":"","sourcesContent":["import {Strategy} from \"passport\";\n\nexport interface OnInstall {\n $onInstall(strategy: Strategy): void
|
|
1
|
+
{"version":3,"file":"OnInstall.js","sourceRoot":"","sources":["../../../src/interfaces/OnInstall.ts"],"names":[],"mappings":"","sourcesContent":["import {Strategy} from \"passport\";\n\nexport interface OnInstall {\n $onInstall(strategy: Strategy): void | Promise<void>;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProtocolMethods.js","sourceRoot":"","sources":["../../../src/interfaces/ProtocolMethods.ts"],"names":[],"mappings":"","sourcesContent":["import {OnInstall} from \"./OnInstall\";\nimport {OnVerify} from \"./OnVerify\";\nimport {BeforeInstall} from \"./BeforeInstall\";\n\n/**\n * @deprecated Use ProtocolMethods instead\n */\nexport interface IProtocol<Settings = any> extends OnVerify, OnInstall, BeforeInstall<Settings> {}\nexport interface ProtocolMethods<Settings = any> extends OnVerify, OnInstall, BeforeInstall<Settings> {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProtocolOptions.js","sourceRoot":"","sources":["../../../src/interfaces/ProtocolOptions.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {Strategy} from \"passport\";\n\nexport interface ProtocolOptions<
|
|
1
|
+
{"version":3,"file":"ProtocolOptions.js","sourceRoot":"","sources":["../../../src/interfaces/ProtocolOptions.ts"],"names":[],"mappings":"","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {Strategy} from \"passport\";\n\nexport interface ProtocolOptions<Settings = any> {\n name: string;\n useStrategy: Type<Strategy>;\n settings: Settings;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/interfaces.ts"],"names":[],"mappings":"","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"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var PassportMiddleware_1;
|
|
2
2
|
import { __decorate, __metadata, __param } from "tslib";
|
|
3
3
|
import { Context, Inject, Middleware } from "@tsed/common";
|
|
4
|
-
import { ProtocolsService } from "../services/ProtocolsService";
|
|
5
|
-
import { getProtocolsFromRequest } from "../utils/getProtocolsFromRequest";
|
|
4
|
+
import { ProtocolsService } from "../services/ProtocolsService.js";
|
|
5
|
+
import { getProtocolsFromRequest } from "../utils/getProtocolsFromRequest.js";
|
|
6
6
|
let PassportMiddleware = PassportMiddleware_1 = class PassportMiddleware {
|
|
7
7
|
shouldSkip(ctx) {
|
|
8
8
|
const request = ctx.getRequest();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
2
|
import { Constant, Service } from "@tsed/di";
|
|
3
3
|
import { deserialize, serialize } from "@tsed/json-mapper";
|
|
4
|
-
import { UserInfo } from "../domain/UserInfo";
|
|
4
|
+
import { UserInfo } from "../domain/UserInfo.js";
|
|
5
5
|
/**
|
|
6
6
|
* @ignore
|
|
7
7
|
*/
|
|
@@ -4,8 +4,8 @@ import { ancestorsOf } from "@tsed/core";
|
|
|
4
4
|
import { Injectable, InjectorService } from "@tsed/di";
|
|
5
5
|
import { Unauthorized } from "@tsed/exceptions";
|
|
6
6
|
import Passport, { Strategy } from "passport";
|
|
7
|
-
import { PassportException } from "../errors/PassportException";
|
|
8
|
-
import { PROVIDER_TYPE_PROTOCOL } from "../contants";
|
|
7
|
+
import { PassportException } from "../errors/PassportException.js";
|
|
8
|
+
import { PROVIDER_TYPE_PROTOCOL } from "../contants/constants.js";
|
|
9
9
|
import { promisify } from "util";
|
|
10
10
|
/**
|
|
11
11
|
* @ignore
|
|
@@ -16,7 +16,7 @@ let ProtocolsService = class ProtocolsService {
|
|
|
16
16
|
this.strategies = new Map();
|
|
17
17
|
}
|
|
18
18
|
getProtocols() {
|
|
19
|
-
return
|
|
19
|
+
return this.injector.getProviders(PROVIDER_TYPE_PROTOCOL);
|
|
20
20
|
}
|
|
21
21
|
getProtocolsNames() {
|
|
22
22
|
return Array.from(this.strategies.keys());
|
|
@@ -25,14 +25,17 @@ let ProtocolsService = class ProtocolsService {
|
|
|
25
25
|
* Invoke provider and bind it to passport.
|
|
26
26
|
* @param provider
|
|
27
27
|
*/
|
|
28
|
-
invoke(provider) {
|
|
29
|
-
|
|
28
|
+
async invoke(provider) {
|
|
29
|
+
let { name, useStrategy: strategy, settings } = this.getOptions(provider);
|
|
30
30
|
const protocol = this.injector.get(provider.provide);
|
|
31
|
+
if (protocol.$beforeInstall) {
|
|
32
|
+
settings = (await protocol.$beforeInstall(settings)) || settings;
|
|
33
|
+
}
|
|
31
34
|
const instance = new strategy(settings, this.createHandler(provider));
|
|
32
35
|
this.strategies.set(name, instance);
|
|
33
36
|
Passport.use(name, instance);
|
|
34
37
|
if (protocol.$onInstall) {
|
|
35
|
-
protocol.$onInstall(instance);
|
|
38
|
+
await protocol.$onInstall(instance);
|
|
36
39
|
}
|
|
37
40
|
protocol.$strategy = instance;
|
|
38
41
|
return protocol;
|
|
@@ -110,13 +113,18 @@ let ProtocolsService = class ProtocolsService {
|
|
|
110
113
|
const middleware = platformHandler.createCustomHandler(provider, "$onVerify");
|
|
111
114
|
return async (req, ...args) => {
|
|
112
115
|
const done = args[args.length - 1];
|
|
113
|
-
req.$ctx
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
if (req.$ctx) {
|
|
117
|
+
req.$ctx.set("PROTOCOL_ARGS", args.slice(0, -1));
|
|
118
|
+
try {
|
|
119
|
+
await middleware(req.$ctx);
|
|
120
|
+
done(null, ...[].concat(req.$ctx.data));
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
done(err, false, { message: err.message });
|
|
124
|
+
}
|
|
117
125
|
}
|
|
118
|
-
|
|
119
|
-
done(
|
|
126
|
+
else {
|
|
127
|
+
done(new Error("Headers already sent"), false, { message: "Headers already sent" });
|
|
120
128
|
}
|
|
121
129
|
};
|
|
122
130
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProtocolsService.js","sourceRoot":"","sources":["../../../src/services/ProtocolsService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,eAAe,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,EAAE,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"ProtocolsService.js","sourceRoot":"","sources":["../../../src/services/ProtocolsService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAkB,eAAe,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAC,UAAU,EAAE,eAAe,EAAW,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAC9C,OAAO,QAAQ,EAAE,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,sBAAsB,EAAC,MAAM,uBAAuB,CAAC;AA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EAAE,EAAC,OAAO,EAAE,GAAG,CAAC,OAAO,EAAC,CAAC,CAAC;iBAC1C;aACF;iBAAM;gBACL,IAAI,CAAC,IAAI,KAAK,CAAC,sBAAsB,CAAC,EAAE,KAAK,EAAE,EAAC,OAAO,EAAE,sBAAsB,EAAC,CAAC,CAAC;aACnF;QACH,CAAC,CAAC;IACJ,CAAC;CACF,CAAA;AA9IY,gBAAgB;IAD5B,UAAU,EAAE;qCAImB,eAAe;GAHlC,gBAAgB,CA8I5B;SA9IY,gBAAgB","sourcesContent":["import {PlatformContext, PlatformHandler} from \"@tsed/common\";\nimport {ancestorsOf} from \"@tsed/core\";\nimport {Injectable, InjectorService, Provider} from \"@tsed/di\";\nimport {Unauthorized} from \"@tsed/exceptions\";\nimport Passport, {Strategy} from \"passport\";\nimport {PassportException} from \"../errors/PassportException\";\nimport {PROVIDER_TYPE_PROTOCOL} from \"../contants/constants\";\nimport {promisify} from \"util\";\nimport type {ProtocolMethods} from \"../interfaces/ProtocolMethods\";\nimport type {ProtocolOptions} from \"../interfaces/ProtocolOptions\";\n\n/**\n * @ignore\n */\n@Injectable()\nexport class ProtocolsService {\n readonly strategies: Map<string, Strategy> = new Map();\n\n constructor(private injector: InjectorService) {}\n\n public getProtocols(): Provider[] {\n return this.injector.getProviders(PROVIDER_TYPE_PROTOCOL);\n }\n\n public getProtocolsNames(): string[] {\n return Array.from(this.strategies.keys());\n }\n\n /**\n * Invoke provider and bind it to passport.\n * @param provider\n */\n async invoke(provider: Provider) {\n let {name, useStrategy: strategy, settings} = this.getOptions(provider);\n const protocol = this.injector.get<ProtocolMethods & Record<string, any>>(provider.provide)!;\n\n if (protocol.$beforeInstall) {\n settings = (await protocol.$beforeInstall(settings)) || settings;\n }\n\n const instance = new strategy(settings, this.createHandler(provider));\n\n this.strategies.set(name, instance);\n\n Passport.use(name, instance);\n\n if (protocol.$onInstall) {\n await protocol.$onInstall(instance);\n }\n\n protocol.$strategy = instance;\n\n return protocol;\n }\n\n /**\n * Call authenticate passport method.\n * @param protocols\n * @param options\n * @param ctx\n */\n public async authenticate(protocols: string | string[], options: Record<string, any>, ctx: PlatformContext) {\n return this.call(\"authenticate\", protocols, options, ctx);\n }\n\n /**\n * Call authorize passport method.\n * @param protocols\n * @param options\n * @param ctx\n */\n public async authorize(protocols: string | string[], options: Record<string, any>, ctx: PlatformContext) {\n return this.call(\"authorize\", protocols, options, ctx);\n }\n\n /**\n * Call passport authenticate or authorize depending on the chosen method.\n * @param method\n * @param protocols\n * @param options\n * @param ctx\n * @private\n */\n private async call(\n method: \"authenticate\" | \"authorize\",\n protocols: string | string[],\n options: Record<string, any>,\n ctx: PlatformContext\n ) {\n const request = ctx.getRequest();\n const response = ctx.getResponse();\n protocols = ([] as string[]).concat(protocols);\n\n if (protocols.length === 0) {\n throw new Unauthorized(\"Not authorized\");\n }\n\n try {\n options.failWithError = true;\n // @ts-ignore\n const fn = promisify(Passport[method](protocols.length === 1 ? protocols[0] : protocols, options));\n\n await fn(request, response);\n } catch (er) {\n if (!ancestorsOf(er).includes(Error)) {\n throw new PassportException(er);\n }\n\n throw er;\n }\n }\n\n /**\n * Create strategy options based on decorator metadata and global configuration\n * @param provider\n * @private\n */\n private getOptions(provider: Provider<any>): ProtocolOptions {\n const {name} = provider.store.get(\"protocol\");\n const {useStrategy = Strategy, settings = {}}: ProtocolOptions = this.injector.settings.get(`passport.protocols.${name}`) || {};\n\n return {\n name,\n useStrategy,\n settings: {\n ...settings,\n passReqToCallback: true\n }\n };\n }\n\n /**\n * Create the verifier handler for passport\n * @param provider\n * @private\n */\n private createHandler(provider: Provider<any>) {\n const platformHandler = this.injector.get<PlatformHandler>(PlatformHandler)!;\n const middleware = platformHandler.createCustomHandler(provider, \"$onVerify\");\n\n return async (req: any, ...args: any[]) => {\n const done = args[args.length - 1];\n\n if (req.$ctx) {\n req.$ctx.set(\"PROTOCOL_ARGS\", args.slice(0, -1));\n\n try {\n await middleware(req.$ctx);\n done(null, ...[].concat(req.$ctx.data));\n } catch (err) {\n done(err, false, {message: err.message});\n }\n } else {\n done(new Error(\"Headers already sent\"), false, {message: \"Headers already sent\"});\n }\n };\n }\n}\n"]}
|
|
@@ -10,9 +10,10 @@ 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);
|
|
16
|
-
$onInit(): Promise<any
|
|
17
|
+
$onInit(): Promise<any>;
|
|
17
18
|
$beforeRoutesInit(): void | Promise<any>;
|
|
18
19
|
}
|
|
File without changes
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @file Automatically generated by barrelsby.
|
|
3
|
+
*/
|
|
4
|
+
export * from "./PassportModule";
|
|
5
|
+
export * from "./contants/constants";
|
|
6
|
+
export * from "./decorators/args";
|
|
2
7
|
export * from "./decorators/authenticate";
|
|
3
8
|
export * from "./decorators/authorize";
|
|
4
9
|
export * from "./decorators/protocol";
|
|
5
|
-
export * from "./decorators/args";
|
|
6
|
-
export * from "./interfaces";
|
|
7
10
|
export * from "./domain/UserInfo";
|
|
8
11
|
export * from "./errors/PassportException";
|
|
9
|
-
export * from "./
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
+
export * from "./interfaces/BeforeInstall";
|
|
13
|
+
export * from "./interfaces/OnInstall";
|
|
14
|
+
export * from "./interfaces/OnVerify";
|
|
15
|
+
export * from "./interfaces/ProtocolMethods";
|
|
16
|
+
export * from "./interfaces/ProtocolOptions";
|
|
17
|
+
export * from "./interfaces/interfaces";
|
|
12
18
|
export * from "./middlewares/PassportMiddleware";
|
|
19
|
+
export * from "./services/PassportSerializerService";
|
|
20
|
+
export * from "./services/ProtocolsService";
|
|
21
|
+
export * from "./utils/getProtocolsFromRequest";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OnInstall } from "./OnInstall";
|
|
2
|
+
import { OnVerify } from "./OnVerify";
|
|
3
|
+
import { BeforeInstall } from "./BeforeInstall";
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use ProtocolMethods instead
|
|
6
|
+
*/
|
|
7
|
+
export interface IProtocol<Settings = any> extends OnVerify, OnInstall, BeforeInstall<Settings> {
|
|
8
|
+
}
|
|
9
|
+
export interface ProtocolMethods<Settings = any> extends OnVerify, OnInstall, BeforeInstall<Settings> {
|
|
10
|
+
}
|
|
@@ -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
|
};
|
|
@@ -14,7 +17,3 @@ declare global {
|
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
|
-
export * from "./ProtocolOptions";
|
|
18
|
-
export * from "./IProtocol";
|
|
19
|
-
export * from "./OnInstall";
|
|
20
|
-
export * from "./OnVerify";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PlatformContext } from "@tsed/common";
|
|
2
2
|
import { InjectorService, Provider } from "@tsed/di";
|
|
3
3
|
import { Strategy } from "passport";
|
|
4
|
+
import type { ProtocolMethods } from "../interfaces/ProtocolMethods";
|
|
4
5
|
/**
|
|
5
6
|
* @ignore
|
|
6
7
|
*/
|
|
@@ -14,7 +15,7 @@ export declare class ProtocolsService {
|
|
|
14
15
|
* Invoke provider and bind it to passport.
|
|
15
16
|
* @param provider
|
|
16
17
|
*/
|
|
17
|
-
invoke(provider: Provider): any
|
|
18
|
+
invoke(provider: Provider): Promise<ProtocolMethods<any> & Record<string, any>>;
|
|
18
19
|
/**
|
|
19
20
|
* Call authenticate passport method.
|
|
20
21
|
* @param protocols
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/passport",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.4",
|
|
4
4
|
"description": "Passport package for Ts.ED framework",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./lib/cjs/index.js",
|
|
7
|
+
"module": "./lib/esm/index.js",
|
|
7
8
|
"typings": "./lib/types/index.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
"types": "./lib/types/index.d.ts",
|
|
@@ -12,45 +13,44 @@
|
|
|
12
13
|
"default": "./lib/esm/index.js"
|
|
13
14
|
},
|
|
14
15
|
"scripts": {
|
|
15
|
-
"
|
|
16
|
+
"clean": "rm -rf lib",
|
|
17
|
+
"build": "yarn clean && yarn barrels && yarn run build:esm && yarn run build:cjs",
|
|
16
18
|
"build:cjs": "tsc --build tsconfig.compile.json",
|
|
17
19
|
"build:esm": "tsc --build tsconfig.compile.esm.json",
|
|
20
|
+
"barrels": "yarn barrelsby --delete -d ./src -e \"\\.spec\\.ts\" -e \"__mock__\" -e \".benchmark.ts\"",
|
|
21
|
+
"test": "cross-env NODE_ENV=test yarn jest --max-workers=2",
|
|
18
22
|
"start": "ts-node src/index.ts"
|
|
19
23
|
},
|
|
20
24
|
"dependencies": {
|
|
21
|
-
"tslib": "2.
|
|
25
|
+
"tslib": "2.3.1"
|
|
22
26
|
},
|
|
23
27
|
"devDependencies": {
|
|
24
|
-
"@tsed/common": "7.0.0-beta.
|
|
25
|
-
"@tsed/core": "7.0.0-beta.
|
|
26
|
-
"@tsed/di": "7.0.0-beta.
|
|
27
|
-
"@types/passport": "1.0.
|
|
28
|
-
"@types/passport-http": "0.3.
|
|
28
|
+
"@tsed/common": "7.0.0-beta.4",
|
|
29
|
+
"@tsed/core": "7.0.0-beta.4",
|
|
30
|
+
"@tsed/di": "7.0.0-beta.4",
|
|
31
|
+
"@types/passport": "1.0.7",
|
|
32
|
+
"@types/passport-http": "0.3.9",
|
|
29
33
|
"@types/passport-local": "1.0.34",
|
|
30
34
|
"@types/passport-strategy": "0.2.35",
|
|
31
|
-
"passport": "0.
|
|
35
|
+
"passport": "0.5.2",
|
|
32
36
|
"passport-http": "0.3.0",
|
|
33
37
|
"passport-local": "1.0.0",
|
|
34
38
|
"passport-strategy": "1.0.0"
|
|
35
39
|
},
|
|
36
40
|
"peerDependencies": {
|
|
37
|
-
"@tsed/common": "^7.0.0-beta.
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"@tsed/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"passport": ">=0.4.1",
|
|
45
|
-
"passport-http": ">=0.3.0",
|
|
46
|
-
"passport-local": ">=1.0.0",
|
|
47
|
-
"passport-strategy": ">=1.0.0"
|
|
41
|
+
"@tsed/common": "^7.0.0-beta.4",
|
|
42
|
+
"passport": ">=0.4.1"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"@tsed/common": {
|
|
46
|
+
"optional": false
|
|
47
|
+
}
|
|
48
48
|
},
|
|
49
49
|
"repository": "https://github.com/tsedio/tsed",
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
52
52
|
},
|
|
53
|
-
"homepage": "https://github.com/tsedio/tsed/tree/
|
|
53
|
+
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/security/passport",
|
|
54
54
|
"author": "Romain Lenzotti",
|
|
55
55
|
"license": "MIT"
|
|
56
56
|
}
|
package/readme.md
CHANGED
|
@@ -32,6 +32,7 @@ A package of Ts.ED framework. See website: https://tsed.io/#/tutorials/passport
|
|
|
32
32
|
## Installation
|
|
33
33
|
|
|
34
34
|
Run npm command (or yarn):
|
|
35
|
+
|
|
35
36
|
```bash
|
|
36
37
|
npm install --save @tsed/passport passport
|
|
37
38
|
npm install --save-dev @types/passport
|
|
@@ -40,18 +41,15 @@ npm install --save-dev @types/passport
|
|
|
40
41
|
## Configure your server
|
|
41
42
|
|
|
42
43
|
Add this configuration to your server:
|
|
43
|
-
```typescript
|
|
44
|
-
import {Configuration} from "@tsed/common"
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
```typescript
|
|
46
|
+
import {Configuration} from "@tsed/common";
|
|
47
47
|
|
|
48
48
|
@Configuration({
|
|
49
49
|
componentsScan: [
|
|
50
|
-
|
|
50
|
+
`./protocols/*.ts` // scan protocols directory
|
|
51
51
|
],
|
|
52
|
-
passport: {
|
|
53
|
-
|
|
54
|
-
}
|
|
52
|
+
passport: {}
|
|
55
53
|
})
|
|
56
54
|
export class Server {}
|
|
57
55
|
```
|
|
@@ -61,19 +59,20 @@ export class Server {}
|
|
|
61
59
|
A Protocol is a special Ts.ED service which is used to declare a Passport Strategy and handle Passport lifecycle.
|
|
62
60
|
|
|
63
61
|
Here an example with the PassportLocal:
|
|
62
|
+
|
|
64
63
|
```typescript
|
|
65
64
|
import {BodyParams, Req, Format, Required} from "@tsed/common";
|
|
66
65
|
import {Strategy} from "passport-local";
|
|
67
66
|
import {Unauthorized} from "@tsed/exceptions";
|
|
68
|
-
import {Protocol, OnInstall, OnVerify} from "@tsed/passport";
|
|
67
|
+
import {Protocol, OnInstall, OnVerify} from "@tsed/passport";
|
|
69
68
|
import {Inject} from "@tsed/di";
|
|
70
|
-
import {UserService} from "../services/UserService"
|
|
69
|
+
import {UserService} from "../services/UserService";
|
|
71
70
|
|
|
72
71
|
export class Credentials {
|
|
73
72
|
@Required()
|
|
74
|
-
@Format(
|
|
73
|
+
@Format("email")
|
|
75
74
|
email: string;
|
|
76
|
-
|
|
75
|
+
|
|
77
76
|
@Required()
|
|
78
77
|
password: string;
|
|
79
78
|
}
|
|
@@ -94,11 +93,11 @@ export class LocalProtocol implements OnVerify, OnInstall {
|
|
|
94
93
|
const user = await this.userService.find(credentials);
|
|
95
94
|
|
|
96
95
|
if (!user) {
|
|
97
|
-
|
|
96
|
+
throw new Unauthorized("Unauthorized user");
|
|
98
97
|
}
|
|
99
|
-
|
|
100
|
-
if(!user.verifyPassword()) {
|
|
101
|
-
|
|
98
|
+
|
|
99
|
+
if (!user.verifyPassword()) {
|
|
100
|
+
throw new Unauthorized("Unauthorized user");
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
return user;
|
|
@@ -135,18 +134,17 @@ This controller will provide required all endpoints which will be used by the di
|
|
|
135
134
|
See our complete example on [Ts.ED passport repository](https://github.com/tsedio/tsed-example-passportjs).
|
|
136
135
|
|
|
137
136
|
## Contributors
|
|
137
|
+
|
|
138
138
|
Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
|
|
139
139
|
|
|
140
140
|
<a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
|
|
141
141
|
|
|
142
|
-
|
|
143
142
|
## Backers
|
|
144
143
|
|
|
145
144
|
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
|
|
146
145
|
|
|
147
146
|
<a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/backers.svg?width=890"></a>
|
|
148
147
|
|
|
149
|
-
|
|
150
148
|
## Sponsors
|
|
151
149
|
|
|
152
150
|
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/tsed#sponsor)]
|
|
@@ -8,16 +8,5 @@
|
|
|
8
8
|
"declaration": true,
|
|
9
9
|
"declarationDir": "./lib/types"
|
|
10
10
|
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
"node_modules",
|
|
13
|
-
"test",
|
|
14
|
-
"lib",
|
|
15
|
-
"benchmark",
|
|
16
|
-
"coverage",
|
|
17
|
-
"spec",
|
|
18
|
-
"**/*.benchmark.ts",
|
|
19
|
-
"**/*.spec.ts",
|
|
20
|
-
"keys",
|
|
21
|
-
"jest.config.js"
|
|
22
|
-
]
|
|
11
|
+
"exclude": ["node_modules", "test", "lib", "benchmark", "coverage", "spec", "**/*.benchmark.ts", "**/*.spec.ts", "keys", "jest.config.js"]
|
|
23
12
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contants/index.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,UAAU,CAAC","sourcesContent":["export const PROVIDER_TYPE_PROTOCOL = \"protocol\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IProtocol.js","sourceRoot":"","sources":["../../../src/interfaces/IProtocol.ts"],"names":[],"mappings":"","sourcesContent":["import {OnInstall} from \"./OnInstall\";\nimport {OnVerify} from \"./OnVerify\";\n\nexport interface IProtocol extends OnVerify, OnInstall {}\n"]}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
(0, tslib_1.__exportStar)(require("./ProtocolOptions"), exports);
|
|
5
|
-
(0, tslib_1.__exportStar)(require("./IProtocol"), exports);
|
|
6
|
-
(0, tslib_1.__exportStar)(require("./OnInstall"), exports);
|
|
7
|
-
(0, tslib_1.__exportStar)(require("./OnVerify"), exports);
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":";;;AAkBA,iEAAkC;AAClC,2DAA4B;AAC5B,2DAA4B;AAC5B,0DAA2B","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {ProtocolOptions} from \"./ProtocolOptions\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n passport: {\n userProperty?: string;\n pauseStream?: string;\n userInfoModel?: Type<any> | false;\n protocols?: {\n [protocolName: string]: Partial<ProtocolOptions>;\n };\n };\n }\n }\n}\n\nexport * from \"./ProtocolOptions\";\nexport * from \"./IProtocol\";\nexport * from \"./OnInstall\";\nexport * from \"./OnVerify\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/contants/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAAC","sourcesContent":["export const PROVIDER_TYPE_PROTOCOL = \"protocol\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IProtocol.js","sourceRoot":"","sources":["../../../src/interfaces/IProtocol.ts"],"names":[],"mappings":"","sourcesContent":["import {OnInstall} from \"./OnInstall\";\nimport {OnVerify} from \"./OnVerify\";\n\nexport interface IProtocol extends OnVerify, OnInstall {}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/interfaces/index.ts"],"names":[],"mappings":"AAkBA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC","sourcesContent":["import {Type} from \"@tsed/core\";\nimport {ProtocolOptions} from \"./ProtocolOptions\";\n\ndeclare global {\n namespace TsED {\n interface Configuration {\n passport: {\n userProperty?: string;\n pauseStream?: string;\n userInfoModel?: Type<any> | false;\n protocols?: {\n [protocolName: string]: Partial<ProtocolOptions>;\n };\n };\n }\n }\n}\n\nexport * from \"./ProtocolOptions\";\nexport * from \"./IProtocol\";\nexport * from \"./OnInstall\";\nexport * from \"./OnVerify\";\n"]}
|