Compare commits
3 Commits
v0.3.0-rc.
...
v0.3.0-rc.
Author | SHA1 | Date | |
---|---|---|---|
|
0499c10a2c | ||
|
13e248c71e | ||
|
d221b2c5de |
@@ -171,7 +171,10 @@ systemctl start mxisd
|
|||||||
After following the specific instructions to create a config file from the sample:
|
After following the specific instructions to create a config file from the sample:
|
||||||
1. Set the `matrix.domain` value to the domain value used in your Home Server configuration
|
1. Set the `matrix.domain` value to the domain value used in your Home Server configuration
|
||||||
2. Set an absolute location for the signing keys using `key.path`
|
2. Set an absolute location for the signing keys using `key.path`
|
||||||
3. Configure the E-mail invite sender with items starting in `invite.sender.email`
|
3. Configure the E-mail notification sender with items starting with:
|
||||||
|
- `threepid.medium.email.identity`
|
||||||
|
- `threepid.medium.email.connectors.smtp`
|
||||||
|
4. If you would like to support Phone number validation, see the [Twilio configuration](docs/threepids/msisdn/twilio-connector.md)
|
||||||
|
|
||||||
In case your IS public domain does not match your Matrix domain, see `server.name` and `server.publicUrl`
|
In case your IS public domain does not match your Matrix domain, see `server.name` and `server.publicUrl`
|
||||||
config items.
|
config items.
|
||||||
|
@@ -301,18 +301,19 @@ key.path: '/path/to/sign.key'
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#############################
|
###################################
|
||||||
# 3PID invites config items #
|
# 3PID notifications config items #
|
||||||
#############################
|
###################################
|
||||||
|
# If you would like to change the content, see https://github.com/kamax-io/mxisd/blob/master/docs/threepids/notifications/template-generator.md
|
||||||
#
|
#
|
||||||
#### E-mail invite sender
|
#### E-mail invite sender
|
||||||
#
|
#
|
||||||
# SMTP host
|
# SMTP host
|
||||||
invite.sender.email.host: "smtp.example.org"
|
threepid.medium.email.connectors.smtp.host: "smtp.example.org"
|
||||||
|
|
||||||
|
|
||||||
# SMTP port
|
# SMTP port
|
||||||
invite.sender.email.port: 587
|
threepid.medium.email.connectors.smtp.port: 587
|
||||||
|
|
||||||
|
|
||||||
# TLS mode for the connection.
|
# TLS mode for the connection.
|
||||||
@@ -322,51 +323,19 @@ invite.sender.email.port: 587
|
|||||||
# 1 Enable TLS if supported by server
|
# 1 Enable TLS if supported by server
|
||||||
# 2 Force TLS and fail if not available
|
# 2 Force TLS and fail if not available
|
||||||
#
|
#
|
||||||
#invite.sender.email.tls: 1
|
#threepid.medium.email.connectors.smtp.tls: 1
|
||||||
|
|
||||||
|
|
||||||
# Login for SMTP
|
# Login for SMTP
|
||||||
invite.sender.email.login: "matrix-identity@example.org"
|
threepid.medium.email.connectors.smtp.login: "matrix-identity@example.org"
|
||||||
|
|
||||||
|
|
||||||
# Password for the account
|
# Password for the account
|
||||||
invite.sender.email.password: "ThePassword"
|
threepid.medium.email.connectors.smtp.password: "ThePassword"
|
||||||
|
|
||||||
|
|
||||||
# The e-mail to send as. If empty, will be the same as login
|
# The e-mail to send as. If empty, will be the same as login
|
||||||
invite.sender.email.email: "matrix-identity@example.org"
|
threepid.medium.email.identity.from: "matrix-identity@example.org"
|
||||||
|
|
||||||
|
|
||||||
# The display name used in the e-mail
|
|
||||||
#
|
|
||||||
#invite.sender.email.name: "mxisd Identity Server"
|
|
||||||
|
|
||||||
|
|
||||||
# The E-mail template to use, using built-in template by default
|
|
||||||
#
|
|
||||||
# The template is expected to be a full e-mail body, including client headers, using MIME and UTF-8 encoding.
|
|
||||||
# The following headers will be set by mxisd directly and should not be present in the template:
|
|
||||||
# - From
|
|
||||||
# - To
|
|
||||||
# - Date
|
|
||||||
# - Message-Id
|
|
||||||
# - X-Mailer
|
|
||||||
#
|
|
||||||
# The following placeholders are available:
|
|
||||||
# - %DOMAIN% Domain name as per server.name config item
|
|
||||||
# - %DOMAIN_PRETTY% Word capitalize version of the domain. e.g. example.org -> Example.org
|
|
||||||
# - %FROM_EMAIL% Value of this section's email config item
|
|
||||||
# - %FROM_NAME% Value of this section's name config item
|
|
||||||
# - %SENDER_ID% Matrix ID of the invitation sender
|
|
||||||
# - %SENDER_NAME% Display name of the invitation sender, empty if not available
|
|
||||||
# - %SENDER_NAME_OR_ID% Value of %SENDER_NAME% or, if empty, value of %SENDER_ID%
|
|
||||||
# - %INVITE_MEDIUM% Medium of the invite (e.g. email, msisdn)
|
|
||||||
# - %INVITE_ADDRESS% Address used to invite
|
|
||||||
# - %ROOM_ID% ID of the room where the invitation took place
|
|
||||||
# - %ROOM_NAME% Name of the room, empty if not available
|
|
||||||
# - %ROOM_NAME_OR_ID% Value of %ROOM_NAME% or, if empty, value of %ROOM_ID%
|
|
||||||
#
|
|
||||||
#invite.sender.email.template: "/absolute/path/to/file"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
class MatrixIdentityServerApplication {
|
public class MatrixIdentityServerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(MatrixIdentityServerApplication.class, args);
|
SpringApplication.run(MatrixIdentityServerApplication.class, args);
|
||||||
|
@@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
package io.kamax.mxisd.config.threepid.connector;
|
package io.kamax.mxisd.config.threepid.connector;
|
||||||
|
|
||||||
import io.kamax.mxisd.exception.ConfigurationException;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
@@ -68,19 +66,6 @@ public class PhoneTwilioConfig {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void build() {
|
public void build() {
|
||||||
log.info("--- Phone SMS Twilio connector config ---");
|
log.info("--- Phone SMS Twilio connector config ---");
|
||||||
|
|
||||||
if (StringUtils.isBlank(getAccountSid())) {
|
|
||||||
throw new ConfigurationException(NAMESPACE + ".accountSid");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(getAuthToken())) {
|
|
||||||
throw new ConfigurationException(NAMESPACE + ".authToken");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(getNumber())) {
|
|
||||||
throw new ConfigurationException(NAMESPACE + ".number");
|
|
||||||
}
|
|
||||||
|
|
||||||
log.info("Account SID: {}", getAccountSid());
|
log.info("Account SID: {}", getAccountSid());
|
||||||
log.info("Sender number: {}", getNumber());
|
log.info("Sender number: {}", getNumber());
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,8 @@ import com.twilio.Twilio;
|
|||||||
import com.twilio.rest.api.v2010.account.Message;
|
import com.twilio.rest.api.v2010.account.Message;
|
||||||
import com.twilio.type.PhoneNumber;
|
import com.twilio.type.PhoneNumber;
|
||||||
import io.kamax.mxisd.config.threepid.connector.PhoneTwilioConfig;
|
import io.kamax.mxisd.config.threepid.connector.PhoneTwilioConfig;
|
||||||
|
import io.kamax.mxisd.exception.BadRequestException;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -51,6 +53,10 @@ public class PhoneSmsTwilioConnector implements IPhoneConnector {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void send(String recipient, String content) {
|
public void send(String recipient, String content) {
|
||||||
|
if (StringUtils.isBlank(cfg.getAccountSid()) || StringUtils.isBlank(cfg.getAuthToken()) || StringUtils.isBlank(cfg.getNumber())) {
|
||||||
|
throw new BadRequestException("Phone numbers cannot be validated at this time. Contact your administrator.");
|
||||||
|
}
|
||||||
|
|
||||||
recipient = "+" + recipient;
|
recipient = "+" + recipient;
|
||||||
log.info("Sending SMS notification from {} to {} with {} characters", cfg.getNumber(), recipient, content.length());
|
log.info("Sending SMS notification from {} to {} with {} characters", cfg.getNumber(), recipient, content.length());
|
||||||
Message.creator(new PhoneNumber("+" + recipient), new PhoneNumber(cfg.getNumber()), content).create();
|
Message.creator(new PhoneNumber("+" + recipient), new PhoneNumber(cfg.getNumber()), content).create();
|
||||||
|
Reference in New Issue
Block a user