@vynelix/nestjs-multi-auth 1.0.2 → 1.0.3
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/CHANGELOG.md +4 -0
- package/README.md +1 -1
- package/dist/auth/auth.module.js +28 -28
- package/dist/auth/auth.module.js.map +1 -1
- package/dist/auth/core/database-otp.provider.js +14 -4
- package/dist/auth/core/database-otp.provider.js.map +1 -1
- package/dist/auth/decorator/current-user.decorator.d.ts +1 -1
- package/dist/auth/interfaces/auth-module-async-options.interface.d.ts +2 -0
- package/dist/auth/strategies/local-auth.strategy.js +1 -0
- package/dist/auth/strategies/local-auth.strategy.js.map +1 -1
- package/dist/database/typeorm/entities/entities.d.ts +1 -1
- package/dist/database/typeorm/migrations/auth-entities.d.ts +1 -1
- package/dist/database/typeorm/repositories/auth-identifier.repository.js +11 -6
- package/dist/database/typeorm/repositories/auth-identifier.repository.js.map +1 -1
- package/dist/database/typeorm/repositories/otp-token.repository.js +2 -1
- package/dist/database/typeorm/repositories/otp-token.repository.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/auth/auth-type.enum.d.ts +0 -22
- package/dist/auth/auth-type.enum.js +0 -32
- package/dist/auth/auth-type.enum.js.map +0 -1
- package/dist/auth/core/cookie-namespace.resolver.d.ts +0 -8
- package/dist/auth/core/cookie-namespace.resolver.js +0 -48
- package/dist/auth/core/cookie-namespace.resolver.js.map +0 -1
- package/dist/auth/current-user-interface.d.ts +0 -4
- package/dist/auth/current-user-interface.js +0 -4
- package/dist/auth/current-user-interface.js.map +0 -1
- package/dist/auth/current-user.decorator.d.ts +0 -2
- package/dist/auth/current-user.decorator.js +0 -16
- package/dist/auth/current-user.decorator.js.map +0 -1
- package/dist/auth/dto/auth-response.dto.d.ts +0 -17
- package/dist/auth/dto/auth-response.dto.js +0 -83
- package/dist/auth/dto/auth-response.dto.js.map +0 -1
- package/dist/auth/dto/identifier-response.dto.d.ts +0 -8
- package/dist/auth/dto/identifier-response.dto.js +0 -46
- package/dist/auth/dto/identifier-response.dto.js.map +0 -1
- package/dist/auth/dto/login.dto.d.ts +0 -11
- package/dist/auth/dto/login.dto.js +0 -68
- package/dist/auth/dto/login.dto.js.map +0 -1
- package/dist/auth/dto/mfa.dto.d.ts +0 -8
- package/dist/auth/dto/mfa.dto.js +0 -51
- package/dist/auth/dto/mfa.dto.js.map +0 -1
- package/dist/auth/dto/oauth-provider-response.dto.d.ts +0 -5
- package/dist/auth/dto/oauth-provider-response.dto.js +0 -30
- package/dist/auth/dto/oauth-provider-response.dto.js.map +0 -1
- package/dist/auth/dto/refresh-token.dto.d.ts +0 -3
- package/dist/auth/dto/refresh-token.dto.js +0 -28
- package/dist/auth/dto/refresh-token.dto.js.map +0 -1
- package/dist/auth/dto/signup.dto.d.ts +0 -13
- package/dist/auth/dto/signup.dto.js +0 -70
- package/dist/auth/dto/signup.dto.js.map +0 -1
- package/dist/auth/dto/verify.dto.d.ts +0 -7
- package/dist/auth/dto/verify.dto.js +0 -48
- package/dist/auth/dto/verify.dto.js.map +0 -1
- package/dist/auth/entities/auth-identify.entity.d.ts +0 -33
- package/dist/auth/entities/auth-identify.entity.js +0 -73
- package/dist/auth/entities/auth-identify.entity.js.map +0 -1
- package/dist/auth/entities/auth.entity.d.ts +0 -45
- package/dist/auth/entities/auth.entity.js +0 -129
- package/dist/auth/entities/auth.entity.js.map +0 -1
- package/dist/auth/entities/base.entity.d.ts +0 -6
- package/dist/auth/entities/base.entity.js +0 -41
- package/dist/auth/entities/base.entity.js.map +0 -1
- package/dist/auth/entities/entities.d.ts +0 -7
- package/dist/auth/entities/entities.js +0 -18
- package/dist/auth/entities/entities.js.map +0 -1
- package/dist/auth/entities/mfa-method.entity.d.ts +0 -23
- package/dist/auth/entities/mfa-method.entity.js +0 -69
- package/dist/auth/entities/mfa-method.entity.js.map +0 -1
- package/dist/auth/entities/oauth-provider.entity.d.ts +0 -38
- package/dist/auth/entities/oauth-provider.entity.js +0 -88
- package/dist/auth/entities/oauth-provider.entity.js.map +0 -1
- package/dist/auth/entities/otp-token.entity.d.ts +0 -22
- package/dist/auth/entities/otp-token.entity.js +0 -61
- package/dist/auth/entities/otp-token.entity.js.map +0 -1
- package/dist/auth/entities/session.entity.d.ts +0 -21
- package/dist/auth/entities/session.entity.js +0 -71
- package/dist/auth/entities/session.entity.js.map +0 -1
- package/dist/auth/entities/session_log.entity.d.ts +0 -31
- package/dist/auth/entities/session_log.entity.js +0 -85
- package/dist/auth/entities/session_log.entity.js.map +0 -1
- package/dist/auth/interfaces/auth-user-service.interface.d.ts +0 -13
- package/dist/auth/interfaces/auth-user-service.interface.js +0 -7
- package/dist/auth/interfaces/auth-user-service.interface.js.map +0 -1
- package/dist/auth/interfaces/current-user.decorator.d.ts +0 -2
- package/dist/auth/interfaces/current-user.decorator.js +0 -16
- package/dist/auth/interfaces/current-user.decorator.js.map +0 -1
- package/dist/auth/jwt-payload-interface.d.ts +0 -4
- package/dist/auth/jwt-payload-interface.js +0 -3
- package/dist/auth/jwt-payload-interface.js.map +0 -1
- package/dist/auth/jwt.strategy.d.ts +0 -13
- package/dist/auth/jwt.strategy.js +0 -60
- package/dist/auth/jwt.strategy.js.map +0 -1
- package/dist/auth/strategies/company.strategy.d.ts +0 -0
- package/dist/auth/strategies/company.strategy.js +0 -1
- package/dist/auth/strategies/company.strategy.js.map +0 -1
- package/dist/auth/strategies/google.strategy.d.ts +0 -7
- package/dist/auth/strategies/google.strategy.js +0 -23
- package/dist/auth/strategies/google.strategy.js.map +0 -1
- package/dist/auth/strategies/oauth/oauth-strategy.interface.d.ts +0 -14
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js +0 -3
- package/dist/auth/strategies/oauth/oauth-strategy.interface.js.map +0 -1
- package/dist/auth/strategies/otp.strategy.d.ts +0 -7
- package/dist/auth/strategies/otp.strategy.js +0 -23
- package/dist/auth/strategies/otp.strategy.js.map +0 -1
- package/dist/auth/strategies/password.strategy.d.ts +0 -14
- package/dist/auth/strategies/password.strategy.js +0 -130
- package/dist/auth/strategies/password.strategy.js.map +0 -1
- package/dist/migrations/auth-entities.d.ts +0 -7
- package/dist/migrations/auth-entities.js +0 -18
- package/dist/migrations/auth-entities.js.map +0 -1
- package/dist/migrations/auth-schema.initializer.d.ts +0 -9
- package/dist/migrations/auth-schema.initializer.js +0 -36
- package/dist/migrations/auth-schema.initializer.js.map +0 -1
- package/dist/migrations/auth.migration.v1.d.ts +0 -12
- package/dist/migrations/auth.migration.v1.js +0 -157
- package/dist/migrations/auth.migration.v1.js.map +0 -1
- package/dist/migrations/auth.migration.v2.d.ts +0 -8
- package/dist/migrations/auth.migration.v2.js +0 -39
- package/dist/migrations/auth.migration.v2.js.map +0 -1
- package/dist/migrations/auth.migrations.d.ts +0 -2
- package/dist/migrations/auth.migrations.js +0 -8
- package/dist/migrations/auth.migrations.js.map +0 -1
- package/dist/migrations/migration.runner.d.ts +0 -9
- package/dist/migrations/migration.runner.js +0 -67
- package/dist/migrations/migration.runner.js.map +0 -1
- package/dist/migrations/migration.service.d.ts +0 -9
- package/dist/migrations/migration.service.js +0 -75
- package/dist/migrations/migration.service.js.map +0 -1
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.OAuthProvider = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const swagger_1 = require("@nestjs/swagger");
|
|
15
|
-
const base_entity_1 = require("./base.entity");
|
|
16
|
-
const auth_entity_1 = require("./auth.entity");
|
|
17
|
-
const auth_type_enum_1 = require("../enums/auth-type.enum");
|
|
18
|
-
let OAuthProvider = class OAuthProvider extends base_entity_1.BaseEntity {
|
|
19
|
-
toMap() {
|
|
20
|
-
return {
|
|
21
|
-
id: this.id,
|
|
22
|
-
provider: this.provider,
|
|
23
|
-
providerUserId: this.providerUserId,
|
|
24
|
-
accessToken: this.accessToken,
|
|
25
|
-
refreshToken: this.refreshToken,
|
|
26
|
-
expiresAt: this.expiresAt,
|
|
27
|
-
createdAt: this.createdAt,
|
|
28
|
-
updatedAt: this.updatedAt,
|
|
29
|
-
deletedAt: this.deletedAt,
|
|
30
|
-
// auth: this.auth.toMap(),
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.OAuthProvider = OAuthProvider;
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, typeorm_1.ManyToOne)(() => auth_entity_1.Auth, (auth) => auth.oauthProviders, { onDelete: 'CASCADE' }),
|
|
37
|
-
(0, typeorm_1.JoinColumn)({ name: 'authId' }),
|
|
38
|
-
__metadata("design:type", auth_entity_1.Auth)
|
|
39
|
-
], OAuthProvider.prototype, "auth", void 0);
|
|
40
|
-
__decorate([
|
|
41
|
-
(0, swagger_1.ApiProperty)({ enum: auth_type_enum_1.OAuthProviderType, example: auth_type_enum_1.OAuthProviderType.GOOGLE }),
|
|
42
|
-
(0, typeorm_1.Column)({ type: 'enum', enum: auth_type_enum_1.OAuthProviderType }),
|
|
43
|
-
__metadata("design:type", String)
|
|
44
|
-
], OAuthProvider.prototype, "provider", void 0);
|
|
45
|
-
__decorate([
|
|
46
|
-
(0, swagger_1.ApiProperty)({ example: '1234567890' }),
|
|
47
|
-
(0, typeorm_1.Column)(),
|
|
48
|
-
__metadata("design:type", String)
|
|
49
|
-
], OAuthProvider.prototype, "providerUserId", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
(0, swagger_1.ApiProperty)({ example: 'ya29.a0ARrdaM...' }),
|
|
52
|
-
(0, typeorm_1.Column)({ nullable: true, select: false }),
|
|
53
|
-
__metadata("design:type", String)
|
|
54
|
-
], OAuthProvider.prototype, "accessToken", void 0);
|
|
55
|
-
__decorate([
|
|
56
|
-
(0, swagger_1.ApiProperty)({ example: '1//0gdf1234...' }),
|
|
57
|
-
(0, typeorm_1.Column)({ nullable: true, select: false }),
|
|
58
|
-
__metadata("design:type", String)
|
|
59
|
-
], OAuthProvider.prototype, "refreshToken", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, swagger_1.ApiProperty)({ example: '2025-10-01T12:00:00Z' }),
|
|
62
|
-
(0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
|
|
63
|
-
__metadata("design:type", Date)
|
|
64
|
-
], OAuthProvider.prototype, "expiresAt", void 0);
|
|
65
|
-
__decorate([
|
|
66
|
-
(0, swagger_1.ApiProperty)({ example: 'John Doe', required: false }),
|
|
67
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
68
|
-
__metadata("design:type", String)
|
|
69
|
-
], OAuthProvider.prototype, "displayName", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
(0, swagger_1.ApiProperty)({ example: 'https://lh3.googleusercontent.com/...', required: false }),
|
|
72
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
73
|
-
__metadata("design:type", String)
|
|
74
|
-
], OAuthProvider.prototype, "avatarUrl", void 0);
|
|
75
|
-
__decorate([
|
|
76
|
-
(0, swagger_1.ApiProperty)({ example: true, required: false }),
|
|
77
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
78
|
-
__metadata("design:type", Boolean)
|
|
79
|
-
], OAuthProvider.prototype, "emailVerified", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
(0, swagger_1.ApiProperty)({ required: false }),
|
|
82
|
-
(0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
|
|
83
|
-
__metadata("design:type", Object)
|
|
84
|
-
], OAuthProvider.prototype, "rawProfile", void 0);
|
|
85
|
-
exports.OAuthProvider = OAuthProvider = __decorate([
|
|
86
|
-
(0, typeorm_1.Entity)('oauth_providers')
|
|
87
|
-
], OAuthProvider);
|
|
88
|
-
//# sourceMappingURL=oauth-provider.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-provider.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/oauth-provider.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgE;AAChE,6CAA8C;AAC9C,+CAA2C;AAC3C,+CAAqC;AACrC,4DAA4D;AAGrD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,wBAAU;IA0D3C,KAAK;QACH,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,cAAc,EAAE,IAAI,CAAC,cAAc;YACnC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,2BAA2B;SAC5B,CAAC;IACJ,CAAC;CACF,CAAA;AAxEY,sCAAa;AAGxB;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,kBAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;IAC7E,IAAA,oBAAU,EAA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AW,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAC/C,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;oDACH;AAOxB;IAFC,IAAA,qBAAW,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAChC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACT;wBAxDtB,aAAa;IADzB,IAAA,gBAAM,EAAC,iBAAiB,CAAC;GACb,aAAa,CAwEzB"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BaseEntity } from './base.entity';
|
|
2
|
-
export declare enum OtpPurpose {
|
|
3
|
-
VERIFY_EMAIL = "VERIFY_EMAIL",// For registration
|
|
4
|
-
VERIFY_PHONE = "VERIFY_PHONE",// For registration
|
|
5
|
-
PASSWORD_RESET = "PASSWORD_RESET",// For recovery
|
|
6
|
-
LOGIN_2FA = "LOGIN_2FA",// For logging in
|
|
7
|
-
MAGIC_LINK = "MAGIC_LINK",// For magic link login
|
|
8
|
-
SECURE_ACCOUNT = "SECURE_ACCOUNT"
|
|
9
|
-
}
|
|
10
|
-
export declare class OtpToken extends BaseEntity {
|
|
11
|
-
identifier: string;
|
|
12
|
-
purpose: OtpPurpose;
|
|
13
|
-
codeHash: string;
|
|
14
|
-
expiresAt: Date;
|
|
15
|
-
isUsed: boolean;
|
|
16
|
-
requestUserId?: string;
|
|
17
|
-
/**
|
|
18
|
-
* The ID of the primary Auth record that triggered this verification.
|
|
19
|
-
* This is used to mark the specific Auth method as verified upon success.
|
|
20
|
-
*/
|
|
21
|
-
requestAuthId?: string;
|
|
22
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.OtpToken = exports.OtpPurpose = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
const base_entity_1 = require("./base.entity");
|
|
15
|
-
var OtpPurpose;
|
|
16
|
-
(function (OtpPurpose) {
|
|
17
|
-
OtpPurpose["VERIFY_EMAIL"] = "VERIFY_EMAIL";
|
|
18
|
-
OtpPurpose["VERIFY_PHONE"] = "VERIFY_PHONE";
|
|
19
|
-
OtpPurpose["PASSWORD_RESET"] = "PASSWORD_RESET";
|
|
20
|
-
OtpPurpose["LOGIN_2FA"] = "LOGIN_2FA";
|
|
21
|
-
OtpPurpose["MAGIC_LINK"] = "MAGIC_LINK";
|
|
22
|
-
OtpPurpose["SECURE_ACCOUNT"] = "SECURE_ACCOUNT";
|
|
23
|
-
})(OtpPurpose || (exports.OtpPurpose = OtpPurpose = {}));
|
|
24
|
-
let OtpToken = class OtpToken extends base_entity_1.BaseEntity {
|
|
25
|
-
};
|
|
26
|
-
exports.OtpToken = OtpToken;
|
|
27
|
-
__decorate([
|
|
28
|
-
(0, typeorm_1.Column)(),
|
|
29
|
-
__metadata("design:type", String)
|
|
30
|
-
], OtpToken.prototype, "identifier", void 0);
|
|
31
|
-
__decorate([
|
|
32
|
-
(0, typeorm_1.Column)({ type: 'enum', enum: OtpPurpose }),
|
|
33
|
-
__metadata("design:type", String)
|
|
34
|
-
], OtpToken.prototype, "purpose", void 0);
|
|
35
|
-
__decorate([
|
|
36
|
-
(0, typeorm_1.Column)(),
|
|
37
|
-
__metadata("design:type", String)
|
|
38
|
-
], OtpToken.prototype, "codeHash", void 0);
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, typeorm_1.Column)({ type: 'timestamp' }),
|
|
41
|
-
__metadata("design:type", Date)
|
|
42
|
-
], OtpToken.prototype, "expiresAt", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, typeorm_1.Column)({ default: false }),
|
|
45
|
-
__metadata("design:type", Boolean)
|
|
46
|
-
], OtpToken.prototype, "isUsed", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
49
|
-
__metadata("design:type", String)
|
|
50
|
-
], OtpToken.prototype, "requestUserId", void 0);
|
|
51
|
-
__decorate([
|
|
52
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
53
|
-
__metadata("design:type", String)
|
|
54
|
-
], OtpToken.prototype, "requestAuthId", void 0);
|
|
55
|
-
exports.OtpToken = OtpToken = __decorate([
|
|
56
|
-
(0, typeorm_1.Entity)('otp_tokens')
|
|
57
|
-
// Index makes lookup fast: "Find latest unused OTP for john@gmail.com"
|
|
58
|
-
,
|
|
59
|
-
(0, typeorm_1.Index)(['identifier', 'purpose', 'isUsed'])
|
|
60
|
-
], OtpToken);
|
|
61
|
-
//# sourceMappingURL=otp-token.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"otp-token.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/otp-token.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAgD;AAChD,+CAA2C;AAE3C,IAAY,UAOX;AAPD,WAAY,UAAU;IACpB,2CAA6B,CAAA;IAC7B,2CAA6B,CAAA;IAC7B,+CAAiC,CAAA;IACjC,qCAAuB,CAAA;IACvB,uCAAyB,CAAA;IACzB,+CAAiC,CAAA;AACnC,CAAC,EAPW,UAAU,0BAAV,UAAU,QAOrB;AAKM,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,wBAAU;CAgCvC,CAAA;AAhCY,4BAAQ;AAInB;IADC,IAAA,gBAAM,GAAE;;4CACU;AAInB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;;yCACvB;AAKpB;IADC,IAAA,gBAAM,GAAE;;0CACQ;AAGjB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;8BACnB,IAAI;2CAAC;AAGhB;IADC,IAAA,gBAAM,EAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;wCACX;AAKhB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACJ;AAOvB;IADC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACJ;mBA/BZ,QAAQ;IAHpB,IAAA,gBAAM,EAAC,YAAY,CAAC;IACrB,uEAAuE;;IACtE,IAAA,eAAK,EAAC,CAAC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;GAC9B,QAAQ,CAgCpB"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export declare class Session {
|
|
2
|
-
id: string;
|
|
3
|
-
uid: string;
|
|
4
|
-
namespace: string;
|
|
5
|
-
refreshTokenHash: string;
|
|
6
|
-
userAgent: string;
|
|
7
|
-
deviceFingerprint: string;
|
|
8
|
-
ipAddress: string;
|
|
9
|
-
expiresAt: Date;
|
|
10
|
-
createdAt: Date;
|
|
11
|
-
toMap(): {
|
|
12
|
-
id: string;
|
|
13
|
-
uid: string;
|
|
14
|
-
userAgent: string;
|
|
15
|
-
deviceFingerprint: string;
|
|
16
|
-
ipAddress: string;
|
|
17
|
-
expiresAt: Date;
|
|
18
|
-
createdAt: Date;
|
|
19
|
-
namespace: string;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Session = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
let Session = class Session {
|
|
15
|
-
toMap() {
|
|
16
|
-
return {
|
|
17
|
-
id: this.id,
|
|
18
|
-
uid: this.uid,
|
|
19
|
-
userAgent: this.userAgent,
|
|
20
|
-
deviceFingerprint: this.deviceFingerprint,
|
|
21
|
-
ipAddress: this.ipAddress,
|
|
22
|
-
expiresAt: this.expiresAt,
|
|
23
|
-
createdAt: this.createdAt,
|
|
24
|
-
namespace: this.namespace,
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.Session = Session;
|
|
29
|
-
__decorate([
|
|
30
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], Session.prototype, "id", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, typeorm_1.Column)(),
|
|
35
|
-
(0, typeorm_1.Index)(),
|
|
36
|
-
__metadata("design:type", String)
|
|
37
|
-
], Session.prototype, "uid", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
40
|
-
(0, typeorm_1.Index)(),
|
|
41
|
-
__metadata("design:type", String)
|
|
42
|
-
], Session.prototype, "namespace", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, typeorm_1.Column)({ select: false }) // Do not return in standard queries
|
|
45
|
-
,
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], Session.prototype, "refreshTokenHash", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
50
|
-
__metadata("design:type", String)
|
|
51
|
-
], Session.prototype, "userAgent", void 0);
|
|
52
|
-
__decorate([
|
|
53
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
54
|
-
__metadata("design:type", String)
|
|
55
|
-
], Session.prototype, "deviceFingerprint", void 0);
|
|
56
|
-
__decorate([
|
|
57
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
58
|
-
__metadata("design:type", String)
|
|
59
|
-
], Session.prototype, "ipAddress", void 0);
|
|
60
|
-
__decorate([
|
|
61
|
-
(0, typeorm_1.Column)(),
|
|
62
|
-
__metadata("design:type", Date)
|
|
63
|
-
], Session.prototype, "expiresAt", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
66
|
-
__metadata("design:type", Date)
|
|
67
|
-
], Session.prototype, "createdAt", void 0);
|
|
68
|
-
exports.Session = Session = __decorate([
|
|
69
|
-
(0, typeorm_1.Entity)('sessions')
|
|
70
|
-
], Session);
|
|
71
|
-
//# sourceMappingURL=session.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/session.entity.ts"],"names":[],"mappings":";;;;;;;;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
|
|
4
|
-
REVOKE = 2,
|
|
5
|
-
EXPIRE = 3,
|
|
6
|
-
DELETE = 4
|
|
7
|
-
}
|
|
8
|
-
export declare class SessionLog {
|
|
9
|
-
id: string;
|
|
10
|
-
sessionId: string;
|
|
11
|
-
uid: string;
|
|
12
|
-
namespace: string;
|
|
13
|
-
event: SessionEvent;
|
|
14
|
-
userAgent: string;
|
|
15
|
-
deviceFingerprint: string;
|
|
16
|
-
ipAddress: string;
|
|
17
|
-
timestamp: Date;
|
|
18
|
-
reason?: string;
|
|
19
|
-
toMap(): {
|
|
20
|
-
id: string;
|
|
21
|
-
uid: string;
|
|
22
|
-
sessionId: string;
|
|
23
|
-
event: SessionEvent;
|
|
24
|
-
userAgent: string;
|
|
25
|
-
deviceFingerprint: string;
|
|
26
|
-
ipAddress: string;
|
|
27
|
-
timestamp: Date;
|
|
28
|
-
reason: string;
|
|
29
|
-
namespace: string;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SessionLog = exports.SessionEvent = void 0;
|
|
13
|
-
const typeorm_1 = require("typeorm");
|
|
14
|
-
var SessionEvent;
|
|
15
|
-
(function (SessionEvent) {
|
|
16
|
-
SessionEvent[SessionEvent["LOGIN"] = 0] = "LOGIN";
|
|
17
|
-
SessionEvent[SessionEvent["LOGOUT"] = 1] = "LOGOUT";
|
|
18
|
-
SessionEvent[SessionEvent["REVOKE"] = 2] = "REVOKE";
|
|
19
|
-
SessionEvent[SessionEvent["EXPIRE"] = 3] = "EXPIRE";
|
|
20
|
-
SessionEvent[SessionEvent["DELETE"] = 4] = "DELETE";
|
|
21
|
-
})(SessionEvent || (exports.SessionEvent = SessionEvent = {}));
|
|
22
|
-
let SessionLog = class SessionLog {
|
|
23
|
-
toMap() {
|
|
24
|
-
return {
|
|
25
|
-
id: this.id,
|
|
26
|
-
uid: this.uid,
|
|
27
|
-
sessionId: this.sessionId,
|
|
28
|
-
event: this.event,
|
|
29
|
-
userAgent: this.userAgent,
|
|
30
|
-
deviceFingerprint: this.deviceFingerprint,
|
|
31
|
-
ipAddress: this.ipAddress,
|
|
32
|
-
timestamp: this.timestamp,
|
|
33
|
-
reason: this.reason,
|
|
34
|
-
namespace: this.namespace,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.SessionLog = SessionLog;
|
|
39
|
-
__decorate([
|
|
40
|
-
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
41
|
-
__metadata("design:type", String)
|
|
42
|
-
], SessionLog.prototype, "id", void 0);
|
|
43
|
-
__decorate([
|
|
44
|
-
(0, typeorm_1.Column)('uuid'),
|
|
45
|
-
(0, typeorm_1.Index)(),
|
|
46
|
-
__metadata("design:type", String)
|
|
47
|
-
], SessionLog.prototype, "sessionId", void 0);
|
|
48
|
-
__decorate([
|
|
49
|
-
(0, typeorm_1.Column)('uuid'),
|
|
50
|
-
(0, typeorm_1.Index)(),
|
|
51
|
-
__metadata("design:type", String)
|
|
52
|
-
], SessionLog.prototype, "uid", void 0);
|
|
53
|
-
__decorate([
|
|
54
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
55
|
-
(0, typeorm_1.Index)(),
|
|
56
|
-
__metadata("design:type", String)
|
|
57
|
-
], SessionLog.prototype, "namespace", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, typeorm_1.Column)(),
|
|
60
|
-
__metadata("design:type", Number)
|
|
61
|
-
], SessionLog.prototype, "event", void 0);
|
|
62
|
-
__decorate([
|
|
63
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
64
|
-
__metadata("design:type", String)
|
|
65
|
-
], SessionLog.prototype, "userAgent", void 0);
|
|
66
|
-
__decorate([
|
|
67
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
68
|
-
__metadata("design:type", String)
|
|
69
|
-
], SessionLog.prototype, "deviceFingerprint", void 0);
|
|
70
|
-
__decorate([
|
|
71
|
-
(0, typeorm_1.Column)({ nullable: true }),
|
|
72
|
-
__metadata("design:type", String)
|
|
73
|
-
], SessionLog.prototype, "ipAddress", void 0);
|
|
74
|
-
__decorate([
|
|
75
|
-
(0, typeorm_1.CreateDateColumn)(),
|
|
76
|
-
__metadata("design:type", Date)
|
|
77
|
-
], SessionLog.prototype, "timestamp", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
(0, typeorm_1.Column)(),
|
|
80
|
-
__metadata("design:type", String)
|
|
81
|
-
], SessionLog.prototype, "reason", void 0);
|
|
82
|
-
exports.SessionLog = SessionLog = __decorate([
|
|
83
|
-
(0, typeorm_1.Entity)('session_logs')
|
|
84
|
-
], SessionLog);
|
|
85
|
-
//# sourceMappingURL=session_log.entity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session_log.entity.js","sourceRoot":"","sources":["../../../src/auth/entities/session_log.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAMiB;AAEjB,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,iDAAK,CAAA;IACL,mDAAM,CAAA;IACN,mDAAM,CAAA;I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IAAA,gBAAM,EAAC,cAAc,CAAC;GACV,UAAU,CAmDtB"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const AUTH_USER_SERVICE = "AUTH_USER_SERVICE";
|
|
2
|
-
export declare const AUTH_MODULE_OPTIONS = "AUTH_MODULE_OPTIONS";
|
|
3
|
-
export declare const AUTH_SIGNUP_HANDLER = "AUTH_SIGNUP_HANDLER";
|
|
4
|
-
export interface AuthUserLookupService {
|
|
5
|
-
findUser(authId: string): Promise<any | null>;
|
|
6
|
-
findById?(id: string): Promise<any | null>;
|
|
7
|
-
}
|
|
8
|
-
export interface AuthSignupHandler {
|
|
9
|
-
onSignup(auth: any, dto: any): Promise<any>;
|
|
10
|
-
create?(data: any): Promise<any>;
|
|
11
|
-
}
|
|
12
|
-
export interface AuthUserService extends AuthUserLookupService, AuthSignupHandler {
|
|
13
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AUTH_SIGNUP_HANDLER = exports.AUTH_MODULE_OPTIONS = exports.AUTH_USER_SERVICE = void 0;
|
|
4
|
-
exports.AUTH_USER_SERVICE = 'AUTH_USER_SERVICE';
|
|
5
|
-
exports.AUTH_MODULE_OPTIONS = 'AUTH_MODULE_OPTIONS';
|
|
6
|
-
exports.AUTH_SIGNUP_HANDLER = 'AUTH_SIGNUP_HANDLER';
|
|
7
|
-
//# sourceMappingURL=auth-user-service.interface.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-user-service.interface.js","sourceRoot":"","sources":["../../../src/auth/interfaces/auth-user-service.interface.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,mBAAmB,GAAG,qBAAqB,CAAC;AAC5C,QAAA,mBAAmB,GAAG,qBAAqB,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { AuthCredential } from './current-user-interface';
|
|
2
|
-
export declare const CurrentAuth: (...dataOrPipes: (import("@nestjs/common").PipeTransform<any, any> | import("@nestjs/common").Type<import("@nestjs/common").PipeTransform<any, any>> | keyof AuthCredential)[]) => ParameterDecorator;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CurrentAuth = void 0;
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
|
-
// src/auth/current-user.decorator.ts
|
|
6
|
-
exports.CurrentAuth = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
7
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
8
|
-
const request = ctx.switchToHttp().getRequest();
|
|
9
|
-
const logger = new common_1.Logger('CurrentAuthDecorator');
|
|
10
|
-
// logger.log(`Request keys: ${Object.keys(request)}`)
|
|
11
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
12
|
-
const user = request.user;
|
|
13
|
-
logger.log(`Extracted auth: ${JSON.stringify(user)}`);
|
|
14
|
-
return data ? user?.[data] : user;
|
|
15
|
-
});
|
|
16
|
-
//# sourceMappingURL=current-user.decorator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"current-user.decorator.js","sourceRoot":"","sources":["../../../src/auth/interfaces/current-user.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAgF;AAGhF,qCAAqC;AACxB,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC7C,CAAC,IAAsC,EAAE,GAAqB,EAAE,EAAE;IAChE,mEAAmE;IACnE,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAEhD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAsB,CAAC,CAAC;IAClD,sDAAsD;IACtD,sEAAsE;IACtE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1B,MAAM,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEtD,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpC,CAAC,CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-payload-interface.js","sourceRoot":"","sources":["../../src/auth/jwt-payload-interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Strategy } from 'passport-jwt';
|
|
2
|
-
import { AuthModuleOptions } from './interfaces/auth-module-options.interface';
|
|
3
|
-
import { JwtPayload } from './jwt-payload-interface';
|
|
4
|
-
declare const JwtStrategy_base: new (...args: [opt: import("passport-jwt").StrategyOptionsWithoutRequest] | [opt: import("passport-jwt").StrategyOptionsWithRequest]) => Strategy & {
|
|
5
|
-
validate(...args: any[]): unknown;
|
|
6
|
-
};
|
|
7
|
-
export declare class JwtStrategy extends JwtStrategy_base {
|
|
8
|
-
private options;
|
|
9
|
-
private readonly logger;
|
|
10
|
-
constructor(options: AuthModuleOptions);
|
|
11
|
-
validate(payload: JwtPayload): Promise<any>;
|
|
12
|
-
}
|
|
13
|
-
export {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
var JwtStrategy_1;
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.JwtStrategy = void 0;
|
|
17
|
-
// src/auth/jwt.strategy.ts
|
|
18
|
-
const common_1 = require("@nestjs/common");
|
|
19
|
-
const passport_1 = require("@nestjs/passport");
|
|
20
|
-
const passport_jwt_1 = require("passport-jwt");
|
|
21
|
-
const auth_module_options_interface_1 = require("./interfaces/auth-module-options.interface");
|
|
22
|
-
const common_2 = require("@nestjs/common");
|
|
23
|
-
let JwtStrategy = JwtStrategy_1 = class JwtStrategy extends (0, passport_1.PassportStrategy)(passport_jwt_1.Strategy) {
|
|
24
|
-
constructor(options) {
|
|
25
|
-
const cookieExtractor = (req) => {
|
|
26
|
-
if (!req || !req.cookies) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const cookies = req.cookies;
|
|
30
|
-
const token = cookies?.access_token ?? null;
|
|
31
|
-
return typeof token === 'string' ? token : null;
|
|
32
|
-
};
|
|
33
|
-
super({
|
|
34
|
-
jwtFromRequest: passport_jwt_1.ExtractJwt.fromExtractors([
|
|
35
|
-
cookieExtractor,
|
|
36
|
-
passport_jwt_1.ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
37
|
-
]),
|
|
38
|
-
ignoreExpiration: false,
|
|
39
|
-
secretOrKey: options.jwtSecret || process.env.JWT_SECRET || 'changeme',
|
|
40
|
-
});
|
|
41
|
-
this.options = options;
|
|
42
|
-
this.logger = new common_1.Logger(JwtStrategy_1.name);
|
|
43
|
-
}
|
|
44
|
-
async validate(payload) {
|
|
45
|
-
this.logger.log(`JWT payload: ${JSON.stringify(payload)}`);
|
|
46
|
-
// In Identity-Only mode, req.user is the token payload.
|
|
47
|
-
// The application uses the 'sub' (uid) to link to its own user record.
|
|
48
|
-
return {
|
|
49
|
-
uid: payload.sub,
|
|
50
|
-
sessionId: payload.sessionId,
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
exports.JwtStrategy = JwtStrategy;
|
|
55
|
-
exports.JwtStrategy = JwtStrategy = JwtStrategy_1 = __decorate([
|
|
56
|
-
(0, common_1.Injectable)(),
|
|
57
|
-
__param(0, (0, common_2.Inject)(auth_module_options_interface_1.AUTH_MODULE_OPTIONS)),
|
|
58
|
-
__metadata("design:paramtypes", [Object])
|
|
59
|
-
], JwtStrategy);
|
|
60
|
-
//# sourceMappingURL=jwt.strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.strategy.js","sourceRoot":"","sources":["../../src/auth/jwt.strategy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2BAA2B;AAC3B,2CAAoD;AACpD,+CAAoD;AACpD,+CAAoD;AACpD,8FAAoG;AACpG,2CAAwC;AAKjC,IAAM,WAAW,mBAAjB,MAAM,WAAY,SAAQ,IAAA,2BAAgB,EAAC,uBAAQ,CAAC;IAGzD,YAC+B,OAAkC;QAE/D,MAAM,eAAe,GAAG,CAAC,GAAY,EAAiB,EAAE;YACtD,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;gBACzB,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,OAAO,GAAG,GAAG,CAAC,OAAwC,CAAC;YAC7D,MAAM,KAAK,GAAG,OAAO,EAAE,YAAY,IAAI,IAAI,CAAC;YAC5C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAClD,CAAC,CAAC;QACF,KAAK,CAAC;YACJ,cAAc,EAAE,yBAAU,CAAC,cAAc,CAAC;gBACxC,eAAe;gBACf,yBAAU,CAAC,2BAA2B,EAAE;aACzC,CAAC;YACF,gBAAgB,EAAE,KAAK;YACvB,WAAW,EAAE,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,UAAU;SACvE,CAAC,CAAC;QAlBkC,YAAO,GAAP,OAAO,CAAmB;QAHhD,WAAM,GAAG,IAAI,eAAM,CAAC,aAAW,CAAC,IAAI,CAAC,CAAC;IAsBvD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAmB;QAChC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE3D,wDAAwD;QACxD,uEAAuE;QACvE,OAAO;YACL,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC;IACJ,CAAC;CACF,CAAA;AAnCY,kCAAW;sBAAX,WAAW;IADvB,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,mDAAmB,CAAC,CAAA;;GAJnB,WAAW,CAmCvB"}
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=company.strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"company.strategy.js","sourceRoot":"","sources":["../../../src/auth/strategies/company.strategy.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { LoginDto } from '../dto/login.dto';
|
|
2
|
-
import { SignupDto } from '../dto/signup.dto';
|
|
3
|
-
import { Auth } from '../entities/auth.entity';
|
|
4
|
-
export declare class GoogleAuthStrategy {
|
|
5
|
-
registerCredentials(dto: SignupDto, uid?: string): Promise<Auth>;
|
|
6
|
-
login(dto: LoginDto): Promise<Auth>;
|
|
7
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.GoogleAuthStrategy = void 0;
|
|
10
|
-
const common_1 = require("@nestjs/common");
|
|
11
|
-
let GoogleAuthStrategy = class GoogleAuthStrategy {
|
|
12
|
-
async registerCredentials(dto, uid) {
|
|
13
|
-
throw new Error('Not implemented');
|
|
14
|
-
}
|
|
15
|
-
async login(dto) {
|
|
16
|
-
throw new Error('Not implemented');
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
exports.GoogleAuthStrategy = GoogleAuthStrategy;
|
|
20
|
-
exports.GoogleAuthStrategy = GoogleAuthStrategy = __decorate([
|
|
21
|
-
(0, common_1.Injectable)()
|
|
22
|
-
], GoogleAuthStrategy);
|
|
23
|
-
//# sourceMappingURL=google.strategy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"google.strategy.js","sourceRoot":"","sources":["../../../src/auth/strategies/google.strategy.ts"],"names":[],"mappings":";;;;;;;;;AAEA,2CAA4C;AAMrC,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAC7B,KAAK,CAAC,mBAAmB,CAAC,GAAc,EAAE,GAAY;QAGpD,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,GAAa;QAEvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AAXY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;GACA,kBAAkB,CAW9B"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SignupDto } from '../../dto/requests/signup.dto';
|
|
2
|
-
import { LoginDto } from '../../dto/requests/login.dto';
|
|
3
|
-
import { Auth } from '../../entities/auth.entity';
|
|
4
|
-
import { AuthIdentifier } from '../../entities/auth-identify.entity';
|
|
5
|
-
export interface IOAuthStrategy {
|
|
6
|
-
registerCredentials(dto: SignupDto, uid?: string): Promise<{
|
|
7
|
-
auth: Auth;
|
|
8
|
-
identifier?: AuthIdentifier;
|
|
9
|
-
}>;
|
|
10
|
-
login(dto: LoginDto): Promise<{
|
|
11
|
-
auth: Auth;
|
|
12
|
-
identifier?: AuthIdentifier;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-strategy.interface.js","sourceRoot":"","sources":["../../../../src/auth/strategies/oauth/oauth-strategy.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { LoginDto } from '../dto/login.dto';
|
|
2
|
-
import { SignupDto } from '../dto/signup.dto';
|
|
3
|
-
import { Auth } from '../entities/auth.entity';
|
|
4
|
-
export declare class OtpAuthStrategy {
|
|
5
|
-
registerCredentials(dto: SignupDto, uid?: string): Promise<Auth>;
|
|
6
|
-
login(dto: LoginDto): Promise<Auth>;
|
|
7
|
-
}
|