use of org.gluu.model.SmtpConfiguration in project oxAuth by GluuFederation.
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 org.gluu.model.SmtpConfiguration in project oxTrust by GluuFederation.
the class UpdateOrganizationAction method modifyApplliance.
private String modifyApplliance() {
if (this.configuration != null) {
return OxTrustConstants.RESULT_SUCCESS;
}
try {
this.configuration = configurationService.getConfiguration();
if (this.configuration == null) {
return OxTrustConstants.RESULT_FAILURE;
}
this.smtpConfiguration = this.configuration.getSmtpConfiguration();
if (this.smtpConfiguration == null) {
this.smtpConfiguration = new SmtpConfiguration();
this.configuration.setSmtpConfiguration(smtpConfiguration);
}
configurationService.decryptSmtpPassword(smtpConfiguration);
return OxTrustConstants.RESULT_SUCCESS;
} catch (Exception ex) {
log.error("an error occured", ex);
return OxTrustConstants.RESULT_FAILURE;
}
}
use of org.gluu.model.SmtpConfiguration in project oxTrust by GluuFederation.
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 org.gluu.model.SmtpConfiguration in project oxTrust by GluuFederation.
the class SmtpConfigurationWebResource method testSmtpConfiguration.
@GET
@Path(ApiConstants.TEST)
@Operation(summary = "Test smtp configuration", description = "Test smtp configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = SmtpConfiguration.class)), description = Constants.RESULT_SUCCESS), @ApiResponse(responseCode = "500", description = "Server error") })
@ProtectedApi(scopes = { READ_ACCESS })
public Response testSmtpConfiguration() {
try {
SmtpConfiguration smtpConfiguration = configurationService.getConfiguration().getSmtpConfiguration();
String password = encryptionService.decrypt(smtpConfiguration.getPassword());
smtpConfiguration.setPasswordDecrypted(password);
boolean result = mailService.sendMail(smtpConfiguration, smtpConfiguration.getFromEmailAddress(), smtpConfiguration.getFromName(), smtpConfiguration.getFromEmailAddress(), null, "SMTP Configuration verification", "Mail to test smtp configuration", "Mail to test smtp configuration");
return Response.ok(result ? true : false).build();
} catch (Exception e) {
log(logger, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
use of org.gluu.model.SmtpConfiguration in project oxTrust by GluuFederation.
the class PasswordReminderAction method enabled.
public boolean enabled() {
GluuConfiguration configuration = configurationService.getConfiguration();
SmtpConfiguration smtpConfiguration = configuration.getSmtpConfiguration();
boolean valid = smtpConfiguration != null && smtpConfiguration.isValid() && configurationService.getConfiguration().isPasswordResetAllowed();
if (valid) {
passwordResetIsEnable = true;
if (recaptchaService.isEnabled() && getAuthenticationRecaptchaEnabled()) {
valid = recaptchaService.verifyRecaptchaResponse();
if (!valid) {
facesMessages.add(FacesMessage.SEVERITY_ERROR, facesMessages.evalResourceAsString("#{msgs['person.passwordreset.catch.checkInputAndCaptcha']}"));
}
}
} else {
facesMessages.add(FacesMessage.SEVERITY_ERROR, facesMessages.evalResourceAsString("#{msgs['person.passwordreset.notActivate']}"));
}
return valid;
}
Aggregations