Initial import.

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/portal-auth-library@141714 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2017-01-23 17:03:49 +00:00
parent c9152965b4
commit 6855acb1a9
3 changed files with 42 additions and 33 deletions

View File

@ -45,14 +45,22 @@
<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>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.dvos</groupId>
<artifactId>usermanagement-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.gcube.resources.discovery</groupId>

View File

@ -3,7 +3,6 @@ import static org.gcube.resources.discovery.icclient.ICFactory.clientFor;
import static org.gcube.resources.discovery.icclient.ICFactory.queryFor;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -14,10 +13,8 @@ import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.resources.gcore.ServiceEndpoint.Property;
import org.gcube.common.resources.gcore.utils.Group;
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -31,12 +28,12 @@ import org.slf4j.LoggerFactory;
*/
public class AuthUtil {
private static final Logger _log = LoggerFactory.getLogger(AuthUtil.class);
final String REDIRECT_URL = "RedirectURL";
final String SERVICE_ENDPOINT_CATEGORY = "OnlineService";
final String LOGOURL_ATTR = "Logo";
public List<ServiceEndpoint> getPortalConfigurationFromIS(String infrastructureName, String clientId)
public final static String REDIRECT_URL = "RedirectURL";
public final static String SERVICE_ENDPOINT_CATEGORY = "OnlineService";
public final static String LOGOURL_ATTR = "Logo";
public static List<ServiceEndpoint> getPortalConfigurationFromIS(String infrastructureName, String clientId)
throws Exception {
String scope = "/" + infrastructureName;
String currScope = ScopeProvider.instance.get();
@ -55,11 +52,11 @@ public class AuthUtil {
* @param clientId
* @return a <code>RequestingApp</code> contanining the application name, the description and the application logo URL if any, or null if non existent
*/
private RequestingApp getAuthorisedApplicationInfoFromIs(String clientId) {
public static RequestingApp getAuthorisedApplicationInfoFromIs(String clientId) {
RequestingApp toReturn = new RequestingApp();
String infraName = PortalContext.getConfiguration().getInfrastructureName();
System.out.println("infraName="+infraName);
try {
List<ServiceEndpoint> list = getPortalConfigurationFromIS(infraName, clientId);
if (list.size() > 1) {

View File

@ -8,29 +8,33 @@ 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 );
}
/**
* 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 );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
/**
* Rigourous Test :-)
*/
public void testApp() {
RequestingApp app = AuthUtil.getAuthorisedApplicationInfoFromIs("AnAppRequiringUserAuthN");
if (app != null) {
System.out.println(app.getApplicationId());
System.out.println(app.getLogoURL());
}
//assertTrue( true );
}
}