working on sending mails: prerequisite mail configuration in progress
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -27,6 +27,7 @@ public class Constants {
|
||||
public static final String INVALID_REQUEST = "invalid_request";
|
||||
public static final String INVALID_REQUEST_OBJECT = "invalid_request_object";
|
||||
public static final String INVALID_SCOPE = "invalid_scope";
|
||||
public static final String MAILCONFIG = "mail_config";
|
||||
public static final String NAME = "name";
|
||||
public static final String NONCE = "nonce";
|
||||
public static final String OPENID = "openid";
|
||||
@@ -36,8 +37,14 @@ public class Constants {
|
||||
public static final String RESPONSE_TYPE = "response_type";
|
||||
public static final String SCOPE = "scope";
|
||||
public static final String SECRET = "secret";
|
||||
public static final String SENDER_ADDRESS = "sender_address";
|
||||
public static final String SMTP_AUTH = "smtp_auth";
|
||||
public static final String SMTP_HOST = "smtp_host";
|
||||
public static final String SMTP_PORT = "smtp_port";
|
||||
public static final String STATE = "state";
|
||||
public static final String START_TLS = "start_tls";
|
||||
public static final String TOKEN = "token";
|
||||
public static final String TOKEN_TYPE = "token_type";
|
||||
public static final String UNAUTHORIZED_CLIENT = "unauthorized_client";
|
||||
public static final String USER = "user";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/* © SRSoftware 2024 */
|
||||
package de.srsoftware.oidc.api;
|
||||
|
||||
import static de.srsoftware.oidc.api.Constants.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
public interface MailConfig {
|
||||
public String smtpHost();
|
||||
public MailConfig smtpHost(String newValue);
|
||||
|
||||
public int smtpPort();
|
||||
public MailConfig smtpPort(int newValue);
|
||||
|
||||
public String senderAddress();
|
||||
public MailConfig senderAddress(String newValue);
|
||||
|
||||
public String senderPassword();
|
||||
public MailConfig senderPassword(String newValue);
|
||||
|
||||
default boolean startTls() {
|
||||
return true;
|
||||
}
|
||||
MailConfig startTls(boolean newValue);
|
||||
|
||||
default boolean smtpAuth() {
|
||||
return true;
|
||||
}
|
||||
MailConfig smtpAuth(boolean newValue);
|
||||
|
||||
public default Properties props() {
|
||||
Properties props = new Properties();
|
||||
props.put("mail.smtp.host", smtpHost());
|
||||
props.put("mail.smtp.port", smtpPort());
|
||||
props.put("mail.smtp.auth", smtpAuth() ? "true" : "false");
|
||||
props.put("mail.smtp.starttls.enable", startTls() ? "true" : "false");
|
||||
return props;
|
||||
}
|
||||
|
||||
default Map<String, Object> map() {
|
||||
return Map.of( //
|
||||
SMTP_HOST, smtpHost(), //
|
||||
SMTP_PORT, smtpPort(), //
|
||||
SMTP_AUTH, smtpAuth(), //
|
||||
SENDER_ADDRESS, senderAddress(), //
|
||||
START_TLS, startTls());
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* © SRSoftware 2024 */
|
||||
package de.srsoftware.oidc.api.data;
|
||||
|
||||
public enum Permission { MANAGE_CLIENTS, MANAGE_USERS }
|
||||
public enum Permission { MANAGE_CLIENTS, MANAGE_SMTP, MANAGE_USERS }
|
||||
|
||||
Reference in New Issue
Block a user