@tsed/passport 8.37.1 → 8.38.0-beta.2
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Inject, Injectable, InjectorService } from "@tsed/di";
|
|
1
|
+
import { constant, inject, injectable, injector } from "@tsed/di";
|
|
3
2
|
import Passport, { Strategy } from "passport";
|
|
4
3
|
import { PlatformHandler } from "@tsed/platform-http";
|
|
5
4
|
import { PROVIDER_TYPE_PROTOCOL } from "../contants/constants.js";
|
|
@@ -11,12 +10,13 @@ import { promisify } from "node:util";
|
|
|
11
10
|
/**
|
|
12
11
|
* @ignore
|
|
13
12
|
*/
|
|
14
|
-
|
|
13
|
+
export class ProtocolsService {
|
|
15
14
|
constructor() {
|
|
16
15
|
this.strategies = new Map();
|
|
16
|
+
this.platformHandler = inject(PlatformHandler);
|
|
17
17
|
}
|
|
18
18
|
getProtocols() {
|
|
19
|
-
return
|
|
19
|
+
return injector().providers.getMany(PROVIDER_TYPE_PROTOCOL);
|
|
20
20
|
}
|
|
21
21
|
getProtocolsNames() {
|
|
22
22
|
return Array.from(this.strategies.keys());
|
|
@@ -27,7 +27,7 @@ let ProtocolsService = class ProtocolsService {
|
|
|
27
27
|
*/
|
|
28
28
|
async invoke(provider) {
|
|
29
29
|
let { name, useStrategy: strategy, settings } = this.getOptions(provider);
|
|
30
|
-
const protocol =
|
|
30
|
+
const protocol = inject(provider.token);
|
|
31
31
|
if (protocol.$beforeInstall) {
|
|
32
32
|
settings = (await protocol.$beforeInstall(settings)) || settings;
|
|
33
33
|
}
|
|
@@ -93,7 +93,7 @@ let ProtocolsService = class ProtocolsService {
|
|
|
93
93
|
*/
|
|
94
94
|
getOptions(provider) {
|
|
95
95
|
const { name } = provider.store.get("protocol");
|
|
96
|
-
const { useStrategy = Strategy, settings = {} } =
|
|
96
|
+
const { useStrategy = Strategy, settings = {} } = constant(`passport.protocols.${name}`) || {};
|
|
97
97
|
return {
|
|
98
98
|
name,
|
|
99
99
|
useStrategy,
|
|
@@ -133,16 +133,5 @@ let ProtocolsService = class ProtocolsService {
|
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
Inject(),
|
|
139
|
-
__metadata("design:type", PlatformHandler)
|
|
140
|
-
], ProtocolsService.prototype, "platformHandler", void 0);
|
|
141
|
-
__decorate([
|
|
142
|
-
Inject(),
|
|
143
|
-
__metadata("design:type", InjectorService)
|
|
144
|
-
], ProtocolsService.prototype, "injector", void 0);
|
|
145
|
-
ProtocolsService = __decorate([
|
|
146
|
-
Injectable()
|
|
147
|
-
], ProtocolsService);
|
|
148
|
-
export { ProtocolsService };
|
|
136
|
+
}
|
|
137
|
+
injectable(ProtocolsService);
|
|
@@ -8,7 +8,6 @@ import type { ProtocolMethods } from "../interfaces/ProtocolMethods.js";
|
|
|
8
8
|
export declare class ProtocolsService {
|
|
9
9
|
readonly strategies: Map<string, Strategy>;
|
|
10
10
|
protected platformHandler: PlatformHandler;
|
|
11
|
-
private injector;
|
|
12
11
|
getProtocols(): Provider[];
|
|
13
12
|
getProtocolsNames(): string[];
|
|
14
13
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/passport",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.38.0-beta.2",
|
|
4
4
|
"description": "Passport package for Ts.ED framework",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"tslib": ">=2.7.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@tsed/barrels": "8.
|
|
32
|
-
"@tsed/core": "8.
|
|
33
|
-
"@tsed/di": "8.
|
|
34
|
-
"@tsed/platform-http": "8.
|
|
35
|
-
"@tsed/platform-router": "8.
|
|
36
|
-
"@tsed/typescript": "8.
|
|
31
|
+
"@tsed/barrels": "8.38.0-beta.2",
|
|
32
|
+
"@tsed/core": "8.38.0-beta.2",
|
|
33
|
+
"@tsed/di": "8.38.0-beta.2",
|
|
34
|
+
"@tsed/platform-http": "8.38.0-beta.2",
|
|
35
|
+
"@tsed/platform-router": "8.38.0-beta.2",
|
|
36
|
+
"@tsed/typescript": "8.38.0-beta.2",
|
|
37
37
|
"@types/passport": "1.0.16",
|
|
38
38
|
"@types/passport-http": "0.3.11",
|
|
39
39
|
"@types/passport-local": "1.0.38",
|
|
@@ -60,5 +60,8 @@
|
|
|
60
60
|
},
|
|
61
61
|
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/security/passport",
|
|
62
62
|
"author": "Romain Lenzotti",
|
|
63
|
-
"license": "MIT"
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"publishConfig": {
|
|
65
|
+
"tag": "beta"
|
|
66
|
+
}
|
|
64
67
|
}
|