use of io.jans.model.SmtpConfiguration in project jans by JanssenProject.
the class ApplicationFactory method getSmtpConfiguration.
@Produces
@RequestScoped
public SmtpConfiguration getSmtpConfiguration() {
GluuConfiguration configuration = configurationService.getConfiguration();
SmtpConfiguration smtpConfiguration = configuration.getSmtpConfiguration();
if (smtpConfiguration == null) {
return new SmtpConfiguration();
}
configurationService.decryptSmtpPassword(smtpConfiguration);
return smtpConfiguration;
}
use of io.jans.model.SmtpConfiguration in project jans by JanssenProject.
the class ConfigSmtpResource method removeSmtpConfiguration.
@DELETE
@ProtectedApi(scopes = { ApiAccessConstants.SMTP_DELETE_ACCESS })
public Response removeSmtpConfiguration() {
GluuConfiguration configurationUpdate = configurationService.getConfiguration();
configurationUpdate.setSmtpConfiguration(new SmtpConfiguration());
configurationService.updateConfiguration(configurationUpdate);
return Response.noContent().build();
}
use of io.jans.model.SmtpConfiguration in project jans by JanssenProject.
the class ConfigSmtpResource method getSmtpServerConfiguration.
@GET
@ProtectedApi(scopes = { ApiAccessConstants.SMTP_READ_ACCESS })
public Response getSmtpServerConfiguration() {
SmtpConfiguration smtpConfiguration = configurationService.getConfiguration().getSmtpConfiguration();
log.debug("getSmtpServerConfiguration() - smtpConfiguration = " + smtpConfiguration + "\n\n");
return Response.ok(Objects.requireNonNullElseGet(smtpConfiguration, SmtpConfiguration::new)).build();
}
use of io.jans.model.SmtpConfiguration in project jans by JanssenProject.
the class ConfigSmtpResource method testSmtpConfiguration.
@POST
@Path(ApiConstants.TEST)
@ProtectedApi(scopes = { ApiAccessConstants.SMTP_READ_ACCESS })
public Response testSmtpConfiguration() throws EncryptionException {
log.debug("\n ConfigSmtpResource::testSmtpConfiguration() - 1 - \n\n");
SmtpConfiguration smtpConfiguration = configurationService.getConfiguration().getSmtpConfiguration();
log.debug("\n ConfigSmtpResource::testSmtpConfiguration() - 1 - smtpConfiguration = " + smtpConfiguration + "\n\n");
smtpConfiguration.setPasswordDecrypted(encryptionService.decrypt(smtpConfiguration.getPassword()));
boolean status = mailService.sendMail(smtpConfiguration, smtpConfiguration.getFromEmailAddress(), smtpConfiguration.getFromName(), smtpConfiguration.getFromEmailAddress(), null, "SMTP Configuration verification", "Mail to test smtp configuration", "Mail to test smtp configuration");
log.debug("\n ConfigSmtpResource::testSmtpConfiguration() - 2 - status = " + status + "\n\n");
return Response.ok(status).build();
}
use of io.jans.model.SmtpConfiguration in project jans by JanssenProject.
the class ApplicationFactory method getSmtpConfiguration.
@Produces
@RequestScoped
public SmtpConfiguration getSmtpConfiguration() {
GluuConfiguration configuration = configurationService.getConfiguration();
SmtpConfiguration smtpConfiguration = configuration.getSmtpConfiguration();
if (smtpConfiguration == null) {
return new SmtpConfiguration();
}
configurationService.decryptSmtpPassword(smtpConfiguration);
return smtpConfiguration;
}
Aggregations