mirror of
https://gitlab.com/mobicoop/v3/service/auth.git
synced 2026-03-23 09:45:49 +00:00
upgrade packages; handle throttle failure with message broker handler
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
import {
|
||||
ConfigurationDomainGet,
|
||||
ConfigurationType,
|
||||
} from '@mobicoop/configuration-module';
|
||||
import { KeyType, Type } from '@mobicoop/configuration-module';
|
||||
import { IsStrongPasswordOptions } from 'class-validator';
|
||||
|
||||
export const STRONG_PASSWORD_OPTIONS: IsStrongPasswordOptions = {
|
||||
@@ -13,9 +10,9 @@ export const STRONG_PASSWORD_OPTIONS: IsStrongPasswordOptions = {
|
||||
};
|
||||
|
||||
export const AUTH_CONFIG_ENCRYPTION_ALGORITHM = 'encryptionAlgorithm';
|
||||
export const AuthConfig: ConfigurationDomainGet[] = [
|
||||
export const AuthKeyTypes: KeyType[] = [
|
||||
{
|
||||
key: AUTH_CONFIG_ENCRYPTION_ALGORITHM,
|
||||
type: ConfigurationType.STRING,
|
||||
type: Type.STRING,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -17,13 +17,13 @@ import {
|
||||
UsernameAlreadyExistsException,
|
||||
} from '@modules/authentication/core/domain/authentication.errors';
|
||||
import {
|
||||
ConfigurationDomain,
|
||||
Configurator,
|
||||
Domain,
|
||||
GetConfigurationRepositoryPort,
|
||||
} from '@mobicoop/configuration-module';
|
||||
import {
|
||||
AUTH_CONFIG_ENCRYPTION_ALGORITHM,
|
||||
AuthConfig,
|
||||
AuthKeyTypes,
|
||||
} from '@modules/authentication/authentication.constants';
|
||||
import { EncryptionAlgorithm } from '@modules/authentication/core/domain/username.types';
|
||||
import { PasswordEncrypter } from '@modules/authentication/infrastructure/password-encrypter';
|
||||
@@ -40,10 +40,7 @@ export class CreateAuthenticationService implements ICommandHandler {
|
||||
|
||||
async execute(command: CreateAuthenticationCommand): Promise<AggregateID> {
|
||||
const authConfigurator: Configurator =
|
||||
await this.configurationRepository.mget(
|
||||
ConfigurationDomain.AUTH,
|
||||
AuthConfig,
|
||||
);
|
||||
await this.configurationRepository.mget(Domain.AUTH, AuthKeyTypes);
|
||||
const passwordEncrypter: PasswordEncrypterPort = new PasswordEncrypter(
|
||||
authConfigurator.get<EncryptionAlgorithm>(
|
||||
AUTH_CONFIG_ENCRYPTION_ALGORITHM,
|
||||
|
||||
@@ -9,13 +9,13 @@ import { UpdatePasswordCommand } from './update-password.command';
|
||||
import { AuthenticationRepositoryPort } from '../../ports/authentication.repository.port';
|
||||
import { AuthenticationEntity } from '@modules/authentication/core/domain/authentication.entity';
|
||||
import {
|
||||
ConfigurationDomain,
|
||||
Domain,
|
||||
Configurator,
|
||||
GetConfigurationRepositoryPort,
|
||||
} from '@mobicoop/configuration-module';
|
||||
import {
|
||||
AUTH_CONFIG_ENCRYPTION_ALGORITHM,
|
||||
AuthConfig,
|
||||
AuthKeyTypes,
|
||||
} from '@modules/authentication/authentication.constants';
|
||||
import { EncryptionAlgorithm } from '@modules/authentication/core/domain/username.types';
|
||||
import { PasswordEncrypterPort } from '../../ports/password-encrypter.port';
|
||||
@@ -32,10 +32,7 @@ export class UpdatePasswordService implements ICommandHandler {
|
||||
|
||||
async execute(command: UpdatePasswordCommand): Promise<AggregateID> {
|
||||
const authConfigurator: Configurator =
|
||||
await this.configurationRepository.mget(
|
||||
ConfigurationDomain.AUTH,
|
||||
AuthConfig,
|
||||
);
|
||||
await this.configurationRepository.mget(Domain.AUTH, AuthKeyTypes);
|
||||
const encryptionAlgorithm: EncryptionAlgorithm =
|
||||
authConfigurator.get<EncryptionAlgorithm>(
|
||||
AUTH_CONFIG_ENCRYPTION_ALGORITHM,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
ConfigurationDomain,
|
||||
ConfigurationDomainGet,
|
||||
Domain,
|
||||
Configurator,
|
||||
GetConfigurationRepositoryPort,
|
||||
KeyType,
|
||||
} from '@mobicoop/configuration-module';
|
||||
import {
|
||||
AggregateID,
|
||||
@@ -58,12 +58,12 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
|
||||
get: jest.fn(),
|
||||
mget: jest.fn().mockImplementation(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => {
|
||||
(domain: Domain, keyTypes: KeyType[]) => {
|
||||
switch (domain) {
|
||||
case ConfigurationDomain.AUTH:
|
||||
return new Configurator(ConfigurationDomain.AUTH, [
|
||||
case Domain.AUTH:
|
||||
return new Configurator(Domain.AUTH, [
|
||||
{
|
||||
domain: ConfigurationDomain.AUTH,
|
||||
domain: Domain.AUTH,
|
||||
key: AUTH_CONFIG_ENCRYPTION_ALGORITHM,
|
||||
value: 'BCRYPT',
|
||||
},
|
||||
|
||||
@@ -9,10 +9,10 @@ import { UpdatePasswordRequestDto } from '@modules/authentication/interface/grpc
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { UpdatePasswordCommand } from '@modules/authentication/core/application/commands/update-password/update-password.command';
|
||||
import {
|
||||
ConfigurationDomain,
|
||||
ConfigurationDomainGet,
|
||||
Domain,
|
||||
Configurator,
|
||||
GetConfigurationRepositoryPort,
|
||||
KeyType,
|
||||
} from '@mobicoop/configuration-module';
|
||||
import { AUTH_CONFIG_ENCRYPTION_ALGORITHM } from '@modules/authentication/authentication.constants';
|
||||
|
||||
@@ -38,12 +38,12 @@ const mockConfigurationRepository: GetConfigurationRepositoryPort = {
|
||||
get: jest.fn(),
|
||||
mget: jest.fn().mockImplementation(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
(domain: ConfigurationDomain, configs: ConfigurationDomainGet[]) => {
|
||||
(domain: Domain, keyTypes: KeyType[]) => {
|
||||
switch (domain) {
|
||||
case ConfigurationDomain.AUTH:
|
||||
return new Configurator(ConfigurationDomain.AUTH, [
|
||||
case Domain.AUTH:
|
||||
return new Configurator(Domain.AUTH, [
|
||||
{
|
||||
domain: ConfigurationDomain.AUTH,
|
||||
domain: Domain.AUTH,
|
||||
key: AUTH_CONFIG_ENCRYPTION_ALGORITHM,
|
||||
value: 'BCRYPT',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user