From 021e6339bb12b38b61df2265c6b105c2db19ae73 Mon Sep 17 00:00:00 2001 From: Massimiliano Assante Date: Mon, 4 Jun 2018 10:48:19 +0000 Subject: [PATCH] git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/portal-auth-library@167859 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 2 +- .settings/org.eclipse.jdt.core.prefs | 6 +- .settings/org.eclipse.m2e.wtp.prefs | 2 - ....eclipse.wst.common.project.facet.core.xml | 2 +- pom.xml | 221 +++++++++++++++--- .../java/org/gcube/portal/auth/AppTest.java | 92 -------- 6 files changed, 200 insertions(+), 125 deletions(-) delete mode 100644 .settings/org.eclipse.m2e.wtp.prefs delete mode 100644 src/test/java/org/gcube/portal/auth/AppTest.java diff --git a/.classpath b/.classpath index 48cd9e1..b96f5b8 100644 --- a/.classpath +++ b/.classpath @@ -18,7 +18,7 @@ - + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 6e80039..443e085 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +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.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 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 +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/.settings/org.eclipse.m2e.wtp.prefs b/.settings/org.eclipse.m2e.wtp.prefs deleted file mode 100644 index ef86089..0000000 --- a/.settings/org.eclipse.m2e.wtp.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index f4bf050..4f92af5 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,5 +1,5 @@ - + diff --git a/pom.xml b/pom.xml index 3639134..8e284e1 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.gcube.portal.auth portal-auth-library - 1.0.1 + 1.0.1-SNAPSHOT jar portal-auth-library @@ -46,16 +46,6 @@ org.gcube.resources.discovery ic-client - - org.gcube.common - authorization-client - provided - - - org.gcube.common - common-authorization - provided - org.gcube.common.portal portal-manager @@ -64,11 +54,18 @@ org.gcube.dvos usermanagement-core - provided - org.gcube.resources - common-gcore-resources + org.gcube.common + authorization-client + + + org.gcube.common + common-authorization + + + javax.servlet + javax.servlet-api provided @@ -76,6 +73,11 @@ portlet-api provided + + com.sun.mail + javax.mail + provided + com.liferay.portal portal-service @@ -98,10 +100,6 @@ ${liferay.version} provided - - log4j - log4j - org.slf4j slf4j-log4j12 @@ -110,12 +108,6 @@ org.slf4j slf4j-api - - junit - junit - 3.8.1 - test - @@ -131,8 +123,8 @@ maven-compiler-plugin 3.0 - 1.8 - 1.8 + 1.7 + 1.7 @@ -212,3 +204,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/java/org/gcube/portal/auth/AppTest.java b/src/test/java/org/gcube/portal/auth/AppTest.java deleted file mode 100644 index f48a8f1..0000000 --- a/src/test/java/org/gcube/portal/auth/AppTest.java +++ /dev/null @@ -1,92 +0,0 @@ -package org.gcube.portal.auth; - -import static org.gcube.resources.discovery.icclient.ICFactory.clientFor; -import static org.gcube.resources.discovery.icclient.ICFactory.queryFor; - -import java.util.List; - -import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.client.LaxRedirectStrategy; -import org.gcube.common.portal.PortalContext; -import org.gcube.common.resources.gcore.GCoreEndpoint; -import org.gcube.common.resources.gcore.ServiceEndpoint; -import org.gcube.common.scope.api.ScopeProvider; -import org.gcube.resources.discovery.client.api.DiscoveryClient; -import org.gcube.resources.discovery.client.queries.api.SimpleQuery; - -import com.liferay.portal.kernel.json.JSONObject; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest extends TestCase { - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() { - System.out.println("getAuthorisedRedirectURLsFromIs ... "); - try { - // ServiceEndpoint authorisedApp = AuthUtil.getAuthorisedApplicationInfoFromIsICClient(PortalContext.getConfiguration().getInfrastructureName(), "c96d4477-236c-4f98-ba7d-7897991ef412"); - // List authorisedRedirectURLs = AuthUtil.getAuthorisedRedirectURLsFromIs(authorisedApp); - // - // for (String red : authorisedRedirectURLs) { - System.out.println(""); - List endpoints = getRStudioServiceEndpoints("/d4science.research-infrastructures.eu/D4Research/ICES_MSY"); - for (GCoreEndpoint gCoreEndpoint : endpoints) { - System.out.println(gCoreEndpoint); - } - String oauthendPoint = AuthUtil.getOAuthServiceEndPoint(PortalContext.getConfiguration().getInfrastructureName()); - System.out.println(oauthendPoint); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - private static final String SERVICE_NAME = "RConnector"; - private static final String SERVICECLASS = "DataAnalysis"; - /** - * - * @return the - * @throws Exception - */ - private List getRStudioServiceEndpoints(String scope) throws Exception { - String currScope = ScopeProvider.instance.get(); - ScopeProvider.instance.set(scope); - SimpleQuery query = queryFor(GCoreEndpoint.class); - query.addCondition("$resource/Profile/ServiceName/text() eq '"+ SERVICE_NAME +"'"); - query.addCondition("$resource/Profile/ServiceClass/text() eq '"+ SERVICECLASS +"'"); - DiscoveryClient client = clientFor(GCoreEndpoint.class); - List toReturn = client.submit(query); - ScopeProvider.instance.set(currScope); - return toReturn; - - } -} -