@loopstack/auth 0.5.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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +7 -0
- package/dist/auth.module-definition.d.ts +2 -0
- package/dist/auth.module-definition.js +7 -0
- package/dist/auth.module-definition.js.map +1 -0
- package/dist/auth.module.d.ts +5 -0
- package/dist/auth.module.js +69 -0
- package/dist/auth.module.js.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -0
- package/dist/controllers/auth.controller.d.ts +25 -0
- package/dist/controllers/auth.controller.js +195 -0
- package/dist/controllers/auth.controller.js.map +1 -0
- package/dist/controllers/index.d.ts +1 -0
- package/dist/controllers/index.js +18 -0
- package/dist/controllers/index.js.map +1 -0
- package/dist/decorators/current-user.decorator.d.ts +1 -0
- package/dist/decorators/current-user.decorator.js +9 -0
- package/dist/decorators/current-user.decorator.js.map +1 -0
- package/dist/decorators/index.d.ts +3 -0
- package/dist/decorators/index.js +20 -0
- package/dist/decorators/index.js.map +1 -0
- package/dist/decorators/public.decorator.d.ts +1 -0
- package/dist/decorators/public.decorator.js +8 -0
- package/dist/decorators/public.decorator.js.map +1 -0
- package/dist/decorators/roles.decorator.d.ts +1 -0
- package/dist/decorators/roles.decorator.js +8 -0
- package/dist/decorators/roles.decorator.js.map +1 -0
- package/dist/guards/dev-auth.guard.d.ts +4 -0
- package/dist/guards/dev-auth.guard.js +18 -0
- package/dist/guards/dev-auth.guard.js.map +1 -0
- package/dist/guards/google-auth.guard.d.ts +5 -0
- package/dist/guards/google-auth.guard.js +23 -0
- package/dist/guards/google-auth.guard.js.map +1 -0
- package/dist/guards/index.d.ts +5 -0
- package/dist/guards/index.js +22 -0
- package/dist/guards/index.js.map +1 -0
- package/dist/guards/jwt-auth.guard.d.ts +9 -0
- package/dist/guards/jwt-auth.guard.js +39 -0
- package/dist/guards/jwt-auth.guard.js.map +1 -0
- package/dist/guards/local-auth.guard.d.ts +4 -0
- package/dist/guards/local-auth.guard.js +18 -0
- package/dist/guards/local-auth.guard.js.map +1 -0
- package/dist/guards/roles.guard.d.ts +7 -0
- package/dist/guards/roles.guard.js +38 -0
- package/dist/guards/roles.guard.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/auth-config.interface.d.ts +21 -0
- package/dist/interfaces/auth-config.interface.js +3 -0
- package/dist/interfaces/auth-config.interface.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -0
- package/dist/interfaces/index.js +19 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/module-options.interface.d.ts +2 -0
- package/dist/interfaces/module-options.interface.js +3 -0
- package/dist/interfaces/module-options.interface.js.map +1 -0
- package/dist/repositories/auth-provider.repository.d.ts +9 -0
- package/dist/repositories/auth-provider.repository.js +47 -0
- package/dist/repositories/auth-provider.repository.js.map +1 -0
- package/dist/repositories/index.d.ts +1 -0
- package/dist/repositories/index.js +18 -0
- package/dist/repositories/index.js.map +1 -0
- package/dist/repositories/user.repository.d.ts +10 -0
- package/dist/repositories/user.repository.js +52 -0
- package/dist/repositories/user.repository.js.map +1 -0
- package/dist/services/auth.service.d.ts +20 -0
- package/dist/services/auth.service.js +110 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +21 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/oauth.service.d.ts +15 -0
- package/dist/services/oauth.service.js +91 -0
- package/dist/services/oauth.service.js.map +1 -0
- package/dist/services/password.service.d.ts +5 -0
- package/dist/services/password.service.js +25 -0
- package/dist/services/password.service.js.map +1 -0
- package/dist/services/token.service.d.ts +13 -0
- package/dist/services/token.service.js +63 -0
- package/dist/services/token.service.js.map +1 -0
- package/dist/strategies/dev.strategy.d.ts +9 -0
- package/dist/strategies/dev.strategy.js +36 -0
- package/dist/strategies/dev.strategy.js.map +1 -0
- package/dist/strategies/google.strategy.d.ts +8 -0
- package/dist/strategies/google.strategy.js +51 -0
- package/dist/strategies/google.strategy.js.map +1 -0
- package/dist/strategies/index.d.ts +4 -0
- package/dist/strategies/index.js +21 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/strategies/jwt.strategy.d.ts +13 -0
- package/dist/strategies/jwt.strategy.js +52 -0
- package/dist/strategies/jwt.strategy.js.map +1 -0
- package/dist/strategies/local.strategy.d.ts +8 -0
- package/dist/strategies/local.strategy.js +36 -0
- package/dist/strategies/local.strategy.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +96 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @loopstack/auth
|
|
2
|
+
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add AuthModule to framework, Enable Startup Tasks/Schedules, Run Processes via BullMQ, Various Bugfixes
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @loopstack/core@0.5.0
|
|
13
|
+
- @loopstack/shared@0.5.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Loopstack GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Loopstack Auth Module
|
|
2
|
+
|
|
3
|
+
This is a submodule of the **Loopstack** framework.
|
|
4
|
+
|
|
5
|
+
For full documentation, contribution guidelines, and to get started with Loopstack, please visit the main repository:
|
|
6
|
+
|
|
7
|
+
👉 [github.com/loopstack-ai/loopstack](https://github.com/loopstack-ai/loopstack)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MODULE_OPTIONS_TOKEN = exports.ConfigurableModuleClass = void 0;
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
_a = new common_1.ConfigurableModuleBuilder().build(), exports.ConfigurableModuleClass = _a.ConfigurableModuleClass, exports.MODULE_OPTIONS_TOKEN = _a.MODULE_OPTIONS_TOKEN;
|
|
7
|
+
//# sourceMappingURL=auth.module-definition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.module-definition.js","sourceRoot":"","sources":["../src/auth.module-definition.ts"],"names":[],"mappings":";;;;AAAA,2CAA2D;AAG9C,KACX,IAAI,kCAAyB,EAA0B,CAAC,KAAK,EAAE,EADlD,+BAAuB,+BAAE,4BAAoB,2BACM"}
|
|
@@ -0,0 +1,69 @@
|
|
|
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 AuthModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AuthModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const jwt_1 = require("@nestjs/jwt");
|
|
13
|
+
const passport_1 = require("@nestjs/passport");
|
|
14
|
+
const typeorm_1 = require("@nestjs/typeorm");
|
|
15
|
+
const services_1 = require("./services");
|
|
16
|
+
const strategies_1 = require("./strategies");
|
|
17
|
+
const controllers_1 = require("./controllers");
|
|
18
|
+
const repositories_1 = require("./repositories");
|
|
19
|
+
const constants_1 = require("./constants");
|
|
20
|
+
const shared_1 = require("@loopstack/shared");
|
|
21
|
+
const auth_provider_repository_1 = require("./repositories/auth-provider.repository");
|
|
22
|
+
let AuthModule = AuthModule_1 = class AuthModule {
|
|
23
|
+
static forRoot(config) {
|
|
24
|
+
const strategies = [];
|
|
25
|
+
if (config.strategies.includes('local')) {
|
|
26
|
+
strategies.push(strategies_1.LocalStrategy);
|
|
27
|
+
}
|
|
28
|
+
if (config.strategies.includes('jwt')) {
|
|
29
|
+
strategies.push(strategies_1.JwtStrategy);
|
|
30
|
+
}
|
|
31
|
+
if (config.strategies.includes('google') && config.oauth?.google) {
|
|
32
|
+
strategies.push(strategies_1.GoogleStrategy);
|
|
33
|
+
}
|
|
34
|
+
if (config.strategies.includes('dev')) {
|
|
35
|
+
strategies.push(strategies_1.DevStrategy);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
module: AuthModule_1,
|
|
39
|
+
imports: [
|
|
40
|
+
passport_1.PassportModule.register({ defaultStrategy: 'jwt' }),
|
|
41
|
+
jwt_1.JwtModule.register({
|
|
42
|
+
secret: config.jwt?.secret,
|
|
43
|
+
signOptions: { expiresIn: config.jwt?.expiresIn || '1h' },
|
|
44
|
+
}),
|
|
45
|
+
typeorm_1.TypeOrmModule.forFeature([shared_1.User, shared_1.Permission, shared_1.Role, shared_1.AuthProvider]),
|
|
46
|
+
],
|
|
47
|
+
controllers: [controllers_1.AuthController],
|
|
48
|
+
providers: [
|
|
49
|
+
{
|
|
50
|
+
provide: constants_1.AUTH_CONFIG,
|
|
51
|
+
useValue: config,
|
|
52
|
+
},
|
|
53
|
+
services_1.AuthService,
|
|
54
|
+
services_1.OAuthService,
|
|
55
|
+
repositories_1.UserRepository,
|
|
56
|
+
auth_provider_repository_1.AuthProviderRepository,
|
|
57
|
+
services_1.PasswordService,
|
|
58
|
+
services_1.TokenService,
|
|
59
|
+
...strategies,
|
|
60
|
+
],
|
|
61
|
+
exports: [services_1.AuthService, repositories_1.UserRepository],
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.AuthModule = AuthModule;
|
|
66
|
+
exports.AuthModule = AuthModule = AuthModule_1 = __decorate([
|
|
67
|
+
(0, common_1.Module)({})
|
|
68
|
+
], AuthModule);
|
|
69
|
+
//# sourceMappingURL=auth.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.module.js","sourceRoot":"","sources":["../src/auth.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,qCAAwC;AACxC,+CAAkD;AAClD,6CAAgD;AAChD,yCAAsF;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AS,EAAE;gBACT;oBACE,OAAO,EAAE,uBAAW;oBACpB,QAAQ,EAAE,MAAM;iBACjB;gBACD,sBAAW;gBACX,uBAAY;gBACZ,6BAAc;gBACd,iDAAsB;gBACtB,0BAAe;gBACf,uBAAY;gBACZ,GAAG,UAAU;aACd;YACD,OAAO,EAAE,CAAC,sBAAW,EAAE,6BAAc,CAAC;SACvC,CAAC;IACJ,CAAC;CA6BF,CAAA;AA3EY,gCAAU;qBAAV,UAAU;IADtB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,UAAU,CA2EtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AUTH_CONFIG: unique symbol;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AuthService, OAuthService } from '../services';
|
|
2
|
+
import { AuthResponseDto, LinkProviderDto, LoginDto, RegisterDto, UserResponseDto } from '@loopstack/shared';
|
|
3
|
+
export declare class AuthController {
|
|
4
|
+
private readonly authService;
|
|
5
|
+
private readonly oauthService;
|
|
6
|
+
constructor(authService: AuthService, oauthService: OAuthService);
|
|
7
|
+
login(req: any, res: any, loginDto: LoginDto): Promise<{
|
|
8
|
+
message: string;
|
|
9
|
+
}>;
|
|
10
|
+
register(registerDto: RegisterDto): Promise<UserResponseDto>;
|
|
11
|
+
refresh(req: any, res: any): Promise<{
|
|
12
|
+
message: string;
|
|
13
|
+
}>;
|
|
14
|
+
logout(res: any): Promise<{
|
|
15
|
+
message: string;
|
|
16
|
+
}>;
|
|
17
|
+
googleAuth(): Promise<void>;
|
|
18
|
+
googleCallback(req: any): Promise<AuthResponseDto>;
|
|
19
|
+
linkProvider(user: any, linkProviderDto: LinkProviderDto): Promise<UserResponseDto>;
|
|
20
|
+
getProviders(user: any): Promise<string[]>;
|
|
21
|
+
me(user: any): Promise<UserResponseDto>;
|
|
22
|
+
devLogin(req: any, res: any): Promise<{
|
|
23
|
+
message: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,195 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AuthController = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const services_1 = require("../services");
|
|
18
|
+
const guards_1 = require("../guards");
|
|
19
|
+
const shared_1 = require("@loopstack/shared");
|
|
20
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
21
|
+
let AuthController = class AuthController {
|
|
22
|
+
authService;
|
|
23
|
+
oauthService;
|
|
24
|
+
constructor(authService, oauthService) {
|
|
25
|
+
this.authService = authService;
|
|
26
|
+
this.oauthService = oauthService;
|
|
27
|
+
}
|
|
28
|
+
async login(req, res, loginDto) {
|
|
29
|
+
const tokens = await this.authService.login(req.user);
|
|
30
|
+
res.cookie('accessToken', tokens.accessToken, {
|
|
31
|
+
httpOnly: true,
|
|
32
|
+
secure: process.env.NODE_ENV === 'production',
|
|
33
|
+
sameSite: 'strict',
|
|
34
|
+
maxAge: tokens.expiresIn * 1000,
|
|
35
|
+
});
|
|
36
|
+
res.cookie('refreshToken', tokens.refreshToken, {
|
|
37
|
+
httpOnly: true,
|
|
38
|
+
secure: process.env.NODE_ENV === 'production',
|
|
39
|
+
sameSite: 'strict',
|
|
40
|
+
maxAge: 7 * 24 * 60 * 60 * 1000,
|
|
41
|
+
});
|
|
42
|
+
return { message: 'Login successful' };
|
|
43
|
+
}
|
|
44
|
+
async register(registerDto) {
|
|
45
|
+
return this.authService.register(registerDto);
|
|
46
|
+
}
|
|
47
|
+
async refresh(req, res) {
|
|
48
|
+
const refreshToken = req.cookies?.refreshToken;
|
|
49
|
+
const tokens = await this.authService.refresh(refreshToken);
|
|
50
|
+
res.cookie('accessToken', tokens.accessToken, {
|
|
51
|
+
httpOnly: true,
|
|
52
|
+
secure: process.env.NODE_ENV === 'production',
|
|
53
|
+
sameSite: 'strict',
|
|
54
|
+
maxAge: tokens.expiresIn * 1000,
|
|
55
|
+
});
|
|
56
|
+
res.cookie('refreshToken', tokens.refreshToken, {
|
|
57
|
+
httpOnly: true,
|
|
58
|
+
secure: process.env.NODE_ENV === 'production',
|
|
59
|
+
sameSite: 'strict',
|
|
60
|
+
maxAge: 7 * 24 * 60 * 60 * 1000,
|
|
61
|
+
});
|
|
62
|
+
return { message: 'Token refreshed successfully' };
|
|
63
|
+
}
|
|
64
|
+
async logout(res) {
|
|
65
|
+
res.clearCookie('accessToken');
|
|
66
|
+
res.clearCookie('refreshToken');
|
|
67
|
+
return { message: 'Logout successful' };
|
|
68
|
+
}
|
|
69
|
+
async googleAuth() {
|
|
70
|
+
}
|
|
71
|
+
async googleCallback(req) {
|
|
72
|
+
return this.oauthService.handleOAuthLogin(req.user);
|
|
73
|
+
}
|
|
74
|
+
async linkProvider(user, linkProviderDto) {
|
|
75
|
+
return this.oauthService.linkProvider(user.userId, linkProviderDto);
|
|
76
|
+
}
|
|
77
|
+
async getProviders(user) {
|
|
78
|
+
return this.oauthService.getUserProviders(user.userId);
|
|
79
|
+
}
|
|
80
|
+
async me(user) {
|
|
81
|
+
return this.authService.getCurrentUser(user.userId);
|
|
82
|
+
}
|
|
83
|
+
async devLogin(req, res) {
|
|
84
|
+
const tokens = await this.authService.login(req.user);
|
|
85
|
+
res.cookie('accessToken', tokens.accessToken, {
|
|
86
|
+
httpOnly: true,
|
|
87
|
+
secure: process.env.NODE_ENV === 'production',
|
|
88
|
+
sameSite: 'strict',
|
|
89
|
+
maxAge: tokens.expiresIn * 1000,
|
|
90
|
+
});
|
|
91
|
+
res.cookie('refreshToken', tokens.refreshToken, {
|
|
92
|
+
httpOnly: true,
|
|
93
|
+
secure: process.env.NODE_ENV === 'production',
|
|
94
|
+
sameSite: 'strict',
|
|
95
|
+
maxAge: 7 * 24 * 60 * 60 * 1000,
|
|
96
|
+
});
|
|
97
|
+
return { message: 'Login successful' };
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
exports.AuthController = AuthController;
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, shared_1.Public)(),
|
|
103
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
104
|
+
(0, common_1.UseGuards)(guards_1.LocalAuthGuard),
|
|
105
|
+
(0, common_1.Post)('login'),
|
|
106
|
+
__param(0, (0, common_1.Request)()),
|
|
107
|
+
__param(1, (0, common_1.Response)({ passthrough: true })),
|
|
108
|
+
__param(2, (0, common_1.Body)()),
|
|
109
|
+
__metadata("design:type", Function),
|
|
110
|
+
__metadata("design:paramtypes", [Object, Object, shared_1.LoginDto]),
|
|
111
|
+
__metadata("design:returntype", Promise)
|
|
112
|
+
], AuthController.prototype, "login", null);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, shared_1.Public)(),
|
|
115
|
+
(0, common_1.Post)('register'),
|
|
116
|
+
__param(0, (0, common_1.Body)()),
|
|
117
|
+
__metadata("design:type", Function),
|
|
118
|
+
__metadata("design:paramtypes", [shared_1.RegisterDto]),
|
|
119
|
+
__metadata("design:returntype", Promise)
|
|
120
|
+
], AuthController.prototype, "register", null);
|
|
121
|
+
__decorate([
|
|
122
|
+
(0, shared_1.Public)(),
|
|
123
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
124
|
+
(0, common_1.Post)('refresh'),
|
|
125
|
+
__param(0, (0, common_1.Request)()),
|
|
126
|
+
__param(1, (0, common_1.Response)({ passthrough: true })),
|
|
127
|
+
__metadata("design:type", Function),
|
|
128
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
129
|
+
__metadata("design:returntype", Promise)
|
|
130
|
+
], AuthController.prototype, "refresh", null);
|
|
131
|
+
__decorate([
|
|
132
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
133
|
+
(0, common_1.Post)('logout'),
|
|
134
|
+
__param(0, (0, common_1.Response)({ passthrough: true })),
|
|
135
|
+
__metadata("design:type", Function),
|
|
136
|
+
__metadata("design:paramtypes", [Object]),
|
|
137
|
+
__metadata("design:returntype", Promise)
|
|
138
|
+
], AuthController.prototype, "logout", null);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, shared_1.Public)(),
|
|
141
|
+
(0, common_1.Get)('oauth/google'),
|
|
142
|
+
(0, common_1.UseGuards)(guards_1.GoogleAuthGuard),
|
|
143
|
+
__metadata("design:type", Function),
|
|
144
|
+
__metadata("design:paramtypes", []),
|
|
145
|
+
__metadata("design:returntype", Promise)
|
|
146
|
+
], AuthController.prototype, "googleAuth", null);
|
|
147
|
+
__decorate([
|
|
148
|
+
(0, shared_1.Public)(),
|
|
149
|
+
(0, common_1.Get)('oauth/google/callback'),
|
|
150
|
+
(0, common_1.UseGuards)(guards_1.GoogleAuthGuard),
|
|
151
|
+
__param(0, (0, common_1.Request)()),
|
|
152
|
+
__metadata("design:type", Function),
|
|
153
|
+
__metadata("design:paramtypes", [Object]),
|
|
154
|
+
__metadata("design:returntype", Promise)
|
|
155
|
+
], AuthController.prototype, "googleCallback", null);
|
|
156
|
+
__decorate([
|
|
157
|
+
(0, common_1.Post)('link-provider'),
|
|
158
|
+
__param(0, (0, shared_1.CurrentUser)()),
|
|
159
|
+
__param(1, (0, common_1.Body)()),
|
|
160
|
+
__metadata("design:type", Function),
|
|
161
|
+
__metadata("design:paramtypes", [Object, shared_1.LinkProviderDto]),
|
|
162
|
+
__metadata("design:returntype", Promise)
|
|
163
|
+
], AuthController.prototype, "linkProvider", null);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, common_1.Get)('providers'),
|
|
166
|
+
__param(0, (0, shared_1.CurrentUser)()),
|
|
167
|
+
__metadata("design:type", Function),
|
|
168
|
+
__metadata("design:paramtypes", [Object]),
|
|
169
|
+
__metadata("design:returntype", Promise)
|
|
170
|
+
], AuthController.prototype, "getProviders", null);
|
|
171
|
+
__decorate([
|
|
172
|
+
(0, common_1.Get)('me'),
|
|
173
|
+
__param(0, (0, shared_1.CurrentUser)()),
|
|
174
|
+
__metadata("design:type", Function),
|
|
175
|
+
__metadata("design:paramtypes", [Object]),
|
|
176
|
+
__metadata("design:returntype", Promise)
|
|
177
|
+
], AuthController.prototype, "me", null);
|
|
178
|
+
__decorate([
|
|
179
|
+
(0, shared_1.Public)(),
|
|
180
|
+
(0, common_1.HttpCode)(common_1.HttpStatus.OK),
|
|
181
|
+
(0, common_1.UseGuards)(guards_1.DevAuthGuard),
|
|
182
|
+
(0, common_1.Post)('login-dev'),
|
|
183
|
+
__param(0, (0, common_1.Request)()),
|
|
184
|
+
__param(1, (0, common_1.Response)({ passthrough: true })),
|
|
185
|
+
__metadata("design:type", Function),
|
|
186
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
187
|
+
__metadata("design:returntype", Promise)
|
|
188
|
+
], AuthController.prototype, "devLogin", null);
|
|
189
|
+
exports.AuthController = AuthController = __decorate([
|
|
190
|
+
(0, swagger_1.ApiTags)('api/v1/auth'),
|
|
191
|
+
(0, common_1.Controller)('api/v1/auth'),
|
|
192
|
+
__metadata("design:paramtypes", [services_1.AuthService,
|
|
193
|
+
services_1.OAuthService])
|
|
194
|
+
], AuthController);
|
|
195
|
+
//# sourceMappingURL=auth.controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.controller.js","sourceRoot":"","sources":["../../src/controllers/auth.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAiH;AACjH,0CAAwD;AACxD,sCAA0E;AAC1E,8CAQ2B;AAC3B,6CAA0C;AAInC,IAAM,cAAc,GAApB,MAAM,cAAc;IAEN;IACA;IAFnB,YACmB,WAAwB,EACxB,YAA0B;QAD1B,gBAAW,GAAX,WAAW,CAAa;QACxB,iBAAY,GAAZ,YAAY,CAAc;IAC1C,CAAC;IAME,AAAN,KAAK,CAAC,KAAK,CAAY,GAAG,EAAmC,GAAG,EAAU,QAAkB;QAC1F,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEtD,GAAG,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE;YAC5C,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YAC7C,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,MAAM,CAAC,SAAS,GAAG,IAAI;SAChC,CAAC,CAAC;QAEH,GAAG,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE;YAC9C,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;YAC7C,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI;SAChC,CAAC,CAAC;QAEH,OAAO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AI,EAAC,eAAe,CAAC;IAEnB,WAAA,IAAA,oBAAW,GAAE,CAAA;IACb,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAkB,wBAAe;;kDAGzC;AAGK;IADL,IAAA,YAAG,EAAC,WAAW,CAAC;IACG,WAAA,IAAA,oBAAW,GAAE,CAAA;;;;kDAEhC;AAGK;IADL,IAAA,YAAG,EAAC,IAAI,CAAC;IACA,WAAA,IAAA,oBAAW,GAAE,CAAA;;;;wCAEtB;AAMK;IAJL,IAAA,eAAM,GAAE;IACR,IAAA,iBAAQ,EAAC,mBAAU,CAAC,EAAE,CAAC;IACvB,IAAA,kBAAS,EAAC,qBAAY,CAAC;IACvB,IAAA,aAAI,EAAC,WAAW,CAAC;IACF,WAAA,IAAA,gBAAO,GAAE,CAAA;IAAO,WAAA,IAAA,iBAAQ,EAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAA;;;;8CAkB9D;yBA1HU,cAAc;IAF1B,IAAA,iBAAO,EAAC,aAAa,CAAC;IACtB,IAAA,mBAAU,EAAC,aAAa,CAAC;qCAGQ,sBAAW;QACV,uBAAY;GAHlC,cAAc,CA2H1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './auth.controller';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./auth.controller"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CurrentUser: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CurrentUser = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
exports.CurrentUser = (0, common_1.createParamDecorator)((data, ctx) => {
|
|
6
|
+
const request = ctx.switchToHttp().getRequest();
|
|
7
|
+
return request.user;
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=current-user.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"current-user.decorator.js","sourceRoot":"","sources":["../../src/decorators/current-user.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAwE;AAE3D,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC7C,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACvC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./current-user.decorator"), exports);
|
|
18
|
+
__exportStar(require("./public.decorator"), exports);
|
|
19
|
+
__exportStar(require("./roles.decorator"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/decorators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAwC;AACxC,qDAAkC;AAClC,oDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Public: () => import("@nestjs/common").CustomDecorator<string>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Public = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const shared_1 = require("@loopstack/shared");
|
|
6
|
+
const Public = () => (0, common_1.SetMetadata)(shared_1.IS_PUBLIC_KEY, true);
|
|
7
|
+
exports.Public = Public;
|
|
8
|
+
//# sourceMappingURL=public.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.decorator.js","sourceRoot":"","sources":["../../src/decorators/public.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,8CAAkD;AAE3C,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,oBAAW,EAAC,sBAAa,EAAE,IAAI,CAAC,CAAC;AAAhD,QAAA,MAAM,UAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Roles: (...roles: string[]) => import("@nestjs/common").CustomDecorator<string>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Roles = void 0;
|
|
4
|
+
const common_1 = require("@nestjs/common");
|
|
5
|
+
const shared_1 = require("@loopstack/shared");
|
|
6
|
+
const Roles = (...roles) => (0, common_1.SetMetadata)(shared_1.ROLES_KEY, roles);
|
|
7
|
+
exports.Roles = Roles;
|
|
8
|
+
//# sourceMappingURL=roles.decorator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.decorator.js","sourceRoot":"","sources":["../../src/decorators/roles.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAA6C;AAC7C,8CAA8C;AAEvC,MAAM,KAAK,GAAG,CAAC,GAAG,KAAe,EAAE,EAAE,CAAC,IAAA,oBAAW,EAAC,kBAAS,EAAE,KAAK,CAAC,CAAC;AAA9D,QAAA,KAAK,SAAyD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
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.DevAuthGuard = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const passport_1 = require("@nestjs/passport");
|
|
12
|
+
let DevAuthGuard = class DevAuthGuard extends (0, passport_1.AuthGuard)('dev') {
|
|
13
|
+
};
|
|
14
|
+
exports.DevAuthGuard = DevAuthGuard;
|
|
15
|
+
exports.DevAuthGuard = DevAuthGuard = __decorate([
|
|
16
|
+
(0, common_1.Injectable)()
|
|
17
|
+
], DevAuthGuard);
|
|
18
|
+
//# sourceMappingURL=dev-auth.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-auth.guard.js","sourceRoot":"","sources":["../../src/guards/dev-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,IAAA,oBAAS,EAAC,KAAK,CAAC;CAAG,CAAA;AAAxC,oCAAY;uBAAZ,YAAY;IADxB,IAAA,mBAAU,GAAE;GACA,YAAY,CAA4B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const GoogleAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
|
2
|
+
export declare class GoogleAuthGuard extends GoogleAuthGuard_base {
|
|
3
|
+
}
|
|
4
|
+
export declare const CurrentUser: (...dataOrPipes: unknown[]) => ParameterDecorator;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
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.CurrentUser = exports.GoogleAuthGuard = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const passport_1 = require("@nestjs/passport");
|
|
12
|
+
let GoogleAuthGuard = class GoogleAuthGuard extends (0, passport_1.AuthGuard)('google') {
|
|
13
|
+
};
|
|
14
|
+
exports.GoogleAuthGuard = GoogleAuthGuard;
|
|
15
|
+
exports.GoogleAuthGuard = GoogleAuthGuard = __decorate([
|
|
16
|
+
(0, common_1.Injectable)()
|
|
17
|
+
], GoogleAuthGuard);
|
|
18
|
+
const common_2 = require("@nestjs/common");
|
|
19
|
+
exports.CurrentUser = (0, common_2.createParamDecorator)((data, ctx) => {
|
|
20
|
+
const request = ctx.switchToHttp().getRequest();
|
|
21
|
+
return request.user;
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=google-auth.guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-auth.guard.js","sourceRoot":"","sources":["../../src/guards/google-auth.guard.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAC5C,+CAA6C;AAGtC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,IAAA,oBAAS,EAAC,QAAQ,CAAC;CAAG,CAAA;AAA9C,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;GACA,eAAe,CAA+B;AAG3D,2CAAwE;AAE3D,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC7C,CAAC,IAAa,EAAE,GAAqB,EAAE,EAAE;IACvC,MAAM,OAAO,GAAG,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,CAAC;IAChD,OAAO,OAAO,CAAC,IAAI,CAAC;AACtB,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./jwt-auth.guard"), exports);
|
|
18
|
+
__exportStar(require("./local-auth.guard"), exports);
|
|
19
|
+
__exportStar(require("./roles.guard"), exports);
|
|
20
|
+
__exportStar(require("./google-auth.guard"), exports);
|
|
21
|
+
__exportStar(require("./dev-auth.guard"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/guards/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAgC;AAChC,qDAAkC;AAClC,gDAA6B;AAC7B,sDAAmC;AACnC,mDAAgC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExecutionContext } from '@nestjs/common';
|
|
2
|
+
import { Reflector } from '@nestjs/core';
|
|
3
|
+
declare const JwtAuthGuard_base: import("@nestjs/passport").Type<import("@nestjs/passport").IAuthGuard>;
|
|
4
|
+
export declare class JwtAuthGuard extends JwtAuthGuard_base {
|
|
5
|
+
private reflector;
|
|
6
|
+
constructor(reflector: Reflector);
|
|
7
|
+
canActivate(context: ExecutionContext): boolean | Promise<boolean> | import("rxjs").Observable<boolean>;
|
|
8
|
+
}
|
|
9
|
+
export {};
|