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 classRemoteServerManager.PermissionPolicy
-
Constructor Summary
Constructors Constructor Description RemoteServerManager()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidallowAccess(RemoteServerConfiguration configuration)Allows a remote server to connect to the local server with the specified configuration.static voidblockAccess(String domain)Blocks a remote server from connecting to the local server.static booleancanAccess(String domain)Returns true if the remote server with the specified domain can connect to the local server.static voiddeleteConfiguration(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 RemoteServerConfigurationgetConfiguration(String domain)Returns the configuration for a remote server ornullif none was found.static RemoteServerManager.PermissionPolicygetPermissionPolicy()Returns the permission policy being used for new XMPP entities that are trying to connect to the server.static intgetPortForServer(String domain)Returns the remote port to connect for the specified remote server.static intgetSocketTimeout()Returns the number of milliseconds to wait to connect to a remote server or read data from a remote server.static voidsetPermissionPolicy(String policy)Sets the permission policy being used for new XMPP entities that are trying to connect to the server.static voidsetPermissionPolicy(RemoteServerManager.PermissionPolicy policy)Sets the permission policy being used for new XMPP entities that are trying to connect to the server.
-
-
-
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.timeoutglobal 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 ornullif none was found.- Parameters:
domain- the domain of the remote server.- Returns:
- the configuration for a remote server or
nullif 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.
-
-