From 85fe7bdcd9446b82b7457d780e5e77516547623b Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 19 Sep 2016 08:37:56 +0000 Subject: [PATCH] Updated to Auth 2.0 git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@131467 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/SessionUtil.java | 26 +++---------------- .../shared/Constants.java | 18 ++++++------- 2 files changed, 13 insertions(+), 31 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/SessionUtil.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/SessionUtil.java index 2e509ce..527d0ba 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/SessionUtil.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/SessionUtil.java @@ -3,17 +3,13 @@ */ package org.gcube.portlets.user.statisticalalgorithmsimporter.server; -import static org.gcube.common.authorization.client.Constants.authorizationService; - import java.util.ArrayList; -import java.util.List; import javax.servlet.ServletContext; import javax.servlet.http.HttpSession; import org.gcube.application.framework.core.session.ASLSession; import org.gcube.application.framework.core.session.SessionManager; -import org.gcube.common.authorization.library.provider.UserInfo; import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeFileUploadSession; import org.gcube.portlets.user.statisticalalgorithmsimporter.server.social.Recipient; @@ -74,24 +70,7 @@ public class SessionUtil { throws StatAlgoImporterServiceException { String token = null; if (Constants.DEBUG_MODE) { - List userRoles = new ArrayList<>(); - userRoles.add(Constants.DEFAULT_ROLE); - /* - * if (aslSession.getUsername().compareTo("lucio.lelii") == 0) - * userRoles.add("VRE-Manager"); - */ - try { - token = authorizationService().generateUserToken( - new UserInfo(aslSession.getUsername(), userRoles), - aslSession.getScope()); - } catch (Exception e) { - logger.error("Error generating the token for test: " - + e.getLocalizedMessage()); - e.printStackTrace(); - throw new StatAlgoImporterServiceException("Error generating the token for test: " - + e.getLocalizedMessage()); - } - + token = Constants.DEFAULT_TOKEN; } else { token = aslSession.getSecurityToken(); } @@ -100,6 +79,9 @@ public class SessionUtil { } + + + // public static ArrayList getRecipients( ServletContext servletContest) { diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java index 51799e8..3e3b707 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/Constants.java @@ -2,8 +2,8 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared; /** * - * @author giancarlo - * email: g.panichi@isti.cnr.it + * @author giancarlo email: g.panichi@isti.cnr.it * */ public class Constants { @@ -13,16 +13,16 @@ public class Constants { public static final String APPLICATION_ID = "org.gcube.portlets.user.statisticalalgorithmsimporter.server.portlet.StatAlgoImporterPortlet"; public static final String STATISTICAL_ALGORITHMS_IMPORTER_ID = "SAIId"; - public static final String STATISTICAL_ALGORITHMS_IMPORTER_COOKIE = "SAILangCookie"; + public static final String STATISTICAL_ALGORITHMS_IMPORTER_COOKIE = "SAILangCookie"; public static final String STATISTICAL_ALGORITHMS_IMPORTER_LANG = "SAILang"; - public final static String DEFAULT_USER = "giancarlo.panichi"; - public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE"; + + public static final String DEFAULT_USER = "giancarlo.panichi"; + public final static String DEFAULT_SCOPE = "/gcube/devNext"; + public final static String DEFAULT_TOKEN = "16e65d4f-11e0-4e4a-84b9-351688fccc12-98187548"; public static final String DEFAULT_ROLE = "OrganizationMember"; - - + public static final String FILE_UPLOADED_FIELD = "FileUploadedField"; public static final String STATISTICAL_ALGORITHMS_IMPORTER_JAR_PUBLIC_LINK = "JarPublicLink"; public static final String RECIPIENTS = "Recipients"; - - + }