Frank Kobzik has uploaded a new change for review. Change subject: frontend: Prevent selecting web based console clients in IE ......................................................................
frontend: Prevent selecting web based console clients in IE Prevent selecting noVNC/SPICE-HTML5 in 'Console Options' view when viewing engine via Internet Explorer. IE doesn't support inter-frame communication html5 standard called 'post message', which we use for passing data from the engine to noVNC/SPICE-HTML5 client. Moreover, this patch adds a check for compatibility SPICE-HTML5 to SpiceConsoleModel which prevents selecting this client from selecting when not supported. Change-Id: I8d3845a4a34bbbb703e5b9e04e7ee194071b51ca Bug-Url: https://bugzilla.redhat.com/1080013 Signed-off-by: Frantisek Kobzik <fkob...@redhat.com> --- M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java M frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtilsImpl.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ConsoleUtils.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java 6 files changed, 21 insertions(+), 15 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/34836/1 diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index 0e805ae..511e562 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -1538,9 +1538,6 @@ @DefaultStringValue("No SPICE proxy defined on system level") String spiceProxyCanBeEnabledOnlyWhenDefined(); - @DefaultStringValue("SPICE HTML5 client can be used only if websocket proxy is configured in the engine.") - String spiceHtml5OnlyWhenWebsocketProxySet(); - @DefaultStringValue("Enable WAN Options") String enableWanOptions(); @@ -1559,8 +1556,9 @@ @DefaultStringValue("VNC") String vnc(); - @DefaultStringValue("Websockets Proxy must be configured in the engine.") - String webSocketProxyNotSet(); + @DefaultStringValue("SPICE-HTML5 and noVNC clients can be used only if websocket proxy is configured in the engine " + + "and don't run under Internet Explorer.") + String webBasedClientsUnsupported(); @DefaultStringValue("SPICE Options") String spiceOptions(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java index 8a122fe..229054a 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/presenter/popup/ConsolePopupPresenterWidget.java @@ -223,9 +223,8 @@ getView().setSpicePluginImplEnabled(false, constants.spicePluginNotSupportedByBrowser()); } - getView().setSpiceHtml5ImplEnabled(consoleUtils.isWebSocketProxyDefined(), constants.spiceHtml5OnlyWhenWebsocketProxySet()); - - getView().setNoVncEnabled(consoleUtils.isWebSocketProxyDefined(), constants.webSocketProxyNotSet()); + getView().setSpiceHtml5ImplEnabled(consoleUtils.webBasedClientsSupported(), constants.webBasedClientsUnsupported()); + getView().setNoVncEnabled(consoleUtils.webBasedClientsSupported(), constants.webBasedClientsUnsupported()); if (!consoleUtils.isBrowserPluginSupported(ConsoleProtocol.RDP)) { getView().setRdpPluginImplEnabled(false, constants.rdpPluginNotSupportedByBrowser()); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtilsImpl.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtilsImpl.java index e4c9a55..11c27ce 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtilsImpl.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/utils/ConsoleUtilsImpl.java @@ -43,9 +43,14 @@ !StringHelper.isNullOrEmpty(vm.getVmPoolSpiceProxy()); } + /** + * HTML5-based console clients are only supported when websocket proxy is configured in the engine and run on + * browsers that support postMessage correctly. + * @return true if HTML5 console clients can be used with current engine configuration and client browser. + */ @Override - public boolean isWebSocketProxyDefined() { - return configurator.isWebSocketProxyDefined(); + public boolean webBasedClientsSupported() { + return configurator.isWebSocketProxyDefined() && !configurator.isClientWindowsExplorer(); } @Override diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ConsoleUtils.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ConsoleUtils.java index 6733cab..b0c9e8c 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ConsoleUtils.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/ConsoleUtils.java @@ -14,7 +14,7 @@ public boolean isSpiceProxyDefined(VM vm); - public boolean isWebSocketProxyDefined(); + public boolean webBasedClientsSupported(); public String getRemapCtrlAltDelHotkey(); diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java index 877566f..3069469 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/SpiceConsoleModel.java @@ -115,6 +115,7 @@ * installed). */ public void setConsoleClientMode(ClientConsoleMode consoleMode) { + ConsoleUtils consoleUtils = (ConsoleUtils) TypeResolver.getInstance().resolve(ConsoleUtils.class); this.consoleMode = consoleMode; switch (consoleMode) { @@ -125,8 +126,12 @@ setspice((ISpice) TypeResolver.getInstance().resolve(ISpicePlugin.class)); break; case Html5: - setspice((ISpice) TypeResolver.getInstance().resolve(ISpiceHtml5.class)); - break; + if (consoleUtils.webBasedClientsSupported()) { + setspice((ISpice) TypeResolver.getInstance().resolve(ISpiceHtml5.class)); + break; + } else { + getLogger().debug("Cannot select SPICE-HTML5."); //$NON-NLS-1$ + } default: ISpicePlugin pluginSpice = (ISpicePlugin) TypeResolver.getInstance().resolve(ISpicePlugin.class); setspice(pluginSpice.detectBrowserPlugin() ? pluginSpice @@ -141,7 +146,6 @@ } if (getEntity() != null) { - ConsoleUtils consoleUtils = (ConsoleUtils) TypeResolver.getInstance().resolve(ConsoleUtils.class); boolean isSpiceProxyDefined = consoleUtils.isSpiceProxyDefined(getEntity()); getspice().setSpiceProxyEnabled(isSpiceProxyDefined); } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java index e91684f..feff191 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VncConsoleModel.java @@ -56,7 +56,7 @@ setTitle(ConstantsManager.getInstance().getConstants().VNCTitle()); - boolean webSocketProxyDefined = ((ConsoleUtils) TypeResolver.getInstance().resolve(ConsoleUtils.class)).isWebSocketProxyDefined(); + boolean webSocketProxyDefined = ((ConsoleUtils) TypeResolver.getInstance().resolve(ConsoleUtils.class)).webBasedClientsSupported(); ClientConsoleMode desiredMode = readDefaultConsoleClientMode(); if (desiredMode == ClientConsoleMode.NoVnc && !webSocketProxyDefined) { desiredMode = ClientConsoleMode.Native; // fallback -- To view, visit http://gerrit.ovirt.org/34836 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I8d3845a4a34bbbb703e5b9e04e7ee194071b51ca Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Frank Kobzik <fkob...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches