Integration tests for twofactor

This commit is contained in:
Petri Tuomola
2021-12-12 09:37:34 +01:00
committed by Michael Vorburger ⛑️
parent a58debcb2e
commit 5dbde0f2ed
11 changed files with 461 additions and 7 deletions
@@ -83,7 +83,7 @@ public class ExternalServicesPropertiesReadPlatformServiceImpl implements Extern
if (ExternalServicesConstants.SMTP_USERNAME.equalsIgnoreCase(name)) {
username = value;
} else if (ExternalServicesConstants.SMTP_PORT.equalsIgnoreCase(port)) {
} else if (ExternalServicesConstants.SMTP_PORT.equalsIgnoreCase(name)) {
port = value;
} else if (ExternalServicesConstants.SMTP_PASSWORD.equalsIgnoreCase(name)) {
password = value;
@@ -25,6 +25,7 @@ import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -69,7 +70,7 @@ public final class DateUtils {
public static LocalDateTime getLocalDateTimeOfTenant() {
final ZoneId zone = getDateTimeZoneOfTenant();
LocalDateTime today = LocalDateTime.now(zone);
LocalDateTime today = LocalDateTime.now(zone).truncatedTo(ChronoUnit.SECONDS);
return today;
}
@@ -128,6 +128,6 @@ public class TFAccessToken extends AbstractPersistableCustom {
}
private boolean isDateInThePast(LocalDateTime dateTime) {
return dateTime.isBefore(DateUtils.getLocalDateTimeOfTenant());
return (dateTime.isBefore(DateUtils.getLocalDateTimeOfTenant()) || dateTime.isEqual(DateUtils.getLocalDateTimeOfTenant()));
}
}
@@ -53,9 +53,9 @@ insert into c_external_service_properties (`name`, `value`, `external_service_id
insert into c_external_service_properties (`name`, `value`, `external_service_id`) values('password', 'support80', (select id from c_external_service where name = 'SMTP_Email_Account'));
insert into c_external_service_properties (`name`, `value`, `external_service_id`) values('host', 'smtp.gmail.com', (select id from c_external_service where name = 'SMTP_Email_Account'));
insert into c_external_service_properties (`name`, `value`, `external_service_id`) values('host', 'localhost', (select id from c_external_service where name = 'SMTP_Email_Account'));
insert into c_external_service_properties (`name`, `value`, `external_service_id`) values('port', '587', (select id from c_external_service where name = 'SMTP_Email_Account'));
insert into c_external_service_properties (`name`, `value`, `external_service_id`) values('port', '3025', (select id from c_external_service where name = 'SMTP_Email_Account'));
insert into c_external_service_properties (`name`, `value`, `external_service_id`) values('useTLS', 'true', (select id from c_external_service where name = 'SMTP_Email_Account'));