Commit f0220381 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gaston

Initial version.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1540 b35dd754-fafc-0310-a699-88a17e54d16e
parent 12f7f546
package org.jivesoftware.messenger.component;
/**
* Holds the configuration for external components that want to connect to this server. The
* configuration specifies if the external component is allowed to connect to the server as well
* as the shared secret between the server and the component. If no secret or configuration was
* defined then the default shared secret will be used.
*
* @author Gaston Dombiak
*/
public class ExternalComponentConfiguration {
private String subdomain;
private Permission permission;
private String secret;
public ExternalComponentConfiguration(String subdomain) {
this.subdomain = subdomain;
}
public String getSubdomain() {
return subdomain;
}
public Permission getPermission() {
return permission;
}
public void setPermission(Permission permission) {
this.permission = permission;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public enum Permission {
/**
* The XMPP entity is allowed to connect to the server.
*/
allowed,
/**
* The XMPP entity is NOT allowed to connect to the server.
*/
blocked;
}
}
package org.jivesoftware.messenger.component;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.messenger.Session;
import org.jivesoftware.messenger.SessionManager;
import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.messenger.component.ExternalComponentConfiguration.Permission;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
/**
* Manages the connection permissions for external components. When an external component is
* allowed to connect to this server then a special configuration for the component will be kept.
* The configuration holds information such as the shared secret that the component should use
* when authenticating with the server.
*
* @author Gaston Dombiak
*/
public class ExternalComponentManager {
private static final String ADD_CONFIGURATION =
"INSERT INTO jiveExtComponentConf (subdomain,secret,permission) VALUES (?,?,?)";
private static final String DELETE_CONFIGURATION =
"DELETE FROM jiveExtComponentConf WHERE subdomain=?";
private static final String LOAD_CONFIGURATION =
"SELECT secret,permission FROM jiveExtComponentConf where subdomain=?";
private static final String LOAD_CONFIGURATIONS =
"SELECT subdomain,secret FROM jiveExtComponentConf where permission=?";
/**
* Allows an external component to connect to the local server with the specified configuration.
*
* @param configuration the configuration for the external component.
*/
public static void allowAccess(ExternalComponentConfiguration configuration) {
// Remove any previous configuration for this external component
deleteConfiguration(configuration.getSubdomain());
// Update the database with the new granted permission and configuration
configuration.setPermission(Permission.allowed);
addConfiguration(configuration);
}
/**
* Blocks an external component from connecting to the local server. If the component was
* connected when the permission was revoked then the connection of the entity will be closed.
*
* @param subdomain the subdomain of the external component that is not allowed to connect.
*/
public static void blockAccess(String subdomain) {
// Remove any previous configuration for this external component
deleteConfiguration(subdomain);
// Update the database with the new revoked permission
ExternalComponentConfiguration config = new ExternalComponentConfiguration(subdomain);
config.setPermission(Permission.blocked);
addConfiguration(config);
// Check if the component was connected and proceed to close the connection
String domain = subdomain + "." + XMPPServer.getInstance().getServerInfo().getName();
Session session = SessionManager.getInstance().getComponentSession(domain);
if (session != null) {
session.getConnection().close();
}
}
/**
* Returns true if the external component with the specified subdomain can connect to the
* local server.
*
* @param subdomain the subdomain of the external component.
* @return true if the external component with the specified subdomain can connect to the
* local server.
*/
public static boolean canAccess(String subdomain) {
// By default there is no permission defined for the XMPP entity
Permission permission = null;
ExternalComponentConfiguration config = getConfiguration(subdomain);
if (config != null) {
permission = config.getPermission();
}
if (PermissionPolicy.blacklist == getPermissionPolicy()) {
// Anyone can access except those entities listed in the blacklist
if (Permission.blocked == permission) {
return false;
}
else {
return true;
}
}
else {
// Access is limited to those present in the whitelist
if (Permission.allowed == permission) {
return true;
}
else {
return false;
}
}
}
/**
* Returns the list of registered external components that are allowed to connect to 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 shared secret specific for each component.
*
* @return the configuration of the registered external components.
*/
public static Collection<ExternalComponentConfiguration> getAllowedComponents() {
return getConfigurations(Permission.allowed);
}
/**
* Returns the list of external components that are NOT allowed to connect to this
* server.
*
* @return the configuration of the blocked external components.
*/
public static Collection<ExternalComponentConfiguration> getBlockedComponents() {
return getConfigurations(Permission.blocked);
}
/**
* Removes any existing defined permission and configuration for the specified
* external component.
*
* @param subdomain the subdomain of the external component.
*/
public static void deleteConfiguration(String subdomain) {
// Remove the permission for the entity from the database
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(DELETE_CONFIGURATION);
pstmt.setString(1, subdomain);
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
}
/**
* Adds a new permission for the specified external component.
*/
private static void addConfiguration(ExternalComponentConfiguration configuration) {
// Remove the permission for the entity from the database
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(ADD_CONFIGURATION);
pstmt.setString(1, configuration.getSubdomain());
pstmt.setString(2, configuration.getSecret());
pstmt.setString(3, configuration.getPermission().toString());
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
}
/**
* Returns the configuration for an external component.
*
* @param subdomain the subdomain of the external component.
* @return the configuration for an external component.
*/
public static ExternalComponentConfiguration getConfiguration(String subdomain) {
ExternalComponentConfiguration configuration = null;
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_CONFIGURATION);
pstmt.setString(1, subdomain);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
configuration = new ExternalComponentConfiguration(subdomain);
configuration.setSecret(rs.getString(1));
configuration.setPermission(Permission.valueOf(rs.getString(2)));
}
rs.close();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
return configuration;
}
private static Collection<ExternalComponentConfiguration> getConfigurations(
Permission permission) {
Collection<ExternalComponentConfiguration> answer =
new ArrayList<ExternalComponentConfiguration>();
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_CONFIGURATIONS);
pstmt.setString(1, permission.toString());
ResultSet rs = pstmt.executeQuery();
ExternalComponentConfiguration configuration;
while (rs.next()) {
configuration = new ExternalComponentConfiguration(rs.getString(1));
configuration.setSecret(rs.getString(2));
configuration.setPermission(permission);
answer.add(configuration);
}
rs.close();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
return answer;
}
/**
* Returns the default secret key to use for those external components that don't have an
* individual configuration.
*
* @return the default secret key to use for those external components that don't have an
* individual configuration.
*/
public static String getDefaultSecret() {
return JiveGlobals.getProperty("xmpp.component.defaultSecret");
}
/**
* Sets the default secret key to use for those external components that don't have an
* individual configuration.
*
* @param defaultSecret the default secret key to use for those external components that
* don't have an individual configuration.
*/
public static void setDefaultSecret(String defaultSecret) {
JiveGlobals.setProperty("xmpp.component.defaultSecret", defaultSecret);
}
/**
* Returns the shared secret with the specified external component. If no shared secret was
* defined then use the default shared secret.
*
* @param subdomain the subdomain of the external component to get his shared secret.
* (e.g. conference)
* @return the shared secret with the specified external component or the default shared secret.
*/
public static String getSecretForComponent(String subdomain) {
// By default there is no shared secret defined for the XMPP entity
String secret = null;
ExternalComponentConfiguration config = getConfiguration(subdomain);
if (config != null) {
secret = config.getSecret();
}
secret = (secret == null ? getDefaultSecret() : secret);
if (secret == null) {
Log.error("Setup for external components is incomplete. Property " +
"xmpp.component.defaultSecret does not exist.");
}
return secret;
}
/**
* 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.
*
* @return the permission policy being used for new XMPP entities that are trying to
* connect to the server.
*/
public static PermissionPolicy getPermissionPolicy() {
try {
return PermissionPolicy.valueOf(JiveGlobals.getProperty("xmpp.component.permission",
PermissionPolicy.blacklist.toString()));
}
catch (Exception e) {
Log.error(e);
return PermissionPolicy.blacklist;
}
}
/**
* 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.
*
* @param policy the new PermissionPolicy to use.
*/
public static void setPermissionPolicy(PermissionPolicy policy) {
JiveGlobals.setProperty("xmpp.component.permission", policy.toString());
// Check if the connected component can remain connected to the server
for (ComponentSession session : SessionManager.getInstance().getComponentSessions()) {
if (!canAccess(session.getExternalComponent().getSubdomain())) {
session.getConnection().close();
}
}
}
/**
* 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.
*
* @param policy the new policy to use.
*/
public static void setPermissionPolicy(String policy) {
setPermissionPolicy(PermissionPolicy.valueOf(policy));
}
public enum PermissionPolicy {
/**
* Any XMPP entity is allowed to connect to the server except for those listed in
* the <b>not allowed list</b>.
*/
blacklist,
/**
* Only the XMPP entities listed in the <b>allowed list</b> are able to connect to
* the server.
*/
whitelist;
}
}
package org.jivesoftware.messenger.server;
/**
* Holds the configuration when connecting to/from a remote server. The configuration specifies
* if incoming or outgoing connections are allowed to the remote server and the port to use
* when creating an outgoing connection.
*
* @author Gaston Dombiak
*/
public class RemoteServerConfiguration {
private String domain;
private Permission permission;
private int remotePort;
public RemoteServerConfiguration(String domain) {
this.domain = domain;
}
public String getDomain() {
return domain;
}
public Permission getPermission() {
return permission;
}
public void setPermission(Permission permission) {
this.permission = permission;
}
public int getRemotePort() {
return remotePort;
}
public void setRemotePort(int remotePort) {
this.remotePort = remotePort;
}
public enum Permission {
/**
* The XMPP entity is allowed to connect to the server.
*/
allowed,
/**
* The XMPP entity is NOT allowed to connect to the server.
*/
blocked;
}
}
package org.jivesoftware.messenger.server;
import org.jivesoftware.database.DbConnectionManager;
import org.jivesoftware.messenger.Session;
import org.jivesoftware.messenger.SessionManager;
import org.jivesoftware.messenger.net.SocketAcceptThread;
import org.jivesoftware.messenger.server.RemoteServerConfiguration.Permission;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.Log;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
/**
* 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
*/
public class RemoteServerManager {
private static final String ADD_CONFIGURATION =
"INSERT INTO jiveRemoteServerConf (domain,remotePort,permission) VALUES (?,?,?)";
private static final String DELETE_CONFIGURATION =
"DELETE FROM jiveRemoteServerConf WHERE domain=?";
private static final String LOAD_CONFIGURATION =
"SELECT remotePort,permission FROM jiveRemoteServerConf where domain=?";
private static final String LOAD_CONFIGURATIONS =
"SELECT domain,remotePort FROM jiveRemoteServerConf where permission=?";
/**
* Allows a remote server to connect to the local server with the specified configuration.
*
* @param configuration the configuration for the remote server.
*/
public static void allowAccess(RemoteServerConfiguration configuration) {
// Remove any previous configuration for this remote server
deleteConfiguration(configuration.getDomain());
// Update the database with the new granted permission and configuration
configuration.setPermission(Permission.allowed);
addConfiguration(configuration);
}
/**
* 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.
*
* @param domain the domain of the remote server that is not allowed to connect.
*/
public static void blockAccess(String domain) {
// Remove any previous configuration for this remote server
deleteConfiguration(domain);
// Update the database with the new revoked permission
RemoteServerConfiguration config = new RemoteServerConfiguration(domain);
config.setPermission(Permission.blocked);
addConfiguration(config);
// Check if the remote server was connected and proceed to close the connection
Session session = SessionManager.getInstance().getIncomingServerSession(domain);
if (session != null) {
session.getConnection().close();
}
session = SessionManager.getInstance().getOutgoingServerSession(domain);
if (session != null) {
session.getConnection().close();
}
}
/**
* Returns true if the remote server with the specified domain can connect to the
* local server.
*
* @param domain the domain of the remote server.
* @return true if the remote server with the specified domain can connect to the
* local server.
*/
public static boolean canAccess(String domain) {
// By default there is no permission defined for the XMPP entity
Permission permission = null;
RemoteServerConfiguration config = getConfiguration(domain);
if (config != null) {
permission = config.getPermission();
}
if (PermissionPolicy.blacklist == getPermissionPolicy()) {
// Anyone can access except those entities listed in the blacklist
if (Permission.blocked == permission) {
return false;
}
else {
return true;
}
}
else {
// Access is limited to those present in the whitelist
if (Permission.allowed == permission) {
return true;
}
else {
return false;
}
}
}
/**
* 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.
*
* @return the configuration of the registered external components.
*/
public static Collection<RemoteServerConfiguration> getAllowedServers() {
return getConfigurations(Permission.allowed);
}
/**
* Returns the list of remote servers that are NOT allowed to connect to/from this
* server.
*
* @return the configuration of the blocked external components.
*/
public static Collection<RemoteServerConfiguration> getBlockedServers() {
return getConfigurations(Permission.blocked);
}
/**
* Removes any existing defined permission and configuration for the specified
* remote server.
*
* @param domain the domain of the remote server.
*/
public static void deleteConfiguration(String domain) {
// Remove the permission for the entity from the database
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(DELETE_CONFIGURATION);
pstmt.setString(1, domain);
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
}
/**
* Adds a new permission for the specified remote server.
*/
private static void addConfiguration(RemoteServerConfiguration configuration) {
// Remove the permission for the entity from the database
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(ADD_CONFIGURATION);
pstmt.setString(1, configuration.getDomain());
pstmt.setInt(2, configuration.getRemotePort());
pstmt.setString(3, configuration.getPermission().toString());
pstmt.executeUpdate();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
}
/**
* Returns the configuration for a remote server.
*
* @param domain the domain of the remote server.
* @return the configuration for a remote server.
*/
public static RemoteServerConfiguration getConfiguration(String domain) {
RemoteServerConfiguration configuration = null;
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_CONFIGURATION);
pstmt.setString(1, domain);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
configuration = new RemoteServerConfiguration(domain);
configuration.setRemotePort(rs.getInt(1));
configuration.setPermission(Permission.valueOf(rs.getString(2)));
}
rs.close();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
return configuration;
}
private static Collection<RemoteServerConfiguration> getConfigurations(
Permission permission) {
Collection<RemoteServerConfiguration> answer =
new ArrayList<RemoteServerConfiguration>();
java.sql.Connection con = null;
PreparedStatement pstmt = null;
try {
con = DbConnectionManager.getConnection();
pstmt = con.prepareStatement(LOAD_CONFIGURATIONS);
pstmt.setString(1, permission.toString());
ResultSet rs = pstmt.executeQuery();
RemoteServerConfiguration configuration;
while (rs.next()) {
configuration = new RemoteServerConfiguration(rs.getString(1));
configuration.setRemotePort(rs.getInt(2));
configuration.setPermission(permission);
answer.add(configuration);
}
rs.close();
}
catch (SQLException sqle) {
Log.error(sqle);
}
finally {
try { if (pstmt != null) pstmt.close(); }
catch (Exception e) { Log.error(e); }
try { if (con != null) con.close(); }
catch (Exception e) { Log.error(e); }
}
return answer;
}
/**
* Returns the remote port to connect for the specified remote server. If no port was
* defined then use the default port (e.g. 5269).
*
* @param domain the domain of the remote server to get the remote port to connect to.
* @return the remote port to connect for the specified remote server.
*/
public static int getPortForServer(String domain) {
int port = JiveGlobals.getIntProperty("xmpp.server.socket.remotePort",
SocketAcceptThread.DEFAULT_SERVER_PORT);
RemoteServerConfiguration config = getConfiguration(domain);
if (config != null) {
port = config.getRemotePort();
if (port == 0) {
port =
JiveGlobals.getIntProperty("xmpp.server.socket.remotePort",
SocketAcceptThread.DEFAULT_SERVER_PORT);
}
}
return port;
}
/**
* 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.
*
* @return the permission policy being used for new XMPP entities that are trying to
* connect to the server.
*/
public static PermissionPolicy getPermissionPolicy() {
try {
return PermissionPolicy.valueOf(JiveGlobals.getProperty("xmpp.server.permission",
PermissionPolicy.blacklist.toString()));
}
catch (Exception e) {
Log.error(e);
return PermissionPolicy.blacklist;
}
}
/**
* 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.
*
* @param policy the new PermissionPolicy to use.
*/
public static void setPermissionPolicy(PermissionPolicy policy) {
JiveGlobals.setProperty("xmpp.server.permission", policy.toString());
// Check if the connected servers can remain connected to the server
for (String hostname : SessionManager.getInstance().getIncomingServers()) {
if (!canAccess(hostname)) {
Session session = SessionManager.getInstance().getIncomingServerSession(hostname);
session.getConnection().close();
}
}
for (String hostname : SessionManager.getInstance().getOutgoingServers()) {
if (!canAccess(hostname)) {
Session session = SessionManager.getInstance().getOutgoingServerSession(hostname);
session.getConnection().close();
}
}
}
/**
* 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.
*
* @param policy the new policy to use.
*/
public static void setPermissionPolicy(String policy) {
setPermissionPolicy(PermissionPolicy.valueOf(policy));
}
public enum PermissionPolicy {
/**
* Any XMPP entity is allowed to connect to the server except for those listed in
* the <b>not allowed list</b>.
*/
blacklist,
/**
* Only the XMPP entities listed in the <b>allowed list</b> are able to connect to
* the server.
*/
whitelist;
}
}
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ page import="org.jivesoftware.util.*,
java.util.*,
org.jivesoftware.messenger.*,
java.text.DateFormat,
java.text.NumberFormat,
org.jivesoftware.admin.*,
org.jivesoftware.messenger.user.User,
org.xmpp.packet.JID,
org.xmpp.packet.Presence,
java.net.URLEncoder,
org.jivesoftware.messenger.server.IncomingServerSession,
org.jivesoftware.messenger.server.OutgoingServerSession,
org.jivesoftware.messenger.component.ComponentSession"
errorPage="error.jsp"
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% // Get parameters
String jid = ParamUtils.getParameter(request, "jid");
// Handle a "go back" click:
if (request.getParameter("back") != null) {
response.sendRedirect("component-session-summary.jsp");
return;
}
// Get the session & address objects
SessionManager sessionManager = webManager.getSessionManager();
ComponentSession componentSession = sessionManager.getComponentSession(jid);
// Number dateFormatter for all numbers on this page:
NumberFormat numFormatter = NumberFormat.getNumberInstance();
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = LocaleUtils.getLocalizedString("component.session.details.title");
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "component-session-details.jsp?jid=" + jid));
pageinfo.setPageID("component-session-summary");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p>
<fmt:message key="component.session.details.info">
<fmt:param value="<%= "<b>"+jid+"</b>" %>" />
</fmt:message>
</p>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th colspan="2">
<fmt:message key="component.session.details.title" />
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="c1">
<fmt:message key="component.session.label.domain" />
</td>
<td>
<%= componentSession.getAddress() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="component.session.label.name" />
</td>
<td>
<%= componentSession.getExternalComponent().getName() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="component.session.label.category" />:
</td>
<td>
<%= componentSession.getExternalComponent().getCategory() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="component.session.label.type" />:
</td>
<td>
<%= componentSession.getExternalComponent().getType() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="component.session.label.creation" />
</td>
<td>
<%= JiveGlobals.formatDateTime(componentSession.getCreationDate()) %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="component.session.label.last_active" />
</td>
<td>
<%= JiveGlobals.formatDateTime(componentSession.getLastActiveDate()) %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="session.details.statistics" />
</td>
<td>
<fmt:message key="session.details.received" />
<%= numFormatter.format(componentSession.getNumClientPackets()) %>/<%= numFormatter.format(componentSession.getNumServerPackets()) %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="session.details.hostname" />
</td>
<td>
<%= componentSession.getConnection().getInetAddress().getHostAddress() %>
/
<%= componentSession.getConnection().getInetAddress().getHostName() %>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<form action="component-session-details.jsp">
<center>
<input type="submit" name="back" value="<fmt:message key="session.details.back_button" />">
</center>
</form>
<jsp:include page="bottom.jsp" flush="true" />
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%@ page import="org.jivesoftware.util.*,
java.util.Iterator,
org.jivesoftware.messenger.*,
java.util.*,
java.text.DateFormat,
org.jivesoftware.admin.AdminPageBean,
org.jivesoftware.messenger.net.SocketAcceptThread,
org.jivesoftware.messenger.component.ExternalComponentManager,
org.jivesoftware.messenger.component.ExternalComponentConfiguration"
errorPage="error.jsp"
%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = LocaleUtils.getLocalizedString("component.settings.title");
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "external-components-settings.jsp"));
pageinfo.setPageID("external-components-settings");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<% // Get parameters
boolean update = request.getParameter("update") != null;
boolean permissionUpdate = request.getParameter("permissionUpdate") != null;
boolean componentEnabled = ParamUtils.getBooleanParameter(request,"componentEnabled");
int port = ParamUtils.getIntParameter(request,"port", 0);
String defaultSecret = ParamUtils.getParameter(request,"defaultSecret");
String permissionFilter = ParamUtils.getParameter(request,"permissionFilter");
String configToDelete = ParamUtils.getParameter(request,"deleteConf");
boolean componentAllowed = request.getParameter("componentAllowed") != null;
boolean componentBlocked = request.getParameter("componentBlocked") != null;
String subdomain = ParamUtils.getParameter(request,"subdomain");
String secret = ParamUtils.getParameter(request,"secret");
boolean updateSucess = false;
boolean allowSuccess = false;
boolean blockSuccess = false;
boolean deleteSuccess = false;
String serverName = XMPPServer.getInstance().getServerInfo().getName();
// Update the session kick policy if requested
Map errors = new HashMap();
if (update) {
// Validate params
if (componentEnabled) {
if (defaultSecret == null || defaultSecret.trim().length() == 0) {
errors.put("defaultSecret","");
}
if (port <= 0) {
errors.put("port","");
}
}
// If no errors, continue:
if (errors.isEmpty()) {
if (!componentEnabled) {
JiveGlobals.setProperty("xmpp.component.socket.active", "false");
}
else {
JiveGlobals.setProperty("xmpp.component.socket.active", "true");
JiveGlobals.setProperty("xmpp.component.socket.port", String.valueOf(port));
ExternalComponentManager.setDefaultSecret(defaultSecret);
}
updateSucess = true;
}
}
if (permissionUpdate) {
ExternalComponentManager.setPermissionPolicy(permissionFilter);
updateSucess = true;
}
if (configToDelete != null && configToDelete.trim().length() != 0) {
ExternalComponentManager.deleteConfiguration(configToDelete);
deleteSuccess = true;
}
if (componentAllowed) {
// Validate params
if (subdomain == null || subdomain.trim().length() == 0) {
errors.put("subdomain","");
}
if (secret == null || secret.trim().length() == 0) {
errors.put("secret","");
}
// If no errors, continue:
if (errors.isEmpty()) {
// Remove the hostname if the user is not sending just the subdomain
subdomain = subdomain.replace("." + serverName, "");
ExternalComponentConfiguration configuration = new ExternalComponentConfiguration(subdomain);
configuration.setSecret(secret);
configuration.setPermission(ExternalComponentConfiguration.Permission.allowed);
ExternalComponentManager.allowAccess(configuration);
allowSuccess = true;
}
}
if (componentBlocked) {
// Validate params
if (subdomain == null || subdomain.trim().length() == 0) {
errors.put("subdomain","");
}
// If no errors, continue:
if (errors.isEmpty()) {
// Remove the hostname if the user is not sending just the subdomain
subdomain = subdomain.replace("." + serverName, "");
ExternalComponentManager.blockAccess(subdomain);
blockSuccess = true;
}
}
// Set page vars
if (errors.size() == 0) {
componentEnabled = JiveGlobals.getBooleanProperty("xmpp.component.socket.active", true);
port = JiveGlobals.getIntProperty("xmpp.component.socket.port", SocketAcceptThread.DEFAULT_COMPONENT_PORT);
defaultSecret = ExternalComponentManager.getDefaultSecret();
permissionFilter = ExternalComponentManager.getPermissionPolicy().toString();
subdomain = "";
secret = "";
}
else {
if (port == 0) {
port = JiveGlobals.getIntProperty("xmpp.component.socket.port", SocketAcceptThread.DEFAULT_COMPONENT_PORT);
}
if (defaultSecret == null) {
defaultSecret = ExternalComponentManager.getDefaultSecret();
}
if (permissionFilter == null) {
permissionFilter = ExternalComponentManager.getPermissionPolicy().toString();
}
if (subdomain == null) {
subdomain = "";
}
if (secret == null) {
secret = "";
}
}
%>
<p>
<fmt:message key="component.settings.info" />
</p>
<% if (!errors.isEmpty()) { %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"/></td>
<td class="jive-icon-label">
<% if (errors.get("port") != null) { %>
<fmt:message key="component.settings.valid.port" />
<% } else if (errors.get("defaultSecret") != null) { %>
<fmt:message key="component.settings.valid.defaultSecret" />
<% } else if (errors.get("subdomain") != null) { %>
<fmt:message key="component.settings.valid.subdomain" />
<% } else if (errors.get("secret") != null) { %>
<fmt:message key="component.settings.valid.secret" />
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<% } else if (updateSucess || allowSuccess || blockSuccess || deleteSuccess) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
<% if (updateSucess) { %>
<fmt:message key="component.settings.confirm.updated" />
<% } else if (allowSuccess) { %>
<fmt:message key="component.settings.confirm.allowed" />
<% } else if (blockSuccess) { %>
<fmt:message key="component.settings.confirm.blocked" />
<% } else if (deleteSuccess) { %>
<fmt:message key="component.settings.confirm.deleted" />
<%
}
%>
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="external-components-settings.jsp" method="post">
<fieldset>
<legend><fmt:message key="component.settings.enabled.legend" /></legend>
<div>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="componentEnabled" value="false" id="rb01"
<%= (!componentEnabled ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01">
<b><fmt:message key="component.settings.label_disable" /></b> - <fmt:message key="component.settings.label_disable_info" />
</label>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="componentEnabled" value="true" id="rb02"
<%= (componentEnabled ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb02">
<b><fmt:message key="component.settings.label_enable" /></b> - <fmt:message key="component.settings.label_enable_info" />
</label>
</td>
</tr>
<tr valign="top">
<td width="1%" nowrap>
&nbsp;
</td>
<td width="99%">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tr valign="top">
<td width="1%" nowrap class="c1">
<fmt:message key="component.settings.port" />
</td>
<td width="99%">
<input type="text" size="15" maxlength="50" name="port"
value="<%= port %>">
</td>
</tr>
<tr valign="top">
<td width="1%" nowrap class="c1">
<fmt:message key="component.settings.defaultSecret" />
</td>
<td width="99%">
<input type="text" size="25" maxlength="70" name="defaultSecret"
value="<%= ((defaultSecret != null) ? defaultSecret : "") %>">
</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br>
<input type="submit" name="update" value="<fmt:message key="global.save_settings" />">
</form>
<br>
<fieldset>
<legend><fmt:message key="component.settings.allowed" /></legend>
<div>
<form action="external-components-settings.jsp" method="post">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="permissionFilter" value="<%= ExternalComponentManager.PermissionPolicy.blacklist %>" id="rb01"
<%= (ExternalComponentManager.PermissionPolicy.blacklist.toString().equals(permissionFilter) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01">
<b><fmt:message key="component.settings.anyone" /></b> - <fmt:message key="component.settings.anyone_info" />
</label>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="permissionFilter" value="<%= ExternalComponentManager.PermissionPolicy.whitelist %>" id="rb02"
<%= (ExternalComponentManager.PermissionPolicy.whitelist.toString().equals(permissionFilter) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb02">
<b><fmt:message key="component.settings.whitelist" /></b> - <fmt:message key="component.settings.whitelist_info" />
</label>
</td>
</tr>
</tbody>
</table>
<br>
<input type="submit" name="permissionUpdate" value="<fmt:message key="global.save_settings" />">
</form>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th width="1%">&nbsp;</th>
<th width="50%" nowrap><fmt:message key="component.settings.subdomain" /></th>
<th width="49%" nowrap><fmt:message key="component.settings.secret" /></th>
<th width="10%" nowrap><fmt:message key="global.delete" /></th>
</tr>
</thead>
<tbody>
<% Collection<ExternalComponentConfiguration> configs = ExternalComponentManager.getAllowedComponents();
if (configs.isEmpty()) { %>
<tr>
<td align="center" colspan="7"><fmt:message key="component.settings.empty_list" /></td>
</tr>
<% }
else {
int count = 1;
for (Iterator<ExternalComponentConfiguration> it=configs.iterator(); it.hasNext(); count++) {
ExternalComponentConfiguration configuration = it.next();
%>
<tr class="jive-<%= (((count%2)==0) ? "even" : "odd") %>">
<td>
<%= count %>
</td>
<td>
<%= configuration.getSubdomain() %>
</td>
<td>
<%= configuration.getSecret() %>
</td>
<td align="center" style="border-right:1px #ccc solid;">
<a href="#" onclick="if (confirm('<fmt:message key="component.settings.confirm_delete" />')) { location.replace('external-components-settings.jsp?deleteConf=<%= configuration.getSubdomain() %>'); } "
title="<fmt:message key="global.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<% }
}
%>
</tbody>
</table>
<br>
<table cellpadding="3" cellspacing="1" border="0" width="100%">
<form action="external-components-settings.jsp" method="post">
<tr>
<td nowrap width="1%">
<fmt:message key="component.settings.subdomain" />
</td>
<td>
<input type="text" size="40" name="subdomain" value="<%= componentAllowed ? subdomain : "" %>"/>
</td>
<td nowrap width="1%">
<fmt:message key="component.settings.secret" />
</td>
<td>
<input type="text" size="40" name="secret"value="<%= componentAllowed ? secret : "" %>"/>
</td>
</tr>
<tr align="center">
<td colspan="4">
<input type="submit" name="componentAllowed" value="<fmt:message key="component.settings.allow" />">
</td>
</tr>
</form>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend><fmt:message key="component.settings.disallowed" /></legend>
<p><fmt:message key="component.settings.disallowed.info" /></p>
<div>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th width="1%">&nbsp;</th>
<th width="89%" nowrap><fmt:message key="component.settings.subdomain" /></th>
<th width="10%" nowrap><fmt:message key="global.delete" /></th>
</tr>
</thead>
<tbody>
<% Collection<ExternalComponentConfiguration> blockedComponents = ExternalComponentManager.getBlockedComponents();
if (blockedComponents.isEmpty()) { %>
<tr>
<td align="center" colspan="7"><fmt:message key="component.settings.empty_list" /></td>
</tr>
<% }
else {
int count = 1;
for (Iterator<ExternalComponentConfiguration> it=blockedComponents.iterator(); it.hasNext(); count++) {
ExternalComponentConfiguration configuration = it.next();
%>
<tr class="jive-<%= (((count%2)==0) ? "even" : "odd") %>">
<td>
<%= count %>
</td>
<td>
<%= configuration.getSubdomain() %>
</td>
<td align="center" style="border-right:1px #ccc solid;">
<a href="#" onclick="if (confirm('<fmt:message key="component.settings.confirm_delete" />')) { location.replace('external-components-settings.jsp?deleteConf=<%= configuration.getSubdomain() %>'); } "
title="<fmt:message key="global.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<% }
}
%>
</tbody>
</table>
<br>
<table cellpadding="3" cellspacing="1" border="0" width="100%">
<form action="external-components-settings.jsp" method="post">
<tr>
<td nowrap width="1%">
<fmt:message key="component.settings.subdomain" />
</td>
<td>
<input type="text" size="40" name="subdomain" value="<%= componentBlocked ? subdomain : "" %>"/>&nbsp;
<input type="submit" name="componentBlocked" value="<fmt:message key="component.settings.block" />">
</td>
</tr>
</form>
</table>
</div>
</fieldset>
<jsp:include page="bottom.jsp" flush="true" />
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2004 Jive Software. All rights reserved.
-
- This software is published under the terms of the GNU Public License (GPL),
- a copy of which is included in this distribution.
--%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
<%@ page import="org.jivesoftware.util.*,
java.util.Iterator,
org.jivesoftware.messenger.*,
java.util.*,
java.text.DateFormat,
org.jivesoftware.admin.AdminPageBean,
org.jivesoftware.messenger.server.RemoteServerManager,
org.jivesoftware.messenger.server.RemoteServerConfiguration"
errorPage="error.jsp"
%>
<jsp:useBean id="admin" class="org.jivesoftware.util.WebManager" />
<% admin.init(request, response, session, application, out ); %>
<% // Get parameters
boolean closeEnabled = ParamUtils.getBooleanParameter(request,"closeEnabled");
String idletime = ParamUtils.getParameter(request,"idletime");
boolean closeSettings = request.getParameter("closeSettings") != null;
boolean closeSettingsSuccess = request.getParameter("closeSettingsSuccess") != null;
boolean permissionUpdate = request.getParameter("permissionUpdate") != null;
String permissionFilter = ParamUtils.getParameter(request,"permissionFilter");
String configToDelete = ParamUtils.getParameter(request,"deleteConf");
boolean serverAllowed = request.getParameter("serverAllowed") != null;
boolean serverBlocked = request.getParameter("serverBlocked") != null;
String domain = ParamUtils.getParameter(request,"domain");
String remotePort = ParamUtils.getParameter(request,"remotePort");
boolean updateSucess = false;
boolean allowSuccess = false;
boolean blockSuccess = false;
boolean deleteSuccess = false;
// Get muc server
SessionManager sessionManager = admin.getSessionManager();
Map errors = new HashMap();
// Handle an update of the kicking task settings
if (closeSettings) {
if (!closeEnabled) {
// Disable kicking users by setting a value of -1
sessionManager.setServerSessionIdleTime(-1);
response.sendRedirect("server2server-settings.jsp?closeSettingsSuccess=true");
return;
}
// do validation
if (idletime == null) {
errors.put("idletime","idletime");
}
int idle = 0;
// Try to obtain an int from the provided strings
if (errors.size() == 0) {
try {
idle = Integer.parseInt(idletime) * 1000 * 60;
}
catch (NumberFormatException e) {
errors.put("idletime","idletime");
}
if (idle < 0) {
errors.put("idletime","idletime");
}
}
if (errors.size() == 0) {
sessionManager.setServerSessionIdleTime(idle);
response.sendRedirect("server2server-settings.jsp?closeSettingsSuccess=true");
return;
}
}
if (permissionUpdate) {
RemoteServerManager.setPermissionPolicy(permissionFilter);
updateSucess = true;
}
if (configToDelete != null && configToDelete.trim().length() != 0) {
RemoteServerManager.deleteConfiguration(configToDelete);
deleteSuccess = true;
}
if (serverAllowed) {
int intRemotePort = 0;
// Validate params
if (domain == null || domain.trim().length() == 0) {
errors.put("domain","");
}
if (remotePort == null || remotePort.trim().length() == 0 || "0".equals(remotePort)) {
errors.put("remotePort","");
}
else {
try {
intRemotePort = Integer.parseInt(remotePort);
}
catch (NumberFormatException e) {
errors.put("remotePort","");
}
}
// If no errors, continue:
if (errors.isEmpty()) {
RemoteServerConfiguration configuration = new RemoteServerConfiguration(domain);
configuration.setRemotePort(intRemotePort);
configuration.setPermission(RemoteServerConfiguration.Permission.allowed);
RemoteServerManager.allowAccess(configuration);
allowSuccess = true;
}
}
if (serverBlocked) {
// Validate params
if (domain == null || domain.trim().length() == 0) {
errors.put("domain","");
}
// If no errors, continue:
if (errors.isEmpty()) {
RemoteServerManager.blockAccess(domain);
blockSuccess = true;
}
}
// Set page vars
if (errors.size() == 0) {
permissionFilter = RemoteServerManager.getPermissionPolicy().toString();
domain = "";
remotePort = "0";
}
else {
if (permissionFilter == null) {
permissionFilter = RemoteServerManager.getPermissionPolicy().toString();
}
if (domain == null) {
domain = "";
}
if (remotePort == null) {
remotePort = "0";
}
}
%>
<jsp:useBean id="pageinfo" scope="request" class="org.jivesoftware.admin.AdminPageBean" />
<% // Title of this page and breadcrumbs
String title = LocaleUtils.getLocalizedString("server2server.settings.title");
pageinfo.setTitle(title);
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(LocaleUtils.getLocalizedString("global.main"), "index.jsp"));
pageinfo.getBreadcrumbs().add(new AdminPageBean.Breadcrumb(title, "server2server-settings.jsp"));
pageinfo.setPageID("server2server-settings");
%>
<jsp:include page="top.jsp" flush="true" />
<jsp:include page="title.jsp" flush="true" />
<p>
<fmt:message key="server2server.settings.info" />
</p>
<% if (!errors.isEmpty()) { %>
<div class="jive-error">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<td class="jive-icon"><img src="images/error-16x16.gif" width="16" height="16" border="0"/></td>
<td class="jive-icon-label">
<% if (errors.get("idletime") != null) { %>
<fmt:message key="server2server.settings.valid.idle_minutes" />
<% } else if (errors.get("domain") != null) { %>
<fmt:message key="server2server.settings.valid.domain" />
<% } else if (errors.get("remotePort") != null) { %>
<fmt:message key="server2server.settings.valid.remotePort" />
<% } %>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<% } else if (closeSettingsSuccess || updateSucess || allowSuccess || blockSuccess || deleteSuccess) { %>
<div class="jive-success">
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr><td class="jive-icon"><img src="images/success-16x16.gif" width="16" height="16" border="0"></td>
<td class="jive-icon-label">
<% if (updateSucess) { %>
<fmt:message key="server2server.settings.confirm.updated" />
<% } else if (allowSuccess) { %>
<fmt:message key="server2server.settings.confirm.allowed" />
<% } else if (blockSuccess) { %>
<fmt:message key="server2server.settings.confirm.blocked" />
<% } else if (deleteSuccess) { %>
<fmt:message key="server2server.settings.confirm.deleted" />
<% } else if (closeSettingsSuccess) { %>
<fmt:message key="server2server.settings.update" />
<%
}
%>
</td></tr>
</tbody>
</table>
</div><br>
<% } %>
<form action="server2server-settings.jsp?closeSettings" method="post">
<fieldset>
<legend><fmt:message key="server2server.settings.close_settings" /></legend>
<div>
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="closeEnabled" value="false" id="rb01"
<%= ((admin.getSessionManager().getServerSessionIdleTime() < 0) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01"><fmt:message key="server2server.settings.never_close" /></label>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="closeEnabled" value="true" id="rb02"
<%= ((admin.getSessionManager().getServerSessionIdleTime() > -1) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb02"><fmt:message key="server2server.settings.close_session" /></label>
<input type="text" name="idletime" size="5" maxlength="5"
onclick="this.form.closeEnabled[1].checked=true;"
value="<%= admin.getSessionManager().getServerSessionIdleTime() == -1 ? 30 : admin.getSessionManager().getServerSessionIdleTime() / 1000 / 60 %>">
<fmt:message key="global.minutes" />.
</td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<br>
<input type="submit" value="<fmt:message key="global.save_settings" />">
</form>
<br>
<fieldset>
<legend><fmt:message key="server2server.settings.allowed" /></legend>
<div>
<form action="server2server-settings.jsp" method="post">
<table cellpadding="3" cellspacing="0" border="0" width="100%">
<tbody>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="permissionFilter" value="<%= RemoteServerManager.PermissionPolicy.blacklist %>" id="rb01"
<%= (RemoteServerManager.PermissionPolicy.blacklist.toString().equals(permissionFilter) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb01">
<b><fmt:message key="server2server.settings.anyone" /></b> - <fmt:message key="server2server.settings.anyone_info" />
</label>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap>
<input type="radio" name="permissionFilter" value="<%= RemoteServerManager.PermissionPolicy.whitelist %>" id="rb02"
<%= (RemoteServerManager.PermissionPolicy.whitelist.toString().equals(permissionFilter) ? "checked" : "") %>>
</td>
<td width="99%">
<label for="rb02">
<b><fmt:message key="server2server.settings.whitelist" /></b> - <fmt:message key="server2server.settings.whitelist_info" />
</label>
</td>
</tr>
</tbody>
</table>
<br>
<input type="submit" name="permissionUpdate" value="<fmt:message key="global.save_settings" />">
</form>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th width="1%">&nbsp;</th>
<th width="50%" nowrap><fmt:message key="server2server.settings.domain" /></th>
<th width="49%" nowrap><fmt:message key="server2server.settings.remotePort" /></th>
<th width="10%" nowrap><fmt:message key="global.delete" /></th>
</tr>
</thead>
<tbody>
<% Collection<RemoteServerConfiguration> configs = RemoteServerManager.getAllowedServers();
if (configs.isEmpty()) { %>
<tr>
<td align="center" colspan="7"><fmt:message key="server2server.settings.empty_list" /></td>
</tr>
<% }
else {
int count = 1;
for (Iterator<RemoteServerConfiguration> it=configs.iterator(); it.hasNext(); count++) {
RemoteServerConfiguration configuration = it.next();
%>
<tr class="jive-<%= (((count%2)==0) ? "even" : "odd") %>">
<td>
<%= count %>
</td>
<td>
<%= configuration.getDomain() %>
</td>
<td>
<%= configuration.getRemotePort() %>
</td>
<td align="center" style="border-right:1px #ccc solid;">
<a href="#" onclick="if (confirm('<fmt:message key="server2server.settings.confirm_delete" />')) { location.replace('server2server-settings.jsp?deleteConf=<%= configuration.getDomain() %>'); } "
title="<fmt:message key="global.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<% }
}
%>
</tbody>
</table>
<br>
<table cellpadding="3" cellspacing="1" border="0" width="100%">
<form action="server2server-settings.jsp" method="post">
<tr>
<td nowrap width="1%">
<fmt:message key="server2server.settings.domain" />
</td>
<td>
<input type="text" size="40" name="domain" value="<%= serverAllowed ? domain : "" %>"/>
</td>
<td nowrap width="1%">
<fmt:message key="server2server.settings.remotePort" />
</td>
<td>
<input type="text" size="40" name="remotePort"value="<%= serverAllowed ? remotePort : "5269" %>"/>
</td>
</tr>
<tr align="center">
<td colspan="4">
<input type="submit" name="serverAllowed" value="<fmt:message key="server2server.settings.allow" />">
</td>
</tr>
</form>
</table>
</div>
</fieldset>
<br><br>
<fieldset>
<legend><fmt:message key="server2server.settings.disallowed" /></legend>
<p><fmt:message key="server2server.settings.disallowed.info" /></p>
<div>
<table class="jive-table" cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th width="1%">&nbsp;</th>
<th width="89%" nowrap><fmt:message key="server2server.settings.domain" /></th>
<th width="10%" nowrap><fmt:message key="global.delete" /></th>
</tr>
</thead>
<tbody>
<% Collection<RemoteServerConfiguration> blockedComponents = RemoteServerManager.getBlockedServers();
if (blockedComponents.isEmpty()) { %>
<tr>
<td align="center" colspan="7"><fmt:message key="server2server.settings.empty_list" /></td>
</tr>
<% }
else {
int count = 1;
for (Iterator<RemoteServerConfiguration> it=blockedComponents.iterator(); it.hasNext(); count++) {
RemoteServerConfiguration configuration = it.next();
%>
<tr class="jive-<%= (((count%2)==0) ? "even" : "odd") %>">
<td>
<%= count %>
</td>
<td>
<%= configuration.getDomain() %>
</td>
<td align="center" style="border-right:1px #ccc solid;">
<a href="#" onclick="if (confirm('<fmt:message key="server2server.settings.confirm_delete" />')) { location.replace('server2server-settings.jsp?deleteConf=<%= configuration.getDomain() %>'); } "
title="<fmt:message key="global.click_delete" />"
><img src="images/delete-16x16.gif" width="16" height="16" border="0"></a>
</td>
</tr>
<% }
}
%>
</tbody>
</table>
<br>
<table cellpadding="3" cellspacing="1" border="0" width="100%">
<form action="server2server-settings.jsp" method="post">
<tr>
<td nowrap width="1%">
<fmt:message key="server2server.settings.domain" />
</td>
<td>
<input type="text" size="40" name="domain" value="<%= serverBlocked ? domain : "" %>"/>&nbsp;
<input type="submit" name="serverBlocked" value="<fmt:message key="server2server.settings.block" />">
</td>
</tr>
</form>
</table>
</div>
</fieldset>
<jsp:include page="bottom.jsp" flush="true" />
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment