@tsed/passport 6.102.0 → 6.102.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/passport",
3
- "version": "6.102.0",
3
+ "version": "6.102.4",
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.102.0",
26
- "@tsed/core": "6.102.0",
27
- "@tsed/di": "6.102.0",
25
+ "@tsed/common": "6.102.4",
26
+ "@tsed/core": "6.102.4",
27
+ "@tsed/di": "6.102.4",
28
28
  "@types/passport": "1.0.4",
29
29
  "@types/passport-http": "0.3.8",
30
30
  "@types/passport-local": "1.0.34",
@@ -35,17 +35,7 @@
35
35
  "passport-strategy": "1.0.0"
36
36
  },
37
37
  "peerDependencies": {
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
- "@tsed/logger": ">=6.0.0",
43
- "@tsed/openspec": "^6.102.0",
44
- "@tsed/schema": "^6.102.0",
45
- "passport": ">=0.4.1",
46
- "passport-http": ">=0.3.0",
47
- "passport-local": ">=1.0.0",
48
- "passport-strategy": ">=1.0.0"
38
+ "passport": ">=0.4.1"
49
39
  },
50
40
  "repository": "https://github.com/tsedio/tsed",
51
41
  "bugs": {
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,17 @@ npm install --save-dev @types/passport
40
41
  ## Configure your server
41
42
 
42
43
  Add this configuration to your server:
44
+
43
45
  ```typescript
44
- import {Configuration} from "@tsed/common"
46
+ import {Configuration} from "@tsed/common";
45
47
 
46
48
  const rootDir = __dirname;
47
49
 
48
50
  @Configuration({
49
51
  componentsScan: [
50
- `${rootDir}/protocols/*.ts` // scan protocols directory
52
+ `${rootDir}/protocols/*.ts` // scan protocols directory
51
53
  ],
52
- passport: {
53
-
54
- }
54
+ passport: {}
55
55
  })
56
56
  export class Server {}
57
57
  ```
@@ -61,19 +61,20 @@ export class Server {}
61
61
  A Protocol is a special Ts.ED service which is used to declare a Passport Strategy and handle Passport lifecycle.
62
62
 
63
63
  Here an example with the PassportLocal:
64
+
64
65
  ```typescript
65
66
  import {BodyParams, Req, Format, Required} from "@tsed/common";
66
67
  import {Strategy} from "passport-local";
67
68
  import {Unauthorized} from "@tsed/exceptions";
68
- import {Protocol, OnInstall, OnVerify} from "@tsed/passport";
69
+ import {Protocol, OnInstall, OnVerify} from "@tsed/passport";
69
70
  import {Inject} from "@tsed/di";
70
- import {UserService} from "../services/UserService"
71
+ import {UserService} from "../services/UserService";
71
72
 
72
73
  export class Credentials {
73
74
  @Required()
74
- @Format('email')
75
+ @Format("email")
75
76
  email: string;
76
-
77
+
77
78
  @Required()
78
79
  password: string;
79
80
  }
@@ -94,11 +95,11 @@ export class LocalProtocol implements OnVerify, OnInstall {
94
95
  const user = await this.userService.find(credentials);
95
96
 
96
97
  if (!user) {
97
- throw new Unauthorized("Unauthorized user")
98
+ throw new Unauthorized("Unauthorized user");
98
99
  }
99
-
100
- if(!user.verifyPassword()) {
101
- throw new Unauthorized("Unauthorized user")
100
+
101
+ if (!user.verifyPassword()) {
102
+ throw new Unauthorized("Unauthorized user");
102
103
  }
103
104
 
104
105
  return user;
@@ -135,18 +136,17 @@ This controller will provide required all endpoints which will be used by the di
135
136
  See our complete example on [Ts.ED passport repository](https://github.com/tsedio/tsed-example-passportjs).
136
137
 
137
138
  ## Contributors
139
+
138
140
  Please read [contributing guidelines here](https://tsed.io/CONTRIBUTING.html)
139
141
 
140
142
  <a href="https://github.com/tsedio/ts-express-decorators/graphs/contributors"><img src="https://opencollective.com/tsed/contributors.svg?width=890" /></a>
141
143
 
142
-
143
144
  ## Backers
144
145
 
145
146
  Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/tsed#backer)]
146
147
 
147
148
  <a href="https://opencollective.com/tsed#backers" target="_blank"><img src="https://opencollective.com/tsed/backers.svg?width=890"></a>
148
149
 
149
-
150
150
  ## Sponsors
151
151
 
152
152
  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
  }