Massimiliano Assante 5 years ago
parent 2a4f01cbcf
commit fad3075e81

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>VREApp-Integration-portlet</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>com.liferay.ide.core.liferayNature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding/<project>=UTF-8

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8

@ -0,0 +1,3 @@
eclipse.preferences.version=1
validateFragments=false
validation.use-project-settings=true

@ -0,0 +1,4 @@
activeProfiles=Liferay-v6.2-CE-(Tomcat-7)
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="VREApp-Integration-portlet-portlet">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="VREApp-Integration-portlet"/>
<property name="java-output-path" value="/VREApp-Integration-portlet/target/classes"/>
</wb-module>
</project-modules>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="jst.web" version="2.4"/>
<installed facet="liferay.portlet" version="6.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.8"/>
</faceted-project>

@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

@ -0,0 +1,2 @@
disabled=06target
eclipse.preferences.version=1

@ -0,0 +1,23 @@
{
"plugins": {
"guess-types": {
},
"outline": {
},
"liferay": {
},
"yui3": {
},
"aui2.0.x": {
}
},
"libs": [
"ecma5",
"browser"
]
}

@ -0,0 +1 @@
${gcube.license}

@ -0,0 +1,61 @@
The gCube System - ${name}
--------------------------------------------------
${description}
${gcube.description}
${gcube.funding}
Version
--------------------------------------------------
${version} (${buildDate})
Please see the file named "changelog.xml" in this directory for the release notes.
Authors
--------------------------------------------------
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
Maintainers
--------------------------------------------------
* Massimiliano Assante (massimiliano.assante@isti.cnr.it), Istituto di Scienza e Tecnologie dell'Informazione "A. Faedo" - CNR, Pisa (Italy).
Download information
--------------------------------------------------
Source code is available from SVN:
${scm.url}
Binaries can be downloaded from the gCube website:
${gcube.website}
Installation
--------------------------------------------------
Installation documentation is available on-line in the gCube Wiki:
${gcube.wikiRoot}
Documentation
--------------------------------------------------
Documentation is available on-line in the gCube Wiki:
${gcube.wikiRoot}
Support
--------------------------------------------------
Bugs and support requests can be reported in the gCube issue tracking tool:
${gcube.issueTracking}
Licensing
--------------------------------------------------
This software is licensed under the terms you may find in the file named "LICENSE" in this directory.

@ -0,0 +1,6 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlet.user.VREApp-Integration-portlet.1-0-0"
date="2019-01-10">
<Change>First Release</Change>
</Changeset>
</ReleaseNotes>

@ -0,0 +1,32 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>servicearchive</id>
<formats>
<format>tar.gz</format>
</formats>
<baseDirectory>/</baseDirectory>
<fileSets>
<fileSet>
<directory>${distroDirectory}</directory>
<outputDirectory>/</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<includes>
<include>README</include>
<include>LICENSE</include>
<include>changelog.xml</include>
<include>profile.xml</include>
</includes>
<fileMode>755</fileMode>
<filtered>true</filtered>
</fileSet>
</fileSets>
<files>
<file>
<source>target/${build.finalName}.${project.packaging}</source>
<outputDirectory>/${artifactId}</outputDirectory>
</file>
</files>
</assembly>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<Resource xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ID></ID>
<Type>Service</Type>
<Profile>
<Description>Generic portlet to facilitate integration of public web-apps while facilitating inheritance of VRE security token by the embedded web-app</Description>
<Class>PortletUser</Class>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<Packages>
<Software>
<Name>${artifactId}</Name>
<Version>${version}</Version>
<MavenCoordinates>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
</MavenCoordinates>
<Files>
<File>target/${build.finalName}.war</File>
</Files>
</Software>
</Packages>
</Profile>
</Resource>

@ -0,0 +1,188 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId>
<version>1.0.0</version>
<relativePath />
</parent>
<groupId>org.gcube.portlets.user.vreappintegration</groupId>
<artifactId>VREApp-Integration-portlet</artifactId>
<packaging>war</packaging>
<name>VREApp-Integration-portlet Portlet</name>
<version>1.0.0-SNAPSHOT</version>
<properties>
<distroDirectory>${project.basedir}/distro</distroDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<liferay.version>6.2.5</liferay.version>
<liferay.maven.plugin.version>6.2.10.12</liferay.maven.plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId>
<version>LATEST</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>com.liferay.maven.plugins</groupId>
<artifactId>liferay-maven-plugin</artifactId>
<version>${liferay.maven.plugin.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>build-css</goal>
</goals>
</execution>
</executions>
<configuration>
<autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
<appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir>
<appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir>
<appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir>
<liferayVersion>${liferay.version}</liferayVersion>
<pluginType>portlet</pluginType>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- SA Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>servicearchive</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common.portal</groupId>
<artifactId>portal-manager</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-scope-maps</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-client</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>portal-service</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>util-bridges</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>util-taglib</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.liferay.portal</groupId>
<artifactId>util-java</artifactId>
<version>${liferay.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.portlet</groupId>
<artifactId>portlet-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>Liferay-v6.2-CE-(Tomcat-7)</id>
<properties>
<liferay.version>6.2.5</liferay.version>
<liferay.maven.plugin.version>6.2.10.12</liferay.maven.plugin.version>
<liferay.auto.deploy.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/deploy</liferay.auto.deploy.dir>
<liferay.app.server.deploy.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps</liferay.app.server.deploy.dir>
<liferay.app.server.lib.global.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/lib/ext</liferay.app.server.lib.global.dir>
<liferay.app.server.portal.dir>/Users/massi/portal/liferay-portal-6.2-ce-ga6/tomcat-7.0.62/webapps/ROOT</liferay.app.server.portal.dir>
</properties>
</profile>
</profiles>
</project>

@ -0,0 +1,39 @@
package org.gcube.portlets.user.vreappintegration;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.PortletPreferences;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.portlet.DefaultConfigurationAction;
public class VREAppConfigurationAction extends DefaultConfigurationAction {
private static Log _log = LogFactoryUtil.getLog(VREAppConfigurationAction.class);
@Override
public void processAction(
PortletConfig portletConfig, ActionRequest actionRequest,
ActionResponse actionResponse) throws Exception {
super.processAction(portletConfig, actionRequest, actionResponse);
PortletPreferences prefs = actionRequest.getPreferences();
String appURL = prefs.getValue("appURL", "true");
String appURLTokenParam = prefs.getValue("appURLTokenParam", "true");
_log.debug("appURL = " + appURL + " in PublicWebappConfigurationAction.processAction().");
_log.debug("appURLTokenParam = " + appURLTokenParam + " in PublicWebappConfigurationAction.processAction().");
}
@Override
public String render(PortletConfig portletConfig,
RenderRequest renderRequest, RenderResponse renderResponse)
throws Exception {
return "/html/vreappintegration/config.jsp";
}
}

@ -0,0 +1,104 @@
package org.gcube.portlets.user.vreappintegration;
import static org.gcube.common.authorization.client.Constants.authorizationService;
import java.io.IOException;
import javax.portlet.GenericPortlet;
import javax.portlet.PortletException;
import javax.portlet.PortletRequestDispatcher;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portal.util.PortalUtil;
/**
* Portlet implementation class VREAppIntegration
*/
public class VREAppIntegration extends GenericPortlet {
private static Log _log = LogFactoryUtil.getLog(VREAppIntegration.class);
public void doView(RenderRequest request, RenderResponse response)throws PortletException, IOException {
response.setContentType("text/html");
String username = getCurrentUsername(request);
String context = getCurrentContext(request);
String token = getCurrentUserToken(context, username);
_log.debug("VREAppIntegration doView " + username + " - " + context);
if (token != null){
request.setAttribute("securityToken", token);
}
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher("/html/vreappintegration/view.jsp");
dispatcher.include(request, response);
}
private static String getCurrentUsername(RenderRequest request) {
long userId;
try {
userId = PortalUtil.getUser(request).getUserId();
return UserLocalServiceUtil.getUser(userId).getScreenName();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static String getCurrentContext(RenderRequest request) {
long groupId = -1;
try {
groupId = PortalUtil.getScopeGroupId(request);
return getCurrentContext(groupId);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private static String getCurrentContext(long groupId) {
try {
PortalContext pContext = PortalContext.getConfiguration();
return pContext.getCurrentScope(""+groupId);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* <p>
* Returns the gCube authorisation token for the given user
* </p>
* @param scope infrastrucure context (scope)
* @param username the GCubeUser username @see {@link GCubeUser}
* @return the Token for the user in the context, or <code>null</code> if a token for this user could not be found
*/
private static String getCurrentUserToken(String context, String username) {
String userToken = null;
try {
ScopeProvider.instance.set(context);
userToken = authorizationService().resolveTokenByUserAndContext(username, context);
SecurityTokenProvider.instance.set(userToken);
}
catch (Exception e) {
_log.error("Error while trying to generate token for user " + username + "in scope " + context);
e.printStackTrace();
return null;
}
return userToken;
}
}

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!DOCTYPE display PUBLIC "-//Liferay//DTD Display 6.2.0//EN" "http://www.liferay.com/dtd/liferay-display_6_2_0.dtd">
<display>
<category name="gCube Applications">
<portlet id="vre-app-integration"></portlet>
</category>
</display>

@ -0,0 +1,9 @@
name=VREApp-Integration-portlet
module-group-id=liferay
module-incremental-version=1
tags=
short-description=
change-log=
page-url=http://www.liferay.com
author=M.Assante
licenses=EUPL

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!DOCTYPE liferay-portlet-app PUBLIC "-//Liferay//DTD Portlet Application 6.2.0//EN" "http://www.liferay.com/dtd/liferay-portlet-app_6_2_0.dtd">
<liferay-portlet-app>
<portlet>
<portlet-name>vre-app-integration</portlet-name>
<icon>/icon.png</icon>
<configuration-action-class>org.gcube.portlets.user.vreappintegration.VREAppConfigurationAction</configuration-action-class>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>
/js/main.js
</footer-portlet-javascript>
<css-class-wrapper>
vre-app-integration-portlet
</css-class-wrapper>
</portlet>
<role-mapper>
<role-name>administrator</role-name>
<role-link>Administrator</role-link>
</role-mapper>
<role-mapper>
<role-name>guest</role-name>
<role-link>Guest</role-link>
</role-mapper>
<role-mapper>
<role-name>power-user</role-name>
<role-link>Power User</role-link>
</role-mapper>
<role-mapper>
<role-name>user</role-name>
<role-link>User</role-link>
</role-mapper>
</liferay-portlet-app>

@ -0,0 +1,47 @@
<?xml version="1.0"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" version="2.0">
<portlet>
<portlet-name>vre-app-integration</portlet-name>
<display-name>Vre App Integration</display-name>
<portlet-class>
org.gcube.portlets.user.vreappintegration.VREAppIntegration
</portlet-class>
<init-param>
<name>config-template</name>
<value>/html/vreappintegration/config.jsp</value>
</init-param>
<init-param>
<name>view-template</name>
<value>/html/vreappintegration/view.jsp</value>
</init-param>
<expiration-cache>0</expiration-cache>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<portlet-info>
<title>Vre App Integration</title>
<short-title>Vre App Integration</short-title>
<keywords></keywords>
</portlet-info>
<portlet-preferences>
<preference>
<name>portletSetupShowBorders</name>
<value>false</value>
</preference>
</portlet-preferences>
<security-role-ref>
<role-name>administrator</role-name>
</security-role-ref>
<security-role-ref>
<role-name>guest</role-name>
</security-role-ref>
<security-role-ref>
<role-name>power-user</role-name>
</security-role-ref>
<security-role-ref>
<role-name>user</role-name>
</security-role-ref>
</portlet>
</portlet-app>

@ -0,0 +1,4 @@
<?xml version="1.0"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
</web-app>

@ -0,0 +1,15 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@ page import="com.liferay.portal.kernel.util.Constants" %>
<%@ page import="com.liferay.portal.kernel.util.GetterUtil" %>
<%@ page import="com.liferay.portal.kernel.util.StringPool" %>
<%@ page import="com.liferay.portal.util.PortalUtil" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<liferay-theme:defineObjects />
<portlet:defineObjects />

@ -0,0 +1,64 @@
<%@include file="/html/init.jsp" %>
<liferay-portlet:actionURL portletConfiguration="true" var="configurationURL" />
<%
String appURL_cfg = GetterUtil.getString(portletPreferences.getValue("appURL", StringPool.BLANK));
String appURLTokenParam_cfg = GetterUtil.getString(portletPreferences.getValue("appURLTokenParam", StringPool.BLANK));
Integer iFrameHeightParam_cfg = GetterUtil.getInteger(portletPreferences.getValue("iFrameHeightParam", "1000"));
%>
<aui:form action="<%= configurationURL %>" method="post" name="fm">
<aui:input name="<%= Constants.CMD %>" type="hidden" value="<%= Constants.UPDATE %>" />
<!-- Application URL -->
<aui:field-wrapper cssClass="field-group">
<aui:input style="width: 100%;"
name="preferences--appURL--"
type="text"
cssClass="text long-field"
showRequiredLabel="true"
label="Application URL"
inlineField="true"
inlineLabel="left"
placeholder="Application URL"
helpMessage="Actual endpoint of the external web-application (must start with https://)"
value="<%= appURL_cfg %>"
required="true" />
</aui:field-wrapper>
<!-- Application URL Parameter name -->
<aui:field-wrapper cssClass="field-group">
<aui:input
type="text"
name="preferences--appURLTokenParam--"
cssClass="text medium-field"
label="Application URL Parameter name"
inlineField="true"
inlineLabel="left"
placeholder="Parameter name"
helpMessage="Name of the Parameter (e.g gcube-token) expected by the web-application in the URL"
value="<%= appURLTokenParam_cfg %>"/>
</aui:field-wrapper>
<!-- Application URL Parameter name -->
<aui:field-wrapper cssClass="field-group">
<aui:input
type="text"
name="preferences--iFrameHeightParam--"
cssClass="text medium-field"
label="iFrame height as integer in pixels"
inlineField="true"
inlineLabel="left"
placeholder="in Pixels"
helpMessage="Enter the height in pixels of the iFrame Height (default 1000)"
value="<%= iFrameHeightParam_cfg %>"/>
</aui:field-wrapper>
<aui:button-row>
<aui:button type="submit" />
</aui:button-row>
</aui:form>

@ -0,0 +1,54 @@
<%@include file="/html/init.jsp" %>
<!-- Inherit Generic public web-app portlet configuration parameters -->
<%
String appURL_view = GetterUtil.getString(portletPreferences.getValue("appURL", StringPool.BLANK));
String appURLTokenParam_view = GetterUtil.getString(portletPreferences.getValue("appURLTokenParam", StringPool.BLANK));
Integer iFrameHeight = GetterUtil.getInteger(portletPreferences.getValue("iFrameHeightParam", "1000"));
pageContext.setAttribute("iFrameHeight", iFrameHeight);
Object securityTokenObj = request.getAttribute("securityToken");
String securityToken = "";
if(securityToken != null){
securityToken = securityTokenObj.toString();
}
/* handle the case where the page is called with GET parameters needing to be forwarded*/
String completeURL = PortalUtil.getCurrentCompleteURL(request);
String queryString = "";
if (completeURL.indexOf("?") > 0) {
queryString = completeURL.substring(completeURL.indexOf("?")+1);
queryString = queryString.trim();
}
/* handle the case where the appURL provided has GET parameters needing to be forwarded*/
if (appURL_view.indexOf("?") > 0) {
if (queryString != null && !queryString.equals("")) { //not empty
queryString += "&" + appURL_view.substring(appURL_view.indexOf("?")+1);
} else {
queryString = appURL_view.substring(appURL_view.indexOf("?")+1);
}
appURL_view = appURL_view.substring(0, appURL_view.indexOf("?"));
queryString = queryString.trim();
}
String applicationURL = appURL_view;
if (! appURLTokenParam_view.equals("")) {
applicationURL += "?" + appURLTokenParam_view + "=" + securityToken;
if (queryString != null && !queryString.equals("")) {
applicationURL += "&" + queryString;
}
} else {
if (queryString != null && !queryString.equals("")) {
applicationURL += "?" + queryString;
}
}
pageContext.setAttribute("applicationURL", applicationURL);
%>
<iframe id="iFrameProxy" src="${applicationURL}" width="100%" marginwidth="0"
marginheight="0" frameborder="0" height="${iFrameHeight}" style="overflow-x: hidden;"> </iframe>

Binary file not shown.

After

Width:  |  Height:  |  Size: 467 B

@ -0,0 +1,21 @@
<%--
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<portlet:defineObjects />
This is the <b>VREApp-Integration-portlet</b>.
Loading…
Cancel
Save