UNPKG

@experium/nest-bruteforce-guard

Version:
63 lines (62 loc) 3.65 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var BruteforceGuardModule_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.BruteforceGuardModule = void 0; const common_1 = require("@nestjs/common"); const typeorm_1 = require("@nestjs/typeorm"); const login_attempt_entity_1 = require("./entity/login-attempt.entity"); const bruteforce_guard_service_1 = require("./bruteforce-guard.service"); const constants_1 = require("./constants"); const bruteforce_guard_interceptor_1 = require("./bruteforce-guard.interceptor"); const bad_password_exception_1 = require("./exception/bad-password.exception"); const user_disabled_exception_1 = require("./exception/user-disabled.exception"); const user_not_found_exception_1 = require("./exception/user-not-found.exception"); const bruteforce_detection_exception_1 = require("./exception/bruteforce-detection.exception"); const user_not_found_exception_catcher_1 = require("./catcher/user-not-found-exception.catcher"); const bad_password_exception_catcher_1 = require("./catcher/bad-password-exception.catcher"); const user_disabled_exception_catcher_1 = require("./catcher/user-disabled-exception.catcher"); const exception_catcher_registry_1 = require("./catcher/exception-catcher.registry"); let BruteforceGuardModule = BruteforceGuardModule_1 = class BruteforceGuardModule { static setUp(config) { return { module: BruteforceGuardModule_1, providers: [ { provide: constants_1.BRUTEFORCE_GUARD_OPTIONS_PROVIDER, useValue: config, }, bruteforce_guard_service_1.BruteforceGuardService, bruteforce_guard_interceptor_1.BruteforceGuardInterceptor, bad_password_exception_1.BadPasswordException, user_disabled_exception_1.UserDisabledException, user_not_found_exception_1.UserNotFoundException, bruteforce_detection_exception_1.BruteforceDetectionException, bad_password_exception_catcher_1.BadPasswordExceptionCatcher, user_not_found_exception_catcher_1.UserNotFoundExceptionCatcher, user_disabled_exception_catcher_1.UserDisabledExceptionCatcher, exception_catcher_registry_1.ExceptionCatcherRegistry, ], exports: [ bruteforce_guard_service_1.BruteforceGuardService, bruteforce_guard_interceptor_1.BruteforceGuardInterceptor, bad_password_exception_1.BadPasswordException, user_disabled_exception_1.UserDisabledException, user_not_found_exception_1.UserNotFoundException, bruteforce_detection_exception_1.BruteforceDetectionException, ], }; } }; BruteforceGuardModule = BruteforceGuardModule_1 = __decorate([ common_1.Global(), common_1.Module({ imports: [typeorm_1.TypeOrmModule.forFeature([login_attempt_entity_1.LoginAttempt])], }) ], BruteforceGuardModule); exports.BruteforceGuardModule = BruteforceGuardModule;