git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/portal-auth-library@167859 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
43cc407081
commit
021e6339bb
|
@ -18,7 +18,7 @@
|
|||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.m2e.wtp.enabledProjectSpecificPrefs=false
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="java" version="1.7"/>
|
||||
</faceted-project>
|
||||
|
|
221
pom.xml
221
pom.xml
|
@ -10,7 +10,7 @@
|
|||
|
||||
<groupId>org.gcube.portal.auth</groupId>
|
||||
<artifactId>portal-auth-library</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<version>1.0.1-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>portal-auth-library</name>
|
||||
|
@ -46,16 +46,6 @@
|
|||
<groupId>org.gcube.resources.discovery</groupId>
|
||||
<artifactId>ic-client</artifactId>
|
||||
</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>org.gcube.common.portal</groupId>
|
||||
<artifactId>portal-manager</artifactId>
|
||||
|
@ -64,11 +54,18 @@
|
|||
<dependency>
|
||||
<groupId>org.gcube.dvos</groupId>
|
||||
<artifactId>usermanagement-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.resources</groupId>
|
||||
<artifactId>common-gcore-resources</artifactId>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>authorization-client</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.gcube.common</groupId>
|
||||
<artifactId>common-authorization</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -76,6 +73,11 @@
|
|||
<artifactId>portlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.liferay.portal</groupId>
|
||||
<artifactId>portal-service</artifactId>
|
||||
|
@ -98,10 +100,6 @@
|
|||
<version>${liferay.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
|
@ -110,12 +108,6 @@
|
|||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
|
@ -131,8 +123,8 @@
|
|||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
@ -212,3 +204,180 @@
|
|||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
|
||||
<!-- <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> -->
|
||||
<!-- <dependencies> -->
|
||||
|
||||
<!-- <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>org.gcube.dvos</groupId> -->
|
||||
<!-- <artifactId>usermanagement-core</artifactId> -->
|
||||
<!-- <scope>provided</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.gcube.resources</groupId> -->
|
||||
<!-- <artifactId>common-gcore-resources</artifactId> -->
|
||||
<!-- <scope>provided</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>javax.portlet</groupId> -->
|
||||
<!-- <artifactId>portlet-api</artifactId> -->
|
||||
<!-- <scope>provided</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>com.liferay.portal</groupId> -->
|
||||
<!-- <artifactId>portal-service</artifactId> -->
|
||||
<!-- <scope>provided</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>com.liferay.portal</groupId> -->
|
||||
<!-- <artifactId>util-java</artifactId> -->
|
||||
<!-- <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>log4j</groupId> -->
|
||||
<!-- <artifactId>log4j</artifactId> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.slf4j</groupId> -->
|
||||
<!-- <artifactId>slf4j-log4j12</artifactId> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>org.slf4j</groupId> -->
|
||||
<!-- <artifactId>slf4j-api</artifactId> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- <dependency> -->
|
||||
<!-- <groupId>junit</groupId> -->
|
||||
<!-- <artifactId>junit</artifactId> -->
|
||||
<!-- <version>3.8.1</version> -->
|
||||
<!-- <scope>test</scope> -->
|
||||
<!-- </dependency> -->
|
||||
<!-- </dependencies> -->
|
||||
<!-- <build> -->
|
||||
<!-- <resources> -->
|
||||
<!-- <resource> -->
|
||||
<!-- <directory>src/main/java</directory> -->
|
||||
<!-- <includes> -->
|
||||
<!-- <include>**/*.*</include> -->
|
||||
<!-- </includes> -->
|
||||
<!-- </resource> -->
|
||||
<!-- </resources> -->
|
||||
<!-- <plugins> -->
|
||||
<!-- <plugin> -->
|
||||
<!-- <artifactId>maven-compiler-plugin</artifactId> -->
|
||||
<!-- <version>3.0</version> -->
|
||||
<!-- <configuration> -->
|
||||
<!-- <source>1.8</source> -->
|
||||
<!-- <target>1.8</target> -->
|
||||
<!-- </configuration> -->
|
||||
<!-- </plugin> -->
|
||||
|
||||
<!-- <plugin> -->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId> -->
|
||||
<!-- <artifactId>maven-jar-plugin</artifactId> -->
|
||||
<!-- <version>2.2</version> -->
|
||||
<!-- <executions> -->
|
||||
<!-- <execution> -->
|
||||
<!-- <goals> -->
|
||||
<!-- <goal>test-jar</goal> -->
|
||||
<!-- </goals> -->
|
||||
<!-- </execution> -->
|
||||
<!-- </executions> -->
|
||||
<!-- </plugin> -->
|
||||
|
||||
<!-- <plugin> -->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId> -->
|
||||
<!-- <artifactId>maven-surefire-plugin</artifactId> -->
|
||||
<!-- <version>2.12</version> -->
|
||||
<!-- <configuration> -->
|
||||
<!-- <skipTests>true</skipTests> -->
|
||||
<!-- </configuration> -->
|
||||
<!-- </plugin> -->
|
||||
<!-- <plugin> -->
|
||||
<!-- <groupId>org.apache.maven.plugins</groupId> -->
|
||||
<!-- <artifactId>maven-resources-plugin</artifactId> -->
|
||||
<!-- <version>2.5</version> -->
|
||||
<!-- <executions> -->
|
||||
<!-- <execution> -->
|
||||
<!-- <id>copy-profile</id> -->
|
||||
<!-- <phase>install</phase> -->
|
||||
<!-- <goals> -->
|
||||
<!-- <goal>copy-resources</goal> -->
|
||||
<!-- </goals> -->
|
||||
<!-- <configuration> -->
|
||||
<!-- <outputDirectory>target</outputDirectory> -->
|
||||
<!-- <resources> -->
|
||||
<!-- <resource> -->
|
||||
<!-- <directory>${distroDirectory}</directory> -->
|
||||
<!-- <filtering>true</filtering> -->
|
||||
<!-- <includes> -->
|
||||
<!-- <include>profile.xml</include> -->
|
||||
<!-- </includes> -->
|
||||
<!-- </resource> -->
|
||||
<!-- </resources> -->
|
||||
<!-- </configuration> -->
|
||||
<!-- </execution> -->
|
||||
<!-- </executions> -->
|
||||
<!-- </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> -->
|
||||
<!-- <archive> -->
|
||||
<!-- <manifest> -->
|
||||
<!-- <mainClass>fully.qualified.MainClass</mainClass> -->
|
||||
<!-- </manifest> -->
|
||||
<!-- </archive> -->
|
||||
<!-- </configuration> -->
|
||||
<!-- <executions> -->
|
||||
<!-- <execution> -->
|
||||
<!-- <id>servicearchive</id> -->
|
||||
<!-- <phase>install</phase> -->
|
||||
<!-- <goals> -->
|
||||
<!-- <goal>single</goal> -->
|
||||
<!-- </goals> -->
|
||||
<!-- </execution> -->
|
||||
<!-- </executions> -->
|
||||
<!-- </plugin> -->
|
||||
<!-- </plugins> -->
|
||||
<!-- </build> -->
|
||||
|
||||
<!-- </project> -->
|
||||
|
|
|
@ -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<String> authorisedRedirectURLs = AuthUtil.getAuthorisedRedirectURLsFromIs(authorisedApp);
|
||||
//
|
||||
// for (String red : authorisedRedirectURLs) {
|
||||
System.out.println("");
|
||||
List<GCoreEndpoint> 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<GCoreEndpoint> 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<GCoreEndpoint> client = clientFor(GCoreEndpoint.class);
|
||||
List<GCoreEndpoint> toReturn = client.submit(query);
|
||||
ScopeProvider.instance.set(currScope);
|
||||
return toReturn;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue