Search in sources :

Example 1 with CredentialsAuditRepository

use of com.nexblocks.authguard.dal.persistence.CredentialsAuditRepository in project AuthGuard by AuthGuard.

the class CredentialsServiceImplTest method setup.

@BeforeEach
void setup() {
    accountsService = Mockito.mock(AccountsService.class);
    idempotencyService = Mockito.mock(IdempotencyService.class);
    credentialsRepository = Mockito.mock(CredentialsRepository.class);
    credentialsAuditRepository = Mockito.mock(CredentialsAuditRepository.class);
    accountTokensRepository = Mockito.mock(AccountTokensRepository.class);
    securePassword = Mockito.mock(SecurePassword.class);
    securePasswordProvider = Mockito.mock(SecurePasswordProvider.class);
    messageBus = Mockito.mock(MessageBus.class);
    serviceMapper = new ServiceMapperImpl();
    Mockito.when(securePasswordProvider.get()).thenReturn(securePassword);
    Mockito.when(securePasswordProvider.getCurrentVersion()).thenReturn(1);
    final PasswordValidator passwordValidator = new PasswordValidator(PasswordsConfig.builder().conditions(PasswordConditions.builder().build()).build());
    credentialsService = new CredentialsServiceImpl(accountsService, idempotencyService, credentialsRepository, credentialsAuditRepository, accountTokensRepository, securePasswordProvider, passwordValidator, messageBus, serviceMapper);
    Mockito.when(accountsService.getById(any())).thenReturn(Optional.of(RANDOM.nextObject(AccountBO.class)));
}
Also used : MessageBus(com.nexblocks.authguard.emb.MessageBus) CredentialsRepository(com.nexblocks.authguard.dal.persistence.CredentialsRepository) AccountTokensRepository(com.nexblocks.authguard.dal.cache.AccountTokensRepository) SecurePasswordProvider(com.nexblocks.authguard.basic.passwords.SecurePasswordProvider) ServiceMapperImpl(com.nexblocks.authguard.service.mappers.ServiceMapperImpl) AccountsService(com.nexblocks.authguard.service.AccountsService) SecurePassword(com.nexblocks.authguard.basic.passwords.SecurePassword) PasswordValidator(com.nexblocks.authguard.basic.passwords.PasswordValidator) IdempotencyService(com.nexblocks.authguard.service.IdempotencyService) CredentialsAuditRepository(com.nexblocks.authguard.dal.persistence.CredentialsAuditRepository) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

PasswordValidator (com.nexblocks.authguard.basic.passwords.PasswordValidator)1 SecurePassword (com.nexblocks.authguard.basic.passwords.SecurePassword)1 SecurePasswordProvider (com.nexblocks.authguard.basic.passwords.SecurePasswordProvider)1 AccountTokensRepository (com.nexblocks.authguard.dal.cache.AccountTokensRepository)1 CredentialsAuditRepository (com.nexblocks.authguard.dal.persistence.CredentialsAuditRepository)1 CredentialsRepository (com.nexblocks.authguard.dal.persistence.CredentialsRepository)1 MessageBus (com.nexblocks.authguard.emb.MessageBus)1 AccountsService (com.nexblocks.authguard.service.AccountsService)1 IdempotencyService (com.nexblocks.authguard.service.IdempotencyService)1 ServiceMapperImpl (com.nexblocks.authguard.service.mappers.ServiceMapperImpl)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1