Commit c0ad7f92 authored by Guus der Kinderen's avatar Guus der Kinderen

OF-159: Move S2S Test page to Sessions > Tools.

parent 1506e77a
......@@ -610,6 +610,8 @@ tab.tab-session.descr=Click to manage connected sessions
sidebar.tools=Tools
sidebar.user-message=Send Message
sidebar.user-message.descr=Click to send a message
sidebar.server-connectiontest=S2S Connection Test
sidebar.server-connectiontest.desc=Click to test connectivity to another XMPP domain.
tab.tab-groupchat=Group Chat
tab.tab-groupchat.descr=Click to manage group chat settings
sidebar.sidebar-groupchat-settings=Group Chat Settings
......@@ -1647,8 +1649,13 @@ server2server.settings.confirm.updated=Remote server information updated success
server2server.settings.confirm.allowed=Remote server is now allowed to connect to the server.
server2server.settings.confirm.blocked=Remote server is now not allowed to connect to the server.
server2server.settings.confirm.deleted=Remote server information was deleted.
server2server.settings.testing.title=Server to Server Test
server2server.settings.testing.info=This page can be used to test the connectivity to a remote XMPP domain. Please be \
aware that during the test, any pre-existing connection to the remote domain will be disconnected. This might \
result in temporary loss of functionality for some of your users.
server2server.settings.testing.error=An unexpected error occurred while trying to perform the test.
server2server.settings.testing.boxtitle=Server to Server Test
server2server.settings.testing.host=Host
server2server.settings.testing.domain=XMPP domain
server2server.settings.testing.xmpp=XMPP
server2server.settings.testing.certificates=Certs
server2server.settings.testing.logs=Logs
......
......@@ -431,6 +431,10 @@
url="user-message.jsp"
description="${sidebar.user-message.descr}"/>
<item id="server-connectiontest" name="${sidebar.server-connectiontest}"
url="server-connectiontest.jsp"
description="${sidebar.server-connectiontest.descr}"/>
</sidebar>
</tab>
......
......@@ -10,7 +10,6 @@
<%@ page import="org.jivesoftware.openfire.server.RemoteServerManager" %>
<%@ page import="org.jivesoftware.openfire.server.RemoteServerConfiguration" %>
<%@ page import="org.jivesoftware.util.StringUtils" %>
<%@ page import="org.jivesoftware.util.S2STestService" %>
<%@ page errorPage="error.jsp" %>
<%@ taglib uri="admin" prefix="admin" %>
......@@ -32,8 +31,6 @@
boolean serverBlocked = request.getParameter( "serverBlocked" ) != null;
boolean permissionUpdate = request.getParameter( "permissionUpdate" ) != null;
String configToDelete = ParamUtils.getParameter( request, "deleteConf" );
String s2sTestingDomain = ParamUtils.getParameter( request, "server2server-testing-domain" );
boolean s2sTest = request.getParameter("s2s-test") != null && s2sTestingDomain != null;
final Map<String, String> errors = new HashMap<>();
Cookie csrfCookie = CookieUtils.getCookie(request, "csrf");
......@@ -53,17 +50,7 @@
CookieUtils.setCookie(request, response, "csrf", csrfParam, -1);
pageContext.setAttribute("csrf", csrfParam);
if ( s2sTest )
{
Map<String, String> results = new S2STestService(s2sTestingDomain).run();
pageContext.setAttribute("s2sDomain", s2sTestingDomain);
pageContext.setAttribute("s2sTest", true);
pageContext.setAttribute("stanzas", results.get("stanzas"));
pageContext.setAttribute("logs", results.get("logs"));
pageContext.setAttribute("certs", results.get("certs"));
}
else if ( update && errors.isEmpty() )
if ( update && errors.isEmpty() )
{
// plaintext
final boolean plaintextEnabled = ParamUtils.getBooleanParameter( request, "plaintext-enabled" );
......@@ -508,44 +495,5 @@
</admin:contentBox>
<!-- END 'Not Allowed to Connect' -->
<!-- BEGIN 'S2S Testing' -->
<fmt:message key="server2server.settings.testing.boxtitle" var="s2sTitle"/>
<admin:contentBox title="${s2sTitle}">
<form action="connection-settings-socket-s2s.jsp" method="post">
<table cellpadding="3" cellspacing="0" border="0">
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-domain"><fmt:message key="server2server.settings.testing.host"/></label></td>
<td width="99%">
<input type="text" name="server2server-testing-domain" id="server2server-testing-domain" value="${s2sDomain}">
<input type="submit" name="s2s-test" value="<fmt:message key="global.test" />">
</td>
</tr>
<c:if test="${s2sTest}">
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-stanzas"><fmt:message key="server2server.settings.testing.xmpp"/></label></td>
<td width="99%">
<textarea name="server2server-testing-stanzas" style="width: 100%" rows="12"><c:out value="${stanzas}" /></textarea>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-certs"><fmt:message key="server2server.settings.testing.certificates"/></label></td>
<td width="99%">
<textarea name="server2server-testing-certs" style="width: 100%" rows="12"><c:out value="${certs}" /></textarea>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-logs"><fmt:message key="server2server.settings.testing.logs"/></label></td>
<td width="99%">
<textarea name="server2server-testing-logs" style="width: 100%" rows="12"><c:out value="${logs}" /></textarea>
</td>
</tr>
</c:if>
</table>
</form>
</admin:contentBox>
<!-- END 'S2S Testing' -->
</body>
</html>
<%--
~ Copyright (C) 2017 Ignite Realtime Foundation. All rights reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
--%>
<%@ page import="java.util.*,
org.jivesoftware.util.*"
errorPage="error.jsp"
%>
<%@ taglib uri="admin" prefix="admin" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<jsp:useBean id="webManager" class="org.jivesoftware.util.WebManager" />
<% webManager.init(request, response, session, application, out ); %>
<%
Map<String, String> errors = new HashMap<>();
Cookie csrfCookie = CookieUtils.getCookie(request, "csrf");
String csrfParam = ParamUtils.getParameter(request, "csrf");
String s2sTestingDomain = ParamUtils.getParameter( request, "server2server-testing-domain" );
boolean s2sTest = request.getParameter("s2s-test") != null && s2sTestingDomain != null;
if (s2sTest) {
if (csrfCookie == null || csrfParam == null || !csrfCookie.getValue().equals(csrfParam)) {
s2sTest = false;
errors.put("csrf", "CSRF Failure!");
}
}
csrfParam = StringUtils.randomString(15);
CookieUtils.setCookie(request, response, "csrf", csrfParam, -1);
pageContext.setAttribute("csrf", csrfParam);
if (errors.isEmpty() && s2sTest)
{
final Map<String, String> results = new S2STestService(s2sTestingDomain).run();
pageContext.setAttribute("s2sDomain", s2sTestingDomain);
pageContext.setAttribute("s2sTest", true);
pageContext.setAttribute("stanzas", results.get("stanzas"));
pageContext.setAttribute("logs", results.get("logs"));
pageContext.setAttribute("certs", results.get("certs"));
}
pageContext.setAttribute("errors", errors);
%>
<html>
<head>
<title><fmt:message key="server2server.settings.testing.title"/></title>
<meta name="pageID" content="server-connectiontest"/>
</head>
<body>
<c:if test="${not empty errors}">
<admin:infobox type="error">
<fmt:message key="server2server.settings.testing.error" />
</admin:infobox>
</c:if>
<p>
<fmt:message key="server2server.settings.testing.info" />
</p>
<!-- BEGIN 'S2S Testing' -->
<fmt:message key="server2server.settings.testing.boxtitle" var="s2sTitle"/>
<admin:contentBox title="${s2sTitle}">
<form action="server-connectiontest.jsp" method="post">
<table cellpadding="3" cellspacing="0" border="0">
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-domain"><fmt:message key="server2server.settings.testing.domain"/></label></td>
<td width="99%">
<input type="hidden" name="csrf" value="${csrf}"/>
<input type="text" name="server2server-testing-domain" id="server2server-testing-domain" value="${s2sDomain}">
<input type="submit" name="s2s-test" value="<fmt:message key="global.test" />">
</td>
</tr>
<c:if test="${s2sTest}">
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-stanzas"><fmt:message key="server2server.settings.testing.xmpp"/></label></td>
<td width="99%">
<textarea name="server2server-testing-stanzas" id="server2server-testing-stanzas" style="width: 100%" rows="12"><c:out value="${stanzas}" /></textarea>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-certs"><fmt:message key="server2server.settings.testing.certificates"/></label></td>
<td width="99%">
<textarea name="server2server-testing-certs" id="server2server-testing-certs" style="width: 100%" rows="12"><c:out value="${certs}" /></textarea>
</td>
</tr>
<tr valign="middle">
<td width="1%" nowrap><label for="server2server-testing-logs"><fmt:message key="server2server.settings.testing.logs"/></label></td>
<td width="99%">
<textarea name="server2server-testing-logs" id="server2server-testing-logs" style="width: 100%" rows="12"><c:out value="${logs}" /></textarea>
</td>
</tr>
</c:if>
</table>
</form>
</admin:contentBox>
</body>
</html>
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