Package org.jivesoftware.openfire.server
Class RemoteServerManager
- java.lang.Object
-
- org.jivesoftware.openfire.server.RemoteServerManager
-
public class RemoteServerManager extends Object
Manages the connection permissions for remote servers. When a remote server is allowed to connect to this server then a special configuration for the remote server will be kept. The configuration holds information such as the port to use when creating an outgoing connection.- Author:
- Gaston Dombiak
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RemoteServerManager.PermissionPolicy
-
Field Summary
Fields Modifier and Type Field Description static SystemProperty<Boolean>
RECURSE
Defines if the permission setting for server-to-server connection applies recursively for subdomains.
-
Constructor Summary
Constructors Constructor Description RemoteServerManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
allowAccess(RemoteServerConfiguration configuration)
Allows a remote server to connect to the local server with the specified configuration.static void
blockAccess(String domain)
Blocks a remote server from connecting to the local server.static boolean
canAccess(String domain)
Returns true if the remote server with the specified domain can connect to the local server.static void
deleteConfiguration(String domain)
Removes any existing defined permission and configuration for the specified remote server.static Collection<RemoteServerConfiguration>
getAllowedServers()
Returns the list of registered remote servers that are allowed to connect to/from this server when using a whitelist policy.static Collection<RemoteServerConfiguration>
getBlockedServers()
Returns the list of remote servers that are NOT allowed to connect to/from this server.static RemoteServerConfiguration
getConfiguration(String domain)
Returns the configuration for a remote server ornull
if none was found.static RemoteServerManager.PermissionPolicy
getPermissionPolicy()
Returns the permission policy being used for new XMPP entities that are trying to connect to the server.static int
getPortForServer(String domain)
Returns the remote port to connect for the specified remote server.static int
getSocketTimeout()
Returns the number of milliseconds to wait to connect to a remote server or read data from a remote server.static void
setPermissionPolicy(String policy)
Sets the permission policy being used for new XMPP entities that are trying to connect to the server.static void
setPermissionPolicy(RemoteServerManager.PermissionPolicy policy)
Sets the permission policy being used for new XMPP entities that are trying to connect to the server.
-
-
-
Field Detail
-
RECURSE
public static final SystemProperty<Boolean> RECURSE
Defines if the permission setting for server-to-server connection applies recursively for subdomains.
-
-
Method Detail
-
allowAccess
public static void allowAccess(RemoteServerConfiguration configuration)
Allows a remote server to connect to the local server with the specified configuration.- Parameters:
configuration
- the configuration for the remote server.
-
blockAccess
public static void blockAccess(String domain)
Blocks a remote server from connecting to the local server. If the remote server was connected when the permission was revoked then the connection of the entity will be closed.- Parameters:
domain
- the domain of the remote server that is not allowed to connect.
-
canAccess
public static boolean canAccess(String domain)
Returns true if the remote server with the specified domain can connect to the local server.- Parameters:
domain
- the domain of the remote server.- Returns:
- true if the remote server with the specified domain can connect to the local server.
-
getAllowedServers
public static Collection<RemoteServerConfiguration> getAllowedServers()
Returns the list of registered remote servers that are allowed to connect to/from this server when using a whitelist policy. However, when using a blacklist policy (i.e. anyone may connect to the server) the returned list of configurations will be used for obtaining the specific connection configuration for each remote server.- Returns:
- the configuration of the registered external components.
-
getBlockedServers
public static Collection<RemoteServerConfiguration> getBlockedServers()
Returns the list of remote servers that are NOT allowed to connect to/from this server.- Returns:
- the configuration of the blocked external components.
-
getSocketTimeout
public static int getSocketTimeout()
Returns the number of milliseconds to wait to connect to a remote server or read data from a remote server. Default timeout value is 120 seconds. Configure thexmpp.server.read.timeout
global property to override the default value.- Returns:
- the number of milliseconds to wait to connect to a remote server or read data from a remote server.
-
deleteConfiguration
public static void deleteConfiguration(String domain)
Removes any existing defined permission and configuration for the specified remote server.- Parameters:
domain
- the domain of the remote server.
-
getConfiguration
public static RemoteServerConfiguration getConfiguration(String domain)
Returns the configuration for a remote server ornull
if none was found.- Parameters:
domain
- the domain of the remote server.- Returns:
- the configuration for a remote server or
null
if none was found.
-
getPortForServer
public static int getPortForServer(String domain)
Returns the remote port to connect for the specified remote server. If no port was defined then use the default port (e.g. 5269).- Parameters:
domain
- the domain of the remote server to get the remote port to connect to.- Returns:
- the remote port to connect for the specified remote server.
-
getPermissionPolicy
public static RemoteServerManager.PermissionPolicy getPermissionPolicy()
Returns the permission policy being used for new XMPP entities that are trying to connect to the server. There are two types of policies: 1) blacklist: where any entity is allowed to connect to the server except for those listed in the black list and 2) whitelist: where only the entities listed in the white list are allowed to connect to the server.- Returns:
- the permission policy being used for new XMPP entities that are trying to connect to the server.
-
setPermissionPolicy
public static void setPermissionPolicy(RemoteServerManager.PermissionPolicy policy)
Sets the permission policy being used for new XMPP entities that are trying to connect to the server. There are two types of policies: 1) blacklist: where any entity is allowed to connect to the server except for those listed in the black list and 2) whitelist: where only the entities listed in the white list are allowed to connect to the server.- Parameters:
policy
- the new PermissionPolicy to use.
-
setPermissionPolicy
public static void setPermissionPolicy(String policy)
Sets the permission policy being used for new XMPP entities that are trying to connect to the server. There are two types of policies: 1) blacklist: where any entity is allowed to connect to the server except for those listed in the black list and 2) whitelist: where only the entities listed in the white list are allowed to connect to the server.- Parameters:
policy
- the new policy to use.
-
-