Class ConfigSmtpResource
- java.lang.Object
-
- io.jans.configapi.core.rest.BaseResource
-
- io.jans.configapi.rest.resource.auth.ConfigBaseResource
-
- io.jans.configapi.rest.resource.auth.ConfigSmtpResource
-
@Path("/config/smtp") @Produces("application/json") @Consumes("application/json") public class ConfigSmtpResource extends ConfigBaseResource- Author:
- Mougang T.Gasmyr
-
-
Constructor Summary
Constructors Constructor Description ConfigSmtpResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description jakarta.ws.rs.core.ResponsegetSmtpServerConfiguration()Retrieve the current SMTP server configuration.jakarta.ws.rs.core.ResponseremoveSmtpConfiguration()Removes the stored SMTP server configuration and persists the change.jakarta.ws.rs.core.ResponsesetupSmtpConfiguration(@Valid io.jans.model.SmtpConfiguration smtpConfiguration)Create and persist an SMTP server configuration.jakarta.ws.rs.core.ResponsetestSmtpConfiguration(@Valid io.jans.model.SmtpTest smtpTest)Sends a test SMTP message using the current SMTP configuration, optionally signed.jakarta.ws.rs.core.ResponseupdateSmtpConfiguration(@Valid io.jans.model.SmtpConfiguration smtpConfiguration)Replace the stored SMTP configuration with the provided settings and return the saved configuration.-
Methods inherited from class io.jans.configapi.rest.resource.auth.ConfigBaseResource
getMaxCount
-
Methods inherited from class io.jans.configapi.core.rest.BaseResource
checkNotEmpty, checkNotEmpty, checkNotNull, checkNotNull, checkNotNull, checkResourceNotNull, createSearchRequest, findRootError, getBadRequestException, getBadRequestException, getBadRequestException, getHttpHeaders, getHttpRequest, getInternalServerException, getInternalServerException, getMissingAttributeError, getNotAcceptableException, getNotFoundError, getNotFoundError, getUriInfo, throwBadRequestException, throwBadRequestException, throwBadRequestException, throwInternalServerException, throwInternalServerException, throwInternalServerException, throwInternalServerException, throwMissingAttributeError, throwNotFoundException, throwNotFoundException
-
-
-
-
Method Detail
-
getSmtpServerConfiguration
@GET public jakarta.ws.rs.core.Response getSmtpServerConfiguration() throws io.jans.util.security.StringEncrypter.EncryptionExceptionRetrieve the current SMTP server configuration. The returned configuration has sensitive password fields decrypted for consumer use.- Returns:
- the current SmtpConfiguration with decrypted password fields
- Throws:
io.jans.util.security.StringEncrypter.EncryptionException- if decryption of stored password values fails
-
setupSmtpConfiguration
@POST public jakarta.ws.rs.core.Response setupSmtpConfiguration(@Valid @Valid io.jans.model.SmtpConfiguration smtpConfiguration) throws io.jans.util.security.StringEncrypter.EncryptionExceptionCreate and persist an SMTP server configuration. Encrypts sensitive fields of the provided configuration for storage, saves it to the global configuration, then returns the stored SmtpConfiguration with decrypted password fields populated for client consumption.- Parameters:
smtpConfiguration- the SMTP configuration payload to store; sensitive password fields will be encrypted before persistence- Returns:
- the created SmtpConfiguration as stored (with decrypted password fields populated)
- Throws:
io.jans.util.security.StringEncrypter.EncryptionException- if an error occurs while encrypting or decrypting sensitive fields
-
updateSmtpConfiguration
@PUT public jakarta.ws.rs.core.Response updateSmtpConfiguration(@Valid @Valid io.jans.model.SmtpConfiguration smtpConfiguration) throws io.jans.util.security.StringEncrypter.EncryptionExceptionReplace the stored SMTP configuration with the provided settings and return the saved configuration.- Parameters:
smtpConfiguration- the new SMTP settings to persist; sensitive password fields will be encrypted before storage- Returns:
- the HTTP response containing the updated SmtpConfiguration
- Throws:
io.jans.util.security.StringEncrypter.EncryptionException- if encryption or decryption of SMTP password fields fails during processing
-
testSmtpConfiguration
@POST @Path("/test") public jakarta.ws.rs.core.Response testSmtpConfiguration(@Valid @Valid io.jans.model.SmtpTest smtpTest) throws io.jans.util.security.StringEncrypter.EncryptionExceptionSends a test SMTP message using the current SMTP configuration, optionally signed. Decrypts stored SMTP password fields as needed and attempts to send either a signed or unsigned message according to the `sign` flag on the request.- Parameters:
smtpTest- contains the test message payload and flags (subject, message, and `sign`)- Returns:
- `true` if the test email was sent successfully, `false` otherwise.
- Throws:
io.jans.util.security.StringEncrypter.EncryptionException- if decryption of stored SMTP password fields fails.
-
removeSmtpConfiguration
@DELETE public jakarta.ws.rs.core.Response removeSmtpConfiguration()
Removes the stored SMTP server configuration and persists the change.- Returns:
- HTTP 204 No Content response indicating the SMTP configuration was removed
-
-