@boarteam/boar-pack-users-backend 6.0.0-alpha.8 → 6.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boarteam/boar-pack-users-backend",
3
- "version": "6.0.0-alpha.8",
3
+ "version": "6.0.0",
4
4
  "description": "NestJS Users module including permissions system, authentication strategies etc",
5
5
  "main": "src/index",
6
6
  "files": [
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "dependencies": {
17
- "@boarteam/boar-pack-common-backend": "^3.0.0-alpha.2",
17
+ "@boarteam/boar-pack-common-backend": "^3.0.0",
18
18
  "@casl/ability": "^6.7.3",
19
19
  "@dataui/crud": "^5.3.4",
20
20
  "@dataui/crud-typeorm": "^5.3.4",
@@ -38,14 +38,14 @@
38
38
  "passport-http-bearer": "^1.0.1",
39
39
  "passport-jwt": "^4.0.1",
40
40
  "passport-local": "^1.0.0",
41
+ "passport-yandex": "^0.0.5",
41
42
  "pg": "^8.13.3",
42
43
  "telegraf": "^4.12.2",
43
- "typeorm": "^0.3.20",
44
+ "typeorm": "^0.3.25",
44
45
  "uuid": "^11.1.0",
45
46
  "ws": "^8.18.0"
46
47
  },
47
48
  "devDependencies": {
48
- "@nestjs/platform-express": "^10.4.15",
49
49
  "@types/bcrypt": "^5.0.2",
50
50
  "@types/passport-google-oauth20": "^2.0.16",
51
51
  "@types/passport-http-bearer": "^1.0.41",
@@ -56,12 +56,11 @@
56
56
  "openapi-typescript-codegen": "^0.29.0",
57
57
  "passport-azure-ad-oauth2": "^0.0.4",
58
58
  "passport-google-oauth20": "^2.0.0",
59
- "passport-yandex": "^0.0.5",
60
59
  "pg": "^8.13.1"
61
60
  },
62
61
  "scripts": {
63
62
  "yalc:push": "yalc push",
64
63
  "gen-types": "SWAGGER=true JWT_SECRET=swagger nest start"
65
64
  },
66
- "gitHead": "1505d30b815618afd075af7d97e3945d15c5129b"
65
+ "gitHead": "36339bec16a3d1966bab8df4e10f3fa0ad49f4e4"
67
66
  }
@@ -1,6 +1,6 @@
1
1
  import { Strategy } from 'passport-http-bearer';
2
2
  import { PassportStrategy } from '@nestjs/passport';
3
- import { Injectable, UnauthorizedException } from '@nestjs/common';
3
+ import { Injectable, Logger, UnauthorizedException } from '@nestjs/common';
4
4
  import { TUser } from '../users';
5
5
  import { TOKENS_AUTH } from "./tokens.constants";
6
6
  import { TokensService } from "./tokens.service";
@@ -10,6 +10,7 @@ import Joi from "joi";
10
10
  @Injectable()
11
11
  export class TokensAuthStrategy extends PassportStrategy(Strategy, TOKENS_AUTH) {
12
12
  private uuidValidationSchema = Joi.string().uuid({ version: ['uuidv4'] });
13
+ private readonly logger = new Logger(TokensAuthStrategy.name);
13
14
 
14
15
  constructor(
15
16
  private tokens: TokensService,
@@ -23,7 +24,8 @@ export class TokensAuthStrategy extends PassportStrategy(Strategy, TOKENS_AUTH)
23
24
 
24
25
  const { error } = this.uuidValidationSchema.validate(id);
25
26
  if (error || !hash) {
26
- throw new UnauthorizedException('Invalid token');
27
+ this.logger.error(`Invalid token format: ${token}`, error);
28
+ throw new UnauthorizedException(`Invalid token ${token}`);
27
29
  }
28
30
 
29
31
  const tokenEntity = await this.tokens.findOne({