diff --git a/changelog.txt b/changelog.txt index 0002f2a68c16b11234dc3a7773c1ffb29b174e25..5a5fcc7ead828e196087d77adb16eddaee453342 100644 --- a/changelog.txt +++ b/changelog.txt @@ -15,6 +15,17 @@ eDelivery SMP 5.1 - deprecated properties: identifiersBehaviour.ParticipantIdentifierScheme.ebCoreId.concatenate: based on eDelivery SMP 2.0 no need to concatenate ebCore party id in XML responses authentication.blueCoat.enabled - deprecated and replaced with smp.automation.authentication.external.tls.clientCert.enabled + Following properties are deprecated and replaced with translation properties: + smp.alert.user.created.mail.subject + smp.alert.user.updated.mail.subject + smp.alert.accessToken.imminent_expiration.mail.subject + smp.alert.certificate.imminent_expiration.mail.subject + smp.alert.accessToken.expired.mail.subject + smp.alert.certificate.expired.mail.subject + smp.alert.user.login_failure.mail.subject + smp.alert.user.suspended.mail.subject + smp.alert.password.imminent_expiration.mail.subject + smp.alert.password.expired.mail.subject eDelivery SMP 5.0 diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/enums/SMPPropertyEnum.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/enums/SMPPropertyEnum.java index 52504a7c8494d00ffed091c6a677617b509b4c93..14c4cb560eca6cb3bfdb05194f03a1c1ca6cb779 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/enums/SMPPropertyEnum.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/config/enums/SMPPropertyEnum.java @@ -262,10 +262,6 @@ public enum SMPPropertyEnum { "LOW", "Alert level for login failure. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_USER_LOGIN_FAILURE_MAIL_SUBJECT("smp.alert.user.login_failure.mail.subject", - "Login failure", "Login failure mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_USER_SUSPENDED_ENABLED("smp.alert.user.suspended.enabled", "true", "Enable/disable the login suspended alert of the authentication module.", @@ -274,11 +270,7 @@ public enum SMPPropertyEnum { "HIGH", "Alert level for login suspended. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_USER_SUSPENDED_MAIL_SUBJECT("smp.alert.user.suspended.mail.subject", - "Login credentials suspended", "Login suspended mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), - ALERT_USER_SUSPENDED_MOMENT("smp.alert.user.suspended.mail.moment", + ALERT_USER_SUSPENDED_MOMENT("smp.alert.user.suspended.mail.moment", "WHEN_BLOCKED", "When should the account disabled alert be triggered. Values: AT_LOGON: An alert will submit mail for all logon attempts to suspended account, WHEN_BLOCKED: An alert will be triggered only the first time when the account got suspended.", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(AT_LOGON|WHEN_BLOCKED)$", "Allowed values are: AT_LOGON,WHEN_BLOCKED"), @@ -295,10 +287,6 @@ public enum SMPPropertyEnum { "LOW", "Password imminent expiration alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_PASSWORD_BEFORE_EXPIRATION_MAIL_SUBJECT("smp.alert.password.imminent_expiration.mail.subject", - "Password imminent expiration", "Password imminent expiration mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_PASSWORD_EXPIRED_ENABLED("smp.alert.password.expired.enabled", "true", "Enable/disable the password expiration alert", @@ -313,10 +301,6 @@ public enum SMPPropertyEnum { "LOW", "Password expiration alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_PASSWORD_EXPIRED_MAIL_SUBJECT("smp.alert.password.expired.mail.subject", - "Password expired", "Password expiration mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_USER_CREATED_ENABLED("smp.alert.user.created.enabled", @@ -326,10 +310,6 @@ public enum SMPPropertyEnum { "HIGH", "User creation alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_USER_CREATED_MAIL_SUBJECT("smp.alert.user.created.mail.subject", - "New DomiSMP User created", "User creation mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_USER_UPDATED_ENABLED("smp.alert.user.updated.enabled", "true", "Enable/disable the user creation alert", @@ -338,10 +318,6 @@ public enum SMPPropertyEnum { "HIGH", "User creation alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_USER_UPDATED_MAIL_SUBJECT("smp.alert.user.updated.mail.subject", - "DomiSMP User was updated by administrator", "User update mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_ACCESS_TOKEN_BEFORE_EXPIRATION_ENABLED("smp.alert.accessToken.imminent_expiration.enabled", "true", "Enable/disable the imminent accessToken expiration alert", @@ -356,10 +332,6 @@ public enum SMPPropertyEnum { "LOW", "AccessToken imminent expiration alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_ACCESS_TOKEN_BEFORE_EXPIRATION_MAIL_SUBJECT("smp.alert.accessToken.imminent_expiration.mail.subject", - "Access token imminent expiration", "accessToken imminent expiration mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_ACCESS_TOKEN_EXPIRED_ENABLED("smp.alert.accessToken.expired.enabled", "true", "Enable/disable the accessToken expiration alert", @@ -374,10 +346,6 @@ public enum SMPPropertyEnum { "LOW", "Access Token expiration alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_ACCESS_TOKEN_EXPIRED_MAIL_SUBJECT("smp.alert.accessToken.expired.mail.subject", - "Access token expired", "Password expiration mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_CERTIFICATE_BEFORE_EXPIRATION_ENABLED("smp.alert.certificate.imminent_expiration.enabled", "true", "Enable/disable the imminent certificate expiration alert", @@ -392,10 +360,6 @@ public enum SMPPropertyEnum { "LOW", "certificate imminent expiration alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_CERTIFICATE_BEFORE_EXPIRATION_MAIL_SUBJECT("smp.alert.certificate.imminent_expiration.mail.subject", - "Certificate imminent expiration", "Certificate imminent expiration mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), ALERT_CERTIFICATE_EXPIRED_ENABLED("smp.alert.certificate.expired.enabled", "true", "Enable/disable the certificate expiration alert", @@ -410,10 +374,6 @@ public enum SMPPropertyEnum { "LOW", "Certificate expiration alert level. Values: {LOW, MEDIUM, HIGH}", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, "^(LOW|MEDIUM|HIGH)$", "Allowed values are: LOW, MEDIUM, HIGH"), - ALERT_CERTIFICATE_EXPIRED_MAIL_SUBJECT("smp.alert.certificate.expired.mail.subject", - "Certificate expired", "Certificate expiration mail subject.", - OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, STRING, - "^(.{0,255})$", "Subject must have less than 256 character"), SMP_ALERT_CREDENTIALS_CRON("smp.alert.credentials.cronJobExpression", "0 52 4 */1 * *", "Property cron expression for triggering alert messages !", OPTIONAL, NOT_ENCRYPTED, NO_RESTART_NEEDED, CRON_EXPRESSION), diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBAlert.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBAlert.java index df2687ef1dfb7c4d1f80a94e9a0706bbf61ea303..1c7aef6ba7b5f4e1082dae4e5f9cfa7d4afc8292 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBAlert.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/data/model/DBAlert.java @@ -78,7 +78,6 @@ public class DBAlert extends BaseEntity { private String mailSubject; @Column(name = "MAIL_TO", length = CommonColumnsLengths.MAX_MEDIUM_TEXT_LENGTH) private String mailTo; - @Column(name = "FOR_USERNAME", length = CommonColumnsLengths.MAX_USERNAME_LENGTH) private String username; @@ -185,7 +184,7 @@ public class DBAlert extends BaseEntity { @Override public String toString() { - String sb = "DBAlert{" + "id=" + id + + return "DBAlert{" + "id=" + id + ", username=" + username + ", processedTime=" + processedTime + ", alertType=" + alertType + @@ -194,6 +193,5 @@ public class DBAlert extends BaseEntity { ", alertLevel=" + alertLevel + ", properties=" + String.join(",", properties.keySet()) + '}'; - return sb; } } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java index 1901cdedae47e9a5e43bb41d2460a87bbae55c0d..8bbb3d96de04e3b911f091a5027e22bd0411552e 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/ConfigurationService.java @@ -451,10 +451,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertUserLoginFailureSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_USER_LOGIN_FAILURE_MAIL_SUBJECT); - } - //----------------------- // user Created public Boolean getAlertUserCreatedEnabled() { @@ -466,10 +462,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertUserCreatedSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_USER_CREATED_MAIL_SUBJECT); - } - //----------------------- // user updated public Boolean getAlertUserUpdatedEnabled() { @@ -481,10 +473,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertUserUpdatedSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_USER_UPDATED_MAIL_SUBJECT); - } - //----------------------- // user suspended public Boolean getAlertUserSuspendedEnabled() { @@ -496,10 +484,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertUserSuspendedSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_USER_SUSPENDED_MAIL_SUBJECT); - } - public AlertSuspensionMomentEnum getAlertBeforeUserSuspendedAlertMoment() { String moment = configurationDAO.getCachedPropertyValue(ALERT_USER_SUSPENDED_MOMENT); return AlertSuspensionMomentEnum.valueOf(moment); @@ -524,10 +508,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertBeforeExpirePasswordMailSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_PASSWORD_BEFORE_EXPIRATION_MAIL_SUBJECT); - } - // expired passwords public Boolean getAlertExpiredPasswordEnabled() { return configurationDAO.getCachedPropertyValue(ALERT_PASSWORD_EXPIRED_ENABLED); @@ -546,10 +526,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertExpiredPasswordMailSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_PASSWORD_EXPIRED_MAIL_SUBJECT); - } - //----------------------- // before access token expire public Boolean getAlertBeforeExpireAccessTokenEnabled() { @@ -569,10 +545,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertBeforeExpireAccessTokenMailSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_ACCESS_TOKEN_BEFORE_EXPIRATION_MAIL_SUBJECT); - } - // expired access token alerts public Boolean getAlertExpiredAccessTokenEnabled() { return configurationDAO.getCachedPropertyValue(ALERT_ACCESS_TOKEN_EXPIRED_ENABLED); @@ -591,10 +563,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertExpiredAccessTokenMailSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_ACCESS_TOKEN_EXPIRED_MAIL_SUBJECT); - } - //----------------------- // before certificate expire public Boolean getAlertBeforeExpireCertificateEnabled() { @@ -614,10 +582,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertBeforeExpireCertificateMailSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_CERTIFICATE_BEFORE_EXPIRATION_MAIL_SUBJECT); - } - // expired access token alerts public Boolean getAlertExpiredCertificateEnabled() { return configurationDAO.getCachedPropertyValue(ALERT_CERTIFICATE_EXPIRED_ENABLED); @@ -636,10 +600,6 @@ public class ConfigurationService { return AlertLevelEnum.valueOf(level); } - public String getAlertExpiredCertificateMailSubject() { - return configurationDAO.getCachedPropertyValue(ALERT_CERTIFICATE_EXPIRED_MAIL_SUBJECT); - } - public String getSMPInstanceName() { return configurationDAO.getCachedPropertyValue(SMP_INSTANCE_NAME); } diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialsAlertService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialsAlertService.java index 88956c554f8704f701d8e5c9920ce86991364f36..784ceab513b328046f93d969e9cd2940dbc11cc1 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialsAlertService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/CredentialsAlertService.java @@ -103,13 +103,10 @@ public class CredentialsAlertService { String mailSubject; AlertLevelEnum alertLevel; if (credentialType == CredentialType.ACCESS_TOKEN) { - mailSubject = configurationService.getAlertBeforeExpireAccessTokenMailSubject(); alertLevel = configurationService.getAlertBeforeExpireAccessTokenLevel(); } else if (credentialType == CredentialType.USERNAME_PASSWORD) { - mailSubject = configurationService.getAlertBeforeExpirePasswordMailSubject(); alertLevel = configurationService.getAlertBeforeExpirePasswordLevel(); } else if (credentialType == CredentialType.CERTIFICATE) { - mailSubject = configurationService.getAlertBeforeExpireCertificateMailSubject(); alertLevel = configurationService.getAlertBeforeExpireCertificateLevel(); } else { LOG.warn("Alert service for credential type [{}] is not supported! Skip alerts", credentialType); @@ -117,7 +114,7 @@ public class CredentialsAlertService { } AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_IMMINENT_EXPIRATION; - + mailSubject = alertType.name() + " " +credentialType.name(); DBAlert alert = createAlert(user.getUsername(), mailSubject, mailTo, alertLevel, alertType); alertCredentialExpiration(userCredential, alert, credentialType, credentialId, expiredOn); } @@ -146,13 +143,10 @@ public class CredentialsAlertService { AlertLevelEnum alertLevel; if (credentialType == CredentialType.ACCESS_TOKEN) { - mailSubject = configurationService.getAlertExpiredAccessTokenMailSubject(); alertLevel = configurationService.getAlertExpiredAccessTokenLevel(); } else if (credentialType == CredentialType.USERNAME_PASSWORD) { - mailSubject = configurationService.getAlertExpiredPasswordMailSubject(); alertLevel = configurationService.getAlertExpiredPasswordLevel(); } else if (credentialType == CredentialType.CERTIFICATE) { - mailSubject = configurationService.getAlertExpiredCertificateMailSubject(); alertLevel = configurationService.getAlertExpiredCertificateLevel(); } else { LOG.warn("Alert service for credential type [{}] is not supported! Skip alerts", credentialType); @@ -161,6 +155,7 @@ public class CredentialsAlertService { AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_EXPIRED; + mailSubject = alertType.name() + " " +credentialType.name(); DBAlert alert = createAlert(user.getUsername(), mailSubject, mailTo, alertLevel, alertType); alertCredentialExpiration(userCredential, alert, credentialType, credentialId, expiredOn); } @@ -180,10 +175,10 @@ public class CredentialsAlertService { } String mailTo = user.getEmailAddress(); - String mailSubject = configurationService.getAlertUserLoginFailureSubject(); + AlertLevelEnum alertLevel = configurationService.getAlertUserLoginFailureLevel(); AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_VERIFICATION_FAILED; - + String mailSubject = alertType.name() + " " +credentialType.name(); Integer failureCount = credential.getSequentialLoginFailureCount(); OffsetDateTime lastFailedLoginDate = credential.getLastFailedLoginAttempt(); String credentialId = credential.getName(); @@ -211,10 +206,9 @@ public class CredentialsAlertService { } String mailTo = user.getEmailAddress(); - String mailSubject = configurationService.getAlertUserSuspendedSubject(); AlertLevelEnum alertLevel = configurationService.getAlertUserSuspendedLevel(); AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_SUSPENDED; - + String mailSubject = alertType.name() + " " +credentialType.name(); Integer failureCount = credential.getSequentialLoginFailureCount(); OffsetDateTime lastFailedLoginDate = credential.getLastFailedLoginAttempt(); OffsetDateTime suspendedUtil = lastFailedLoginDate.plusSeconds(configurationService.getAccessTokenLoginSuspensionTimeInSeconds()); @@ -312,10 +306,10 @@ public class CredentialsAlertService { return; } String mailTo = user.getEmailAddress(); - String mailSubject = configurationService.getAlertUserCreatedSubject(); + AlertLevelEnum alertLevel = configurationService.getAlertUserCreatedLevel(); AlertTypeEnum alertType = AlertTypeEnum.USER_CREATED; - + String mailSubject = alertType.name(); DBAlert alert = createAlert(user.getUsername(), mailSubject, mailTo, alertLevel, alertType); alert.addProperty(UserCreatedProperties.USERNAME.name(), user.getUsername()); @@ -341,10 +335,9 @@ public class CredentialsAlertService { return; } String mailTo = user.getEmailAddress(); - String mailSubject = configurationService.getAlertUserUpdatedSubject(); AlertLevelEnum alertLevel = configurationService.getAlertUserUpdatedLevel(); AlertTypeEnum alertType = AlertTypeEnum.USER_UPDATED; - + String mailSubject = alertType.name(); DBAlert alert = createAlert(user.getUsername(), mailSubject, mailTo, alertLevel, alertType); alert.addProperty(UserUpdatedProperties.USERNAME.name(), user.getUsername()); @@ -365,10 +358,10 @@ public class CredentialsAlertService { DBUser user = credential.getUser(); String mailTo = user.getEmailAddress(); - String mailSubject = configurationService.getAlertUserSuspendedSubject(); + AlertLevelEnum alertLevel = AlertLevelEnum.HIGH; AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_REQUEST_RESET; - + String mailSubject = alertType.name(); DBAlert alert = createAlert(user.getUsername(), mailSubject, mailTo, alertLevel, alertType); alertCredentialRequestReset(credential.getResetToken(), @@ -418,10 +411,9 @@ public class CredentialsAlertService { DBUser user = credential.getUser(); String mailTo = user.getEmailAddress(); - String mailSubject = configurationService.getAlertUserSuspendedSubject(); AlertLevelEnum alertLevel = AlertLevelEnum.HIGH; AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_CHANGED; - + String mailSubject = alertType.name(); DBAlert alert = createAlert(user.getUsername(), mailSubject, mailTo, alertLevel, alertType); alertCredentialChanged(user, alert, credential.getCredentialType(), credential.getName()); @@ -494,7 +486,11 @@ public class CredentialsAlertService { formatOffsetDateTimeWithLocal(OffsetDateTime.now(), user.getSmpLocale())); try { - mailService.sendMail(props, mailFrom, alert.getMailTo()); + String mailSubject = mailService.sendMail(props, mailFrom, alert.getMailTo()); + // update alert subject + if (mailSubject != null){ + alert.setMailSubject(StringUtils.left(mailSubject, 1023)); + } updateAlertStatus(alert, AlertStatusEnum.SUCCESS, null); } catch (Throwable exc) { LOG.error("Can not send mail [{}] for alert [{}]! Error [{}]", diff --git a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/mail/MailService.java b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/mail/MailService.java index d31bd45f4fbe825bf0055102ea26a0549a431722..54c004ca89b72fe021939890c506372c1fbc6217 100644 --- a/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/mail/MailService.java +++ b/smp-server-library/src/main/java/eu/europa/ec/edelivery/smp/services/mail/MailService.java @@ -56,7 +56,7 @@ public class MailService { } - public void sendMail(final MailDataModel model, final String from, final String to) { + public String sendMail(final MailDataModel model, final String from, final String to) { if (StringUtils.isBlank(to)) { throw new IllegalArgumentException("The 'to' property cannot be null"); } @@ -66,10 +66,11 @@ public class MailService { MimeMessage message = javaMailSender.createMimeMessage(); + String subject; try { MimeMessageHelper helper = getMimeMessageHelper(message); - String subject = mailTemplateService.getMailTitle(model); + subject = mailTemplateService.getMailTitle(model); String html = mailTemplateService.getMailHtmlContent(model); // if to contains multiple emails, split them and send as anonymously as BCC @@ -88,6 +89,7 @@ public class MailService { LOG.error("Exception while sending mail from [{}] to [{}]", from, to, e); throw new SMPRuntimeException(ErrorCode.MAIL_SUBMISSION_ERROR, e, ExceptionUtils.getRootCauseMessage(e)); } + return subject; } MimeMessageHelper getMimeMessageHelper(MimeMessage message) throws MessagingException { diff --git a/smp-server-library/src/main/resources/mail-messages/en.json b/smp-server-library/src/main/resources/mail-messages/en.json index f5ceef1334dc33d3ee2539073692e4203f06677d..2a219e4c2e94156f269d72ea54d15720814d8303 100644 --- a/smp-server-library/src/main/resources/mail-messages/en.json +++ b/smp-server-library/src/main/resources/mail-messages/en.json @@ -1,12 +1,12 @@ { - "mail.credential_changed.content" : "You're receiving this e-mail because your credential type: ${CREDENTIAL_TYPE} changed on DomiSMP ${SMP_INSTANCE_NAME}! <p>If you did not update your credential, please inform DomiSMP administrator immediately.</p><br>If you are having trouble accessing your account, reset your password. ", - "mail.credential_changed.title" : "Credential type: ${CREDENTIAL_TYPE} on DomiSMP ${SMP_INSTANCE_NAME} changed!", + "mail.credential_changed.content" : "You're receiving this e-mail because your credential type: ${CREDENTIAL_TYPE} changed on: ${SMP_INSTANCE_NAME}! <p>If you did not update your credential, please inform DomiSMP administrator immediately.</p><br>If you are having trouble accessing your account, reset your password. ", + "mail.credential_changed.title" : "Credential type: ${CREDENTIAL_TYPE} on: ${SMP_INSTANCE_NAME} changed!", "mail.credential_expired.content" : "<p><strong>Credential type:</strong> ${CREDENTIAL_TYPE}</p> <p><strong>Credential identifier:</strong> ${CREDENTIAL_ID}</p> <p><strong>Expiration date-time: </strong> ${EXPIRATION_DATETIME}</p> <p><strong>Reporting date-time:</strong> ${REPORTING_DATETIME}</p> <p><strong>Alert level:</strong> ${ALERT_LEVEL}</p> <p><strong>SMP instance name:</strong> ${SMP_INSTANCE_NAME}</p>.", "mail.credential_expired.title" : "Credential type: ${CREDENTIAL_TYPE} is expired", "mail.credential_imminent_expiration.content" : "<p><strong>Credential type:</strong> ${CREDENTIAL_TYPE}</p><p><strong>Credential identifier:</strong> ${CREDENTIAL_ID}</p><p><strong>Expiration date-time: </strong> ${EXPIRATION_DATETIME}</p><p><strong>Reporting date-time:</strong> ${REPORTING_DATETIME}</p><p><strong>Alert level:</strong> ${ALERT_LEVEL}</p><p><strong>SMP instance name:</strong> ${SMP_INSTANCE_NAME}</p>", "mail.credential_imminent_expiration.title" : "Credential type: ${CREDENTIAL_TYPE} imminent expiration", - "mail.credential_request_reset.content" : "You're receiving this e-mail because you requested a credential type: ${CREDENTIAL_TYPE} reset on DomiSMP ${SMP_INSTANCE_NAME} for your user account. <br/> Please go to the following page and choose a new password: <br/> <br/> <a href=\"${RESET_URL}\">${RESET_URL}</a> <br/> <br/> The link is valid for a short period of time. If the link has expired, please request a new one.", - "mail.credential_request_reset.title" : "Request for reset of the Credential type: ${CREDENTIAL_TYPE} on DomiSMP ${SMP_INSTANCE_NAME}", + "mail.credential_request_reset.content" : "You're receiving this e-mail because you requested a credential type: ${CREDENTIAL_TYPE} reset on: ${SMP_INSTANCE_NAME} for your user account. <br/> Please go to the following page and choose a new password: <br/> <br/> <a href=\"${RESET_URL}\">${RESET_URL}</a> <br/> <br/> The link is valid for a short period of time. If the link has expired, please request a new one.", + "mail.credential_request_reset.title" : "Request for reset of the Credential type: ${CREDENTIAL_TYPE} on: ${SMP_INSTANCE_NAME}", "mail.credential_suspended.content" : "<p><strong>Credential type:</strong> ${CREDENTIAL_TYPE}</p> <p><strong>Credential identifier:</strong> ${CREDENTIAL_ID}</p> <p><strong>Failed login attempt count:</strong> ${FAILED_LOGIN_ATTEMPT}</p> <p><strong>Last failed login time:</strong> ${LAST_LOGIN_FAILURE_DATETIME}</p> <p><strong>Suspended util</strong> ${SUSPENDED_UNTIL_DATETIME}</p> <p><strong>Reporting time:</strong> ${REPORTING_DATETIME}</p> <p><strong>Alert level:</strong> ${ALERT_LEVEL}</p> <p><strong>SMP instance name:</strong> ${SMP_INSTANCE_NAME}</p>", "mail.credential_suspended.title" : "Credential type: ${CREDENTIAL_TYPE} is temporarily suspended", "mail.credential_verification_failed.content" : "<p><strong>Credential type:</strong> ${CREDENTIAL_TYPE}</p> <p><strong>Credential identifier:</strong> ${CREDENTIAL_ID}</p> <p><strong>Failed login attempt count:</strong> ${FAILED_LOGIN_ATTEMPT}</p> <p><strong>Last failed login time:</strong> ${LAST_LOGIN_FAILURE_DATETIME}</p> <p><strong>Reporting time:</strong> ${REPORTING_DATETIME}</p> <p><strong>Alert level:</strong> ${ALERT_LEVEL}</p> <p><strong>SMP instance name:</strong> ${SMP_INSTANCE_NAME}</p>", @@ -14,9 +14,9 @@ "mail.footer" : "DomiSMP instance: ${SMP_INSTANCE_NAME} (${SERVER_NAME}), ${CURRENT_DATETIME}", "mail.header" : "eDelivery DomiSMP sample: ${SMP_INSTANCE_NAME}", "mail.test_mail.content" : "This is a test mail from DomiSMP instance: ${SMP_INSTANCE_NAME} for your user account.", - "mail.test_mail.title" : "Test mail: ${CREDENTIAL_TYPE} on DomiSMP ${SMP_INSTANCE_NAME}", + "mail.test_mail.title" : "Test mail: ${CREDENTIAL_TYPE} on: ${SMP_INSTANCE_NAME}", "mail.user_created.content" : "You're receiving this e-mail because new user was created with :<br/><b>Username:</b>${USERNAME}<br /> <b>Name:</b>${FULL_NAME}<br /> <b>Email Address:</b>${EMAIL}<br /><b>Activated:</b>${ACTIVATED}<br /> Note: If user account is not yet activated please wait for activation mail, before first login. <br/>If you did not request this account, please inform DomiSMP administrator immediately.", - "mail.user_created.title" : "New user created on DomiSMP ${SMP_INSTANCE_NAME}", + "mail.user_created.title" : "New user created on: ${SMP_INSTANCE_NAME}", "mail.user_updated.content" : "You're receiving this e-mail because user was updated with :<br/><b>Username:</b>${USERNAME}<br /> <b>Name:</b>${FULL_NAME}<br /> <b>Email Address:</b>${EMAIL}<br /><b>Activated:</b>${ACTIVATED}<br /><br/>If you did not request update account, please inform DomiSMP administrator immediately.", - "mail.user_updated.title" : "User update on DomiSMP ${SMP_INSTANCE_NAME}" -} \ No newline at end of file + "mail.user_updated.title" : "User update on: ${SMP_INSTANCE_NAME}" +} diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/AlertServiceTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/AlertServiceTest.java index 394235222ed07eda93ace1be5f54ffd684897df1..e0c5b109d8efc271cbfbcaf4e7cd2e81dc44953a 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/AlertServiceTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/AlertServiceTest.java @@ -108,7 +108,6 @@ class AlertServiceTest { String mailFrom = "mail.from@test.eu"; AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; - doReturn(mailSubject).when(configurationService).getAlertBeforeExpirePasswordMailSubject(); doReturn(alertLevel).when(configurationService).getAlertBeforeExpirePasswordLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); @@ -121,7 +120,6 @@ class AlertServiceTest { assertAlertSend(alertType, user.getEmailAddress(), mailFrom, mailSubject, expectedTemplateProperties); - verify(configurationService, times(1)).getAlertBeforeExpirePasswordMailSubject(); verify(configurationService, times(1)).getAlertBeforeExpirePasswordLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -135,8 +133,6 @@ class AlertServiceTest { AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; DBCredential credential = TestDBUtils.createDBCredentialForUser(user, null, OffsetDateTime.now().plusDays(-1), null); - - doReturn(mailSubject).when(configurationService).getAlertExpiredPasswordMailSubject(); doReturn(alertLevel).when(configurationService).getAlertExpiredPasswordLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_EXPIRED; @@ -148,7 +144,6 @@ class AlertServiceTest { assertAlertSend(alertType, user.getEmailAddress(), mailFrom, mailSubject, expectedTemplateProperties); - verify(configurationService, times(1)).getAlertExpiredPasswordMailSubject(); verify(configurationService, times(1)).getAlertExpiredPasswordLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -162,7 +157,6 @@ class AlertServiceTest { String mailSubject = "mail subject"; String mailFrom = "mail.from@test.eu"; AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; - doReturn(mailSubject).when(configurationService).getAlertBeforeExpireAccessTokenMailSubject(); doReturn(alertLevel).when(configurationService).getAlertBeforeExpireAccessTokenLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); @@ -175,7 +169,6 @@ class AlertServiceTest { assertAlertSend(alertType, user.getEmailAddress(), mailFrom, mailSubject, expectedTemplateProperties); - verify(configurationService, times(1)).getAlertBeforeExpireAccessTokenMailSubject(); verify(configurationService, times(1)).getAlertBeforeExpireAccessTokenLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -189,7 +182,6 @@ class AlertServiceTest { String mailSubject = "mail subject"; String mailFrom = "mail.from@test.eu"; AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; - doReturn(mailSubject).when(configurationService).getAlertExpiredAccessTokenMailSubject(); doReturn(alertLevel).when(configurationService).getAlertExpiredAccessTokenLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_EXPIRED; @@ -201,7 +193,6 @@ class AlertServiceTest { assertAlertSend(alertType, user.getEmailAddress(), mailFrom, mailSubject, expectedTemplateProperties); - verify(configurationService, times(1)).getAlertExpiredAccessTokenMailSubject(); verify(configurationService, times(1)).getAlertExpiredAccessTokenLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -214,7 +205,6 @@ class AlertServiceTest { String mailSubject = "mail subject"; String mailFrom = "mail.from@test.eu"; AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; - doReturn(mailSubject).when(configurationService).getAlertBeforeExpireCertificateMailSubject(); doReturn(alertLevel).when(configurationService).getAlertBeforeExpireCertificateLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_IMMINENT_EXPIRATION; @@ -226,7 +216,6 @@ class AlertServiceTest { assertAlertSend(alertType, user.getEmailAddress(), mailFrom, mailSubject, expectedTemplateProperties); - verify(configurationService, times(1)).getAlertBeforeExpireCertificateMailSubject(); verify(configurationService, times(1)).getAlertBeforeExpireCertificateLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -239,7 +228,6 @@ class AlertServiceTest { String mailSubject = "mail subject"; String mailFrom = "mail.from@test.eu"; AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; - doReturn(mailSubject).when(configurationService).getAlertExpiredCertificateMailSubject(); doReturn(alertLevel).when(configurationService).getAlertExpiredCertificateLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); AlertTypeEnum alertType = AlertTypeEnum.CREDENTIAL_EXPIRED; @@ -252,7 +240,6 @@ class AlertServiceTest { assertAlertSend(alertType, user.getEmailAddress(), mailFrom, mailSubject, expectedTemplateProperties); - verify(configurationService, times(1)).getAlertExpiredCertificateMailSubject(); verify(configurationService, times(1)).getAlertExpiredCertificateLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -303,7 +290,6 @@ class AlertServiceTest { AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; doReturn(true).when(configurationService).getAlertUserLoginFailureEnabled(); - doReturn(mailSubject).when(configurationService).getAlertUserLoginFailureSubject(); doReturn(alertLevel).when(configurationService).getAlertUserLoginFailureLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); @@ -318,7 +304,6 @@ class AlertServiceTest { expectedTemplateProperties); verify(configurationService, times(1)).getAlertUserLoginFailureEnabled(); - verify(configurationService, times(1)).getAlertUserLoginFailureSubject(); verify(configurationService, times(1)).getAlertUserLoginFailureLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -335,7 +320,6 @@ class AlertServiceTest { AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; doReturn(true).when(configurationService).getAlertUserLoginFailureEnabled(); - doReturn(mailSubject).when(configurationService).getAlertUserLoginFailureSubject(); doReturn(alertLevel).when(configurationService).getAlertUserLoginFailureLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); //doReturn(123456).when(configurationService).getLoginSuspensionTimeInSeconds(); @@ -350,7 +334,6 @@ class AlertServiceTest { expectedTemplateProperties); verify(configurationService, times(1)).getAlertUserLoginFailureEnabled(); - verify(configurationService, times(1)).getAlertUserLoginFailureSubject(); verify(configurationService, times(1)).getAlertUserLoginFailureLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -367,7 +350,6 @@ class AlertServiceTest { AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; doReturn(true).when(configurationService).getAlertUserSuspendedEnabled(); - doReturn(mailSubject).when(configurationService).getAlertUserSuspendedSubject(); doReturn(alertLevel).when(configurationService).getAlertUserSuspendedLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); doReturn(123456).when(configurationService).getLoginSuspensionTimeInSeconds(); @@ -382,7 +364,6 @@ class AlertServiceTest { expectedTemplateProperties); verify(configurationService, times(1)).getAlertUserSuspendedEnabled(); - verify(configurationService, times(1)).getAlertUserSuspendedSubject(); verify(configurationService, times(1)).getAlertUserSuspendedLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } @@ -400,7 +381,6 @@ class AlertServiceTest { AlertLevelEnum alertLevel = AlertLevelEnum.MEDIUM; doReturn(true).when(configurationService).getAlertUserSuspendedEnabled(); - doReturn(mailSubject).when(configurationService).getAlertUserSuspendedSubject(); doReturn(alertLevel).when(configurationService).getAlertUserSuspendedLevel(); doReturn(mailFrom).when(configurationService).getAlertEmailFrom(); doReturn(123456).when(configurationService).getLoginSuspensionTimeInSeconds(); @@ -415,7 +395,6 @@ class AlertServiceTest { expectedTemplateProperties); verify(configurationService, times(1)).getAlertUserSuspendedEnabled(); - verify(configurationService, times(1)).getAlertUserSuspendedSubject(); verify(configurationService, times(1)).getAlertUserSuspendedLevel(); verify(configurationService, times(1)).getAlertEmailFrom(); } diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java index 0ad40941d6089c13703e1239e8d2a4daf4878664..8ab49622e55546f79b9a26d3aa232d9b6bb72190 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/services/ConfigurationServiceAllGetMethodsTest.java @@ -129,33 +129,26 @@ public class ConfigurationServiceAllGetMethodsTest { {SSO_CAS_SMP_LOGIN_URI, TEST_STRING, "getCasSMPLoginRelativePath", true}, {ALERT_USER_LOGIN_FAILURE_ENABLED, Boolean.FALSE, "getAlertUserLoginFailureEnabled", true}, {ALERT_USER_SUSPENDED_ENABLED, Boolean.FALSE, "getAlertUserSuspendedEnabled", true}, - {ALERT_USER_SUSPENDED_MAIL_SUBJECT, TEST_STRING, "getAlertUserSuspendedSubject", true}, {ALERT_PASSWORD_BEFORE_EXPIRATION_ENABLED, Boolean.FALSE, "getAlertBeforeExpirePasswordEnabled", true}, {ALERT_PASSWORD_BEFORE_EXPIRATION_PERIOD, 10, "getAlertBeforeExpirePasswordPeriod", true}, {ALERT_PASSWORD_BEFORE_EXPIRATION_INTERVAL, 10, "getAlertBeforeExpirePasswordInterval", true}, - {ALERT_PASSWORD_BEFORE_EXPIRATION_MAIL_SUBJECT, TEST_STRING, "getAlertBeforeExpirePasswordMailSubject", true}, {ALERT_PASSWORD_EXPIRED_ENABLED, Boolean.FALSE, "getAlertExpiredPasswordEnabled", true}, {ALERT_PASSWORD_EXPIRED_PERIOD, 10, "getAlertExpiredPasswordPeriod", true}, {ALERT_PASSWORD_EXPIRED_INTERVAL, 10, "getAlertExpiredPasswordInterval", true}, - {ALERT_PASSWORD_EXPIRED_MAIL_SUBJECT, TEST_STRING, "getAlertExpiredPasswordMailSubject", true}, {ALERT_ACCESS_TOKEN_BEFORE_EXPIRATION_ENABLED, Boolean.FALSE, "getAlertBeforeExpireAccessTokenEnabled", true}, {ALERT_ACCESS_TOKEN_BEFORE_EXPIRATION_PERIOD, 10, "getAlertBeforeExpireAccessTokenPeriod", true}, {ALERT_ACCESS_TOKEN_BEFORE_EXPIRATION_INTERVAL, 10, "getAlertBeforeExpireAccessTokenInterval", true}, - {ALERT_ACCESS_TOKEN_BEFORE_EXPIRATION_MAIL_SUBJECT, TEST_STRING, "getAlertBeforeExpireAccessTokenMailSubject", true}, {ALERT_ACCESS_TOKEN_EXPIRED_ENABLED, Boolean.FALSE, "getAlertExpiredAccessTokenEnabled", true}, {ALERT_ACCESS_TOKEN_EXPIRED_PERIOD, 10, "getAlertExpiredAccessTokenPeriod", true}, {ALERT_ACCESS_TOKEN_EXPIRED_INTERVAL, 10, "getAlertExpiredAccessTokenInterval", true}, - {ALERT_ACCESS_TOKEN_EXPIRED_MAIL_SUBJECT, TEST_STRING, "getAlertExpiredAccessTokenMailSubject", true}, {ALERT_CERTIFICATE_BEFORE_EXPIRATION_ENABLED, Boolean.FALSE, "getAlertBeforeExpireCertificateEnabled", true}, {ALERT_CERTIFICATE_BEFORE_EXPIRATION_PERIOD, 10, "getAlertBeforeExpireCertificatePeriod", true}, {ALERT_CERTIFICATE_BEFORE_EXPIRATION_INTERVAL, 10, "getAlertBeforeExpireCertificateInterval", true}, - {ALERT_CERTIFICATE_BEFORE_EXPIRATION_MAIL_SUBJECT, TEST_STRING, "getAlertBeforeExpireCertificateMailSubject", true}, {ALERT_CERTIFICATE_EXPIRED_ENABLED, Boolean.FALSE, "getAlertExpiredCertificateEnabled", true}, {ALERT_CERTIFICATE_EXPIRED_PERIOD, 10, "getAlertExpiredCertificatePeriod", true}, {ALERT_CERTIFICATE_EXPIRED_INTERVAL, 10, "getAlertExpiredCertificateInterval", true}, - {ALERT_CERTIFICATE_EXPIRED_MAIL_SUBJECT, TEST_STRING, "getAlertExpiredCertificateMailSubject", true}, {SMP_ALERT_BATCH_SIZE, 10, "getAlertCredentialsBatchSize", true}, {SMP_ALERT_MAIL_FROM, TEST_STRING, "getAlertEmailFrom", true}, diff --git a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/utils/PropertyUtilsTest.java b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/utils/PropertyUtilsTest.java index 8a8a70a2346e5e1e1ab1e7210e0ae275b81ebbad..a203b546c34fc9f996cb5223af066e1f6c67704f 100644 --- a/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/utils/PropertyUtilsTest.java +++ b/smp-server-library/src/test/java/eu/europa/ec/edelivery/smp/utils/PropertyUtilsTest.java @@ -137,15 +137,6 @@ public class PropertyUtilsTest { } } - @Test - void testSubjectRegExpLength() { - SMPRuntimeException result = assertThrows(SMPRuntimeException.class, () -> - PropertyUtils.isValidProperty(ALERT_USER_LOGIN_FAILURE_MAIL_SUBJECT, - "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", ROOT_FOLDER)); - - assertEquals("Configuration error: [Subject must have less than 256 character]!", result.getMessage()); - } - @Test void testSubjectRegExpValue() {