Config handling
This commit is contained in:
@@ -53,6 +53,43 @@ lookup:
|
|||||||
- '192.168.0.0/16'
|
- '192.168.0.0/16'
|
||||||
- '::1/128'
|
- '::1/128'
|
||||||
|
|
||||||
|
# In case no binding is found, query an application server which implements the single lookup end-point
|
||||||
|
# to return bridge virtual user that would allow the user to be contacted directly by the said bridge.
|
||||||
|
#
|
||||||
|
# IMPORTANT: This bypass the regular Invite system of the Homeserver. It will be up to the Application Server
|
||||||
|
# to handle such invite. Also, if the bridged user were to actually join Matrix later, or if a 3PID binding is found
|
||||||
|
# room rights and history would not be transferred, as it would appear as a regular Matrix user to the Homeserver.
|
||||||
|
#
|
||||||
|
# This configuration is only helpful for Application Services that want to overwrite bridging for 3PID that are
|
||||||
|
# handled by the Homeserver. Do not enable unless the Application Server specifically supports it!
|
||||||
|
bridge:
|
||||||
|
|
||||||
|
# Enable unknown 3PID bridging globally
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
# Enable unknown 3PID bridging for hosts that are allowed to perform recursive lookups.
|
||||||
|
# Leaving this setting to true is highly recommended in a standard setup, unless this Identity Server
|
||||||
|
# is meant to always return a virtual user MXID even for the outside world.
|
||||||
|
recursiveOnly: true
|
||||||
|
|
||||||
|
# This mechanism can handle the following scenarios:
|
||||||
|
#
|
||||||
|
# - Single Application Server for all 3PID types: only configure the server value, comment out the rest.
|
||||||
|
#
|
||||||
|
# - Specific Application Server for some 3PID types, default server for the rest: configure the server value and
|
||||||
|
# each specific 3PID type.
|
||||||
|
#
|
||||||
|
# - Only specific 3PID types: do not configure the server value or leave it empty/blank, configure each specific
|
||||||
|
# 3PID type.
|
||||||
|
|
||||||
|
# Default application server to use for all 3PID types. Remove config item or leave empty/blank to disable.
|
||||||
|
server: ''
|
||||||
|
|
||||||
|
# Configure each 3PID type with a specific application server. Remove config item or leave empty/blank to disable.
|
||||||
|
mappings:
|
||||||
|
email: 'http://localhost:8091'
|
||||||
|
msisdn: ''
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ldap:
|
ldap:
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package io.kamax.mxisd.config
|
||||||
|
|
||||||
|
import org.slf4j.Logger
|
||||||
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.beans.factory.InitializingBean
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||||
|
import org.springframework.context.annotation.Configuration
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "lookup.recursive.bridge")
|
||||||
|
class RecursiveLookupBridgeConfig implements InitializingBean {
|
||||||
|
|
||||||
|
private Logger log = LoggerFactory.getLogger(RecursiveLookupBridgeConfig.class)
|
||||||
|
|
||||||
|
private boolean enabled
|
||||||
|
private boolean recursiveOnly
|
||||||
|
private String server
|
||||||
|
private Map<String, String> mappings
|
||||||
|
|
||||||
|
boolean getEnabled() {
|
||||||
|
return enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
void setEnabled(boolean enabled) {
|
||||||
|
this.enabled = enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean getRecursiveOnly() {
|
||||||
|
return recursiveOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRecursiveOnly(boolean recursiveOnly) {
|
||||||
|
this.recursiveOnly = recursiveOnly
|
||||||
|
}
|
||||||
|
|
||||||
|
String getServer() {
|
||||||
|
return server
|
||||||
|
}
|
||||||
|
|
||||||
|
void setServer(String server) {
|
||||||
|
this.server = server
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> getMappings() {
|
||||||
|
return mappings
|
||||||
|
}
|
||||||
|
|
||||||
|
void setMappings(Map<String, String> mappings) {
|
||||||
|
this.mappings = mappings
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
void afterPropertiesSet() throws Exception {
|
||||||
|
log.info("Enabled: {}", getEnabled())
|
||||||
|
log.info("Recursive only: {}", getRecursiveOnly())
|
||||||
|
log.info("Server: {}", getServer())
|
||||||
|
log.info("Mappings: {}", mappings.size())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ class RecursiveLookupConfig {
|
|||||||
|
|
||||||
private boolean enabled
|
private boolean enabled
|
||||||
private List<String> allowedCidr
|
private List<String> allowedCidr
|
||||||
|
private RecursiveLookupBridgeConfig bridge
|
||||||
|
|
||||||
boolean isEnabled() {
|
boolean isEnabled() {
|
||||||
return enabled
|
return enabled
|
||||||
@@ -46,4 +47,12 @@ class RecursiveLookupConfig {
|
|||||||
this.allowedCidr = allowedCidr
|
this.allowedCidr = allowedCidr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RecursiveLookupBridgeConfig getBridge() {
|
||||||
|
return bridge
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBridge(RecursiveLookupBridgeConfig bridge) {
|
||||||
|
this.bridge = bridge
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user