ru.foodtechlab.lib.auth.service.domain.preference.usecase.GetServicePreferenceUseCase Maven / Gradle / Ivy
package ru.foodtechlab.lib.auth.service.domain.preference.usecase;
import com.rcore.domain.commons.usecase.UseCase;
import com.rcore.domain.commons.usecase.model.SingleOutput;
import com.rcore.domain.commons.usecase.model.VoidInputValues;
import lombok.RequiredArgsConstructor;
import ru.foodtechlab.lib.auth.service.domain.confirmationCode.entity.ConfirmationCodeEntity;
import ru.foodtechlab.lib.auth.service.domain.preference.entity.*;
import ru.foodtechlab.lib.auth.service.domain.preference.port.ServicePreferenceRepository;
@RequiredArgsConstructor
public class GetServicePreferenceUseCase extends UseCase> {
private final ServicePreferenceRepository servicePreferenceRepository;
private final CreateServicePreferenceUseCase createSettings;
@Override
public SingleOutput execute(VoidInputValues voidInputValues) {
return SingleOutput.of(servicePreferenceRepository.findOne()
.orElseGet(() -> createSettings.execute(CreateServicePreferenceUseCase.InputValues.builder()
.defaultRoleCode("USER")
.authSessionWithConfirmationTTLs(new AuthSessionWithConfirmationTTLs(100L, 100L, 100L))
.confirmationCodeDayAttemptLimits(new ConfirmationCodeDayAttemptLimit(
new AttemptLimitsByLoginType(100L, 100L, 100L),
new AttemptLimitsByLoginType(100L, 100L, 100L),
new AttemptLimitsByLoginType(100L, 100L, 100L)
))
.defaultConfirmationCodeType(ConfirmationCodeEntity.Type.ONE_TIME)
.defaultIsoTwoLetterCountryCode("ru")
.generalConfirmationCode("4321")
.defaultPersonalConfirmationCode("1234")
.deviceIdDayAttemptLimits(new AuthSessionTypeAttemptLimits(
new AttemptLimitsByLoginType(500L, 500L, 500L),
new AttemptLimitsByLoginType(500L, 500L, 500L)
))
.deviceIdDayAttemptLimits(new AuthSessionTypeAttemptLimits(
new AttemptLimitsByLoginType(500L, 500L, 500L),
new AttemptLimitsByLoginType(500L, 500L, 500L)
))
.ipV4HourAttemptLimits(new AuthSessionTypeAttemptLimits(
new AttemptLimitsByLoginType(500L, 500L, 500L),
new AttemptLimitsByLoginType(500L, 500L, 500L)
))
.authSessionLoginConfirmAttemptsLimits(new AttemptLimitsByLoginType(10L, 10L, 10L))
.defaultConfirmationCodeMessageWebhookProviders(new ConfirmationCodeMessageWebhookProviders(
new ConfirmationCodeMessageWebhookProviders.Provider("", 1L, 10L),
new ConfirmationCodeMessageWebhookProviders.Provider("", 1L, 10L)
))
.defaultConfirmationCodeMessageBodies(new DefaultConfirmationCodeMessageBodies())
.passwordValidationHourAttemptLimits(new AttemptLimitsByLoginType(100L, 100L, 100L))
.build())
.getEntity()));
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy