git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/admin/auth-portlet-manager@134238 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d6f4bf8aec
commit
32c7ea5ac6
30
pom.xml
30
pom.xml
|
@ -115,14 +115,24 @@
|
||||||
<!-- <version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version> -->
|
<!-- <version>[1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)</version> -->
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 1.1 remove aslcore -->
|
||||||
|
<!-- <dependency> <groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
|
<artifactId>aslcore</artifactId> </dependency> <dependency> <groupId>org.gcube.portal</groupId>
|
||||||
|
<artifactId>custom-portal-handler</artifactId> </dependency> -->
|
||||||
|
<!-- asl core replace with -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portal</groupId>
|
<groupId>org.gcube.common.portal</groupId>
|
||||||
<artifactId>custom-portal-handler</artifactId>
|
<artifactId>portal-manager</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.dvos</groupId>
|
||||||
<artifactId>aslcore</artifactId>
|
<artifactId>usermanagement-core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--end asl core replace with -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.applicationsupportlayer</groupId>
|
<groupId>org.gcube.applicationsupportlayer</groupId>
|
||||||
<artifactId>accesslogger</artifactId>
|
<artifactId>accesslogger</artifactId>
|
||||||
|
@ -149,11 +159,7 @@
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.gcube.dvos</groupId>
|
|
||||||
<artifactId>usermanagement-core</artifactId>
|
|
||||||
<!-- <version>2.0.0-SNAPSHOT</version> -->
|
|
||||||
</dependency>
|
|
||||||
<!-- JUnit TEST -->
|
<!-- JUnit TEST -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
|
@ -176,7 +182,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.liferay.portal</groupId>
|
<groupId>com.liferay.portal</groupId>
|
||||||
<artifactId>portal-service</artifactId>
|
<artifactId>portal-service</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -200,13 +206,15 @@
|
||||||
<version>${gwtVersion}</version>
|
<version>${gwtVersion}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
|
<!--
|
||||||
<configuration>
|
<configuration>
|
||||||
<extraJvmArgs>-Xmx1024M -Xss1024k -Dgwt.compiler.localWorkers=1</extraJvmArgs>
|
<extraJvmArgs>-Xmx1024M -Xss1024k -Dgwt.compiler.localWorkers=1</extraJvmArgs>
|
||||||
<superDevMode>false</superDevMode>
|
<superDevMode>false</superDevMode>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
-->
|
||||||
<goals>
|
<goals>
|
||||||
<goal>compile</goal>
|
<goal>compile</goal>
|
||||||
<goal>test</goal>
|
<!-- <goal>test</goal> -->
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
package org.gcube.portlets.admin.authportletmanager.client;
|
package org.gcube.portlets.admin.authportletmanager.client;
|
||||||
import org.gcube.portlets.user.gcubewidgets.client.ClientScopeHelper;
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.EntryPoint;
|
import com.google.gwt.core.client.EntryPoint;
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.core.client.Scheduler;
|
import com.google.gwt.core.client.Scheduler;
|
||||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
import com.google.gwt.user.client.Window.Location;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -26,31 +22,13 @@ public class AuthManager implements EntryPoint {
|
||||||
GWT.log("AuthManager - Start Portlet");
|
GWT.log("AuthManager - Start Portlet");
|
||||||
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
public void execute() {
|
public void execute() {
|
||||||
loadScope();
|
loadController();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
private void loadScope() {
|
|
||||||
ClientScopeHelper.getService().setScope(Location.getHref(),
|
|
||||||
new AsyncCallback<Boolean>() {
|
|
||||||
@Override
|
|
||||||
public void onSuccess(Boolean result) {
|
|
||||||
GWT.log("AuthManager - Scope Location set!");
|
|
||||||
if (result) {
|
|
||||||
loadController();
|
|
||||||
} else {
|
|
||||||
GWT.log("AuthManager - Attention ClientScopeHelper has returned a false value!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
GWT.log("AuthManager - Error setting scope: "
|
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
caught.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void loadController() {
|
protected void loadController() {
|
||||||
rootPanel = new AuthManagerController();
|
rootPanel = new AuthManagerController();
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.gcube.portlets.admin.authportletmanager.shared.ConstantsSharing;
|
||||||
import org.gcube.portlets.admin.authportletmanager.shared.PolicyAuth;
|
import org.gcube.portlets.admin.authportletmanager.shared.PolicyAuth;
|
||||||
import org.gcube.portlets.admin.authportletmanager.shared.Quote;
|
import org.gcube.portlets.admin.authportletmanager.shared.Quote;
|
||||||
import org.gcube.portlets.admin.authportletmanager.shared.exceptions.ExpiredSessionServiceException;
|
import org.gcube.portlets.admin.authportletmanager.shared.exceptions.ExpiredSessionServiceException;
|
||||||
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
|
|
||||||
|
|
||||||
import com.github.gwtbootstrap.client.ui.Container;
|
import com.github.gwtbootstrap.client.ui.Container;
|
||||||
import com.github.gwtbootstrap.client.ui.Tab;
|
import com.github.gwtbootstrap.client.ui.Tab;
|
||||||
|
@ -45,7 +44,6 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
import com.google.gwt.event.shared.EventBus;
|
import com.google.gwt.event.shared.EventBus;
|
||||||
import com.google.gwt.event.shared.SimpleEventBus;
|
import com.google.gwt.event.shared.SimpleEventBus;
|
||||||
import com.google.gwt.user.client.Cookies;
|
import com.google.gwt.user.client.Cookies;
|
||||||
import com.google.gwt.user.client.Timer;
|
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.google.gwt.user.client.ui.DockPanel;
|
import com.google.gwt.user.client.ui.DockPanel;
|
||||||
import com.google.gwt.user.client.ui.RootPanel;
|
import com.google.gwt.user.client.ui.RootPanel;
|
||||||
|
@ -106,15 +104,6 @@ public class AuthManagerController {
|
||||||
bindToEvents();
|
bindToEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private void checkSession() {
|
|
||||||
// if you do not need to something when the session expire
|
|
||||||
CheckSession.getInstance().startPolling();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sessionExpiredShow() {
|
|
||||||
CheckSession.showLogoutDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the eventBus
|
* @return the eventBus
|
||||||
|
@ -237,7 +226,7 @@ public class AuthManagerController {
|
||||||
|
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -269,7 +258,7 @@ public class AuthManagerController {
|
||||||
|
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
|
@ -302,7 +291,7 @@ public class AuthManagerController {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
|
@ -332,7 +321,7 @@ public class AuthManagerController {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -360,7 +349,7 @@ public class AuthManagerController {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -395,7 +384,7 @@ public class AuthManagerController {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -433,18 +422,7 @@ public class AuthManagerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sessionExpiredShowDelayed() {
|
|
||||||
Timer timeoutTimer = new Timer() {
|
|
||||||
public void run() {
|
|
||||||
sessionExpiredShow();
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
int TIMEOUT = 3; // 3 second timeout
|
|
||||||
|
|
||||||
timeoutTimer.schedule(TIMEOUT * 1000); // timeout is in milliseconds
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void changeLanguage(String localeName) {
|
protected void changeLanguage(String localeName) {
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
|
@ -585,7 +563,7 @@ public class AuthManagerController {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -615,7 +593,7 @@ public class AuthManagerController {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -655,7 +633,7 @@ public class AuthManagerController {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
|
@ -695,7 +673,7 @@ public class AuthManagerController {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -727,7 +705,7 @@ public class AuthManagerController {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -758,7 +736,7 @@ public class AuthManagerController {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof ExpiredSessionServiceException) {
|
if (caught instanceof ExpiredSessionServiceException) {
|
||||||
GWT.log("AuthManager - Alert Expired Session");
|
GWT.log("AuthManager - Alert Expired Session");
|
||||||
sessionExpiredShowDelayed();
|
//sessionExpiredShowDelayed();
|
||||||
} else {
|
} else {
|
||||||
dialogLoader.stopLoader();
|
dialogLoader.stopLoader();
|
||||||
dialogError.showError(caught.getLocalizedMessage());
|
dialogError.showError(caught.getLocalizedMessage());
|
||||||
|
@ -780,24 +758,4 @@ public class AuthManagerController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private void asyncCodeLoadingFailed(Throwable reason) {
|
|
||||||
//Log.error("Async code loading failed", reason);
|
|
||||||
/*
|
|
||||||
eventBus.fireEvent(new SessionExpiredEvent(
|
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
import org.gcube.common.authorization.client.exceptions.ObjectNotFound;
|
||||||
import org.gcube.common.authorization.library.policies.Action;
|
import org.gcube.common.authorization.library.policies.Action;
|
||||||
import org.gcube.common.authorization.library.policies.Policy;
|
import org.gcube.common.authorization.library.policies.Policy;
|
||||||
|
@ -29,6 +29,7 @@ import org.gcube.common.authorization.library.policies.User2ServicePolicy;
|
||||||
import org.gcube.common.authorization.library.policies.Users;
|
import org.gcube.common.authorization.library.policies.Users;
|
||||||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||||
import org.gcube.common.authorization.library.provider.UserInfo;
|
import org.gcube.common.authorization.library.provider.UserInfo;
|
||||||
|
import org.gcube.common.portal.PortalContext;
|
||||||
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
import org.gcube.common.resources.gcore.GCoreEndpoint;
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.portlets.admin.authportletmanager.client.rpc.AuthManagerService;
|
import org.gcube.portlets.admin.authportletmanager.client.rpc.AuthManagerService;
|
||||||
|
@ -66,9 +67,13 @@ import com.liferay.portal.kernel.log.LogFactoryUtil;
|
||||||
* href="mailto:alessandro.pieve@isti.cnr.it">alessandro.pieve@isti.cnr.it</a>
|
* href="mailto:alessandro.pieve@isti.cnr.it">alessandro.pieve@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "serial", "deprecation" })
|
|
||||||
public class AuthServiceImpl extends RemoteServiceServlet
|
public class AuthServiceImpl extends RemoteServiceServlet
|
||||||
implements AuthManagerService {
|
implements AuthManagerService {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = -5302822657119071306L;
|
||||||
private static final Log logger = LogFactoryUtil.getLog(AuthServiceImpl.class);
|
private static final Log logger = LogFactoryUtil.getLog(AuthServiceImpl.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,33 +95,30 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<PolicyAuth> loadListPolicy(String context) throws ServiceException {
|
public ArrayList<PolicyAuth> loadListPolicy(String context) throws ServiceException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
|
||||||
ArrayList<PolicyAuth> policyList =new ArrayList<PolicyAuth>();
|
ArrayList<PolicyAuth> policyList =new ArrayList<PolicyAuth>();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
String username = aslSession.getUsername();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
//String scope=aslSession.getScope();
|
String username = pContext.getCurrentUser(httpServletRequest).getUsername();
|
||||||
//String token =aslSession.getSecurityToken();
|
|
||||||
if (context==null){
|
if (context==null){
|
||||||
logger.debug("loadListPolicy found context:"+null);
|
logger.debug("loadListPolicy found context:"+null);
|
||||||
context=aslSession.getScope();
|
context = pContext.getCurrentScope(httpServletRequest);
|
||||||
}
|
}
|
||||||
String token;
|
String token;
|
||||||
try{
|
try{
|
||||||
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
||||||
}catch (ObjectNotFound e){
|
}catch (ObjectNotFound e){
|
||||||
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
if (ConstantsSharing.DEBUG_MODE) {
|
||||||
token=ConstantsSharing.DEBUG_TOKEN;
|
token=ConstantsSharing.DEBUG_TOKEN;
|
||||||
context="/gcube/devNext";
|
context="/gcube/devNext";
|
||||||
logger.debug("Debug load list policy in scope:"+context);
|
logger.debug("Debug load list policy in scope:"+context);
|
||||||
}
|
}
|
||||||
aslSession.setSecurityToken(token);
|
logger.debug("load list policy in scope:"+context+"-token:"+token+"-username:"+username);
|
||||||
aslSession.setScope(context);
|
ScopeProvider.instance.set(context);
|
||||||
logger.debug("load list policy in scope:"+context+"-token:"+token+"-username:"+username);
|
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
|
||||||
List<Policy> policies = authorizationService().getPolicies(context);
|
List<Policy> policies = authorizationService().getPolicies(context);
|
||||||
if (policies!=null){
|
if (policies!=null){
|
||||||
logger.debug("Load List Policy Find:"+policies.size());
|
logger.debug("Load List Policy Find:"+policies.size());
|
||||||
|
@ -196,26 +198,25 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<Caller> loadListCaller(String context) throws ServiceException {
|
public ArrayList<Caller> loadListCaller(String context) throws ServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
|
||||||
ArrayList<Caller> callers =new ArrayList<Caller>();
|
ArrayList<Caller> callers =new ArrayList<Caller>();
|
||||||
String username = aslSession.getUsername();
|
|
||||||
//String scope=aslSession.getScope();
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
//String token =aslSession.getSecurityToken();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
if (context==null)
|
String username = pContext.getCurrentUser(httpServletRequest).getUsername();
|
||||||
context=aslSession.getScope();
|
if (context==null){
|
||||||
|
context = pContext.getCurrentScope(httpServletRequest);
|
||||||
|
}
|
||||||
|
|
||||||
String token;
|
String token;
|
||||||
try{
|
try{
|
||||||
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
||||||
}catch (ObjectNotFound e){
|
}catch (ObjectNotFound e){
|
||||||
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
||||||
}
|
}
|
||||||
//String token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
if (ConstantsSharing.DEBUG_MODE) {
|
||||||
token=ConstantsSharing.DEBUG_TOKEN;
|
token=ConstantsSharing.DEBUG_TOKEN;
|
||||||
}
|
}
|
||||||
|
ScopeProvider.instance.set(context);
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
if (ConstantsSharing.MOCK_UP) {
|
if (ConstantsSharing.MOCK_UP) {
|
||||||
logger.debug("List Caller on debug mode");
|
logger.debug("List Caller on debug mode");
|
||||||
|
@ -272,12 +273,12 @@ implements AuthManagerService {
|
||||||
public Map<String, List<String>> loadListService(String context) throws ServiceException {
|
public Map<String, List<String>> loadListService(String context) throws ServiceException {
|
||||||
try {
|
try {
|
||||||
logger.debug("loadListService init with context:"+context);
|
logger.debug("loadListService init with context:"+context);
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
@SuppressWarnings("unused")
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
|
||||||
if (context==null){
|
if (context==null){
|
||||||
context=aslSession.getScope();
|
context = pContext.getCurrentScope(httpServletRequest);
|
||||||
logger.debug("Context void,loadListService init with context:"+context);
|
logger.debug("Context void,loadListService init with context:"+context);
|
||||||
|
|
||||||
}
|
}
|
||||||
Map<String, List<String>> services =new HashMap<String, List<String>>();
|
Map<String, List<String>> services =new HashMap<String, List<String>>();
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
if (ConstantsSharing.DEBUG_MODE) {
|
||||||
|
@ -290,17 +291,16 @@ implements AuthManagerService {
|
||||||
services.put("DataAnalysis", Arrays.asList("StatisticalManager"));
|
services.put("DataAnalysis", Arrays.asList("StatisticalManager"));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
//Get List service
|
String username = pContext.getCurrentUser(httpServletRequest).getUsername();
|
||||||
String username = aslSession.getUsername();
|
|
||||||
String token;
|
String token;
|
||||||
try{
|
try{
|
||||||
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
||||||
}catch (ObjectNotFound e){
|
}catch (ObjectNotFound e){
|
||||||
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
||||||
}
|
}
|
||||||
//String token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
//String token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
ScopeProvider.instance.set(context);
|
||||||
SimpleQuery query = queryFor(GCoreEndpoint.class);
|
SimpleQuery query = queryFor(GCoreEndpoint.class);
|
||||||
query.setResult("<Service><ServiceClass>{$resource/Profile/ServiceClass/text()}</ServiceClass>" +
|
query.setResult("<Service><ServiceClass>{$resource/Profile/ServiceClass/text()}</ServiceClass>" +
|
||||||
"<ServiceName>{$resource/Profile/ServiceName/text()}</ServiceName></Service>");
|
"<ServiceName>{$resource/Profile/ServiceName/text()}</ServiceName></Service>");
|
||||||
|
@ -331,22 +331,10 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<String> loadListAccess() throws ServiceException {
|
public ArrayList<String> loadListAccess() throws ServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
|
||||||
|
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
|
||||||
String token=ConstantsSharing.DEBUG_TOKEN;
|
|
||||||
SecurityTokenProvider.instance.set(token);
|
|
||||||
}
|
|
||||||
ArrayList<String> access =new ArrayList<String>();
|
ArrayList<String> access =new ArrayList<String>();
|
||||||
for( Access accessValue : Access.values() )
|
for( Access accessValue : Access.values() )
|
||||||
access.add(access.toString());
|
access.add(access.toString());
|
||||||
return access;
|
return access;
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
throw e;
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("loadListAccess error: " + e.getLocalizedMessage(), e);
|
logger.error("loadListAccess error: " + e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -355,18 +343,18 @@ implements AuthManagerService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<String> loadRetrieveListContexts() throws ServiceException {
|
public ArrayList<String> loadRetrieveListContexts() throws ServiceException {
|
||||||
try {
|
try {
|
||||||
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
String token = pContext.getCurrentUserToken(httpServletRequest);
|
||||||
String token =aslSession.getSecurityToken();
|
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
ArrayList<String> toReturn = new ArrayList<String>();
|
ArrayList<String> toReturn = new ArrayList<String>();
|
||||||
String currentContext = ScopeProvider.instance.get();
|
String currentContext = ScopeProvider.instance.get();
|
||||||
|
|
||||||
GroupManager gm = new LiferayGroupManager();
|
GroupManager gm = new LiferayGroupManager();
|
||||||
long currentGroupId = gm.getGroupIdFromInfrastructureScope(currentContext);
|
long currentGroupId = gm.getGroupIdFromInfrastructureScope(currentContext);
|
||||||
GCubeGroup currentGroup = gm.getGroup(currentGroupId);
|
GCubeGroup currentGroup = gm.getGroup(currentGroupId);
|
||||||
|
@ -385,7 +373,7 @@ implements AuthManagerService {
|
||||||
List<GCubeGroup> children = currentGroup.getChildren();
|
List<GCubeGroup> children = currentGroup.getChildren();
|
||||||
for (GCubeGroup gCubeGroup : children) {
|
for (GCubeGroup gCubeGroup : children) {
|
||||||
toReturn.add(gm.getInfrastructureScope(gCubeGroup.getGroupId()));
|
toReturn.add(gm.getInfrastructureScope(gCubeGroup.getGroupId()));
|
||||||
|
|
||||||
// get the vo children
|
// get the vo children
|
||||||
List<GCubeGroup> childrenVO = gCubeGroup.getChildren();
|
List<GCubeGroup> childrenVO = gCubeGroup.getChildren();
|
||||||
for (GCubeGroup voChildren : childrenVO) {
|
for (GCubeGroup voChildren : childrenVO) {
|
||||||
|
@ -398,18 +386,14 @@ implements AuthManagerService {
|
||||||
// revert
|
// revert
|
||||||
Collections.reverse(toReturn);
|
Collections.reverse(toReturn);
|
||||||
return toReturn;
|
return toReturn;
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
throw e;
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("loadRetrieveListContexts error: " + e.getLocalizedMessage(), e);
|
logger.error("loadRetrieveListContexts error: " + e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException(e.getLocalizedMessage());
|
throw new ServiceException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Insert a new List Policy
|
* Insert a new List Policy
|
||||||
* @return
|
* @return
|
||||||
|
@ -418,28 +402,28 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public void addPolicies(String context,List<PolicyAuth> policiesAuth) throws ServiceException {
|
public void addPolicies(String context,List<PolicyAuth> policiesAuth) throws ServiceException {
|
||||||
try {
|
try {
|
||||||
//Long identifier;
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
if (context==null){
|
||||||
if (context==null)
|
//context=aslSession.getScope();
|
||||||
context=aslSession.getScope();
|
context = pContext.getCurrentScope(httpServletRequest);
|
||||||
|
logger.debug("Context void,addPolicies init with context:"+context);
|
||||||
|
|
||||||
|
}
|
||||||
List<Policy> policies = new ArrayList<Policy>();
|
List<Policy> policies = new ArrayList<Policy>();
|
||||||
//String token =aslSession.getSecurityToken();
|
String username = pContext.getCurrentUser(httpServletRequest).getUsername();
|
||||||
String username = aslSession.getUsername();
|
|
||||||
String token;
|
String token;
|
||||||
try{
|
try{
|
||||||
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
||||||
}catch (ObjectNotFound e){
|
}catch (ObjectNotFound e){
|
||||||
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
||||||
}
|
}
|
||||||
//String token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
if (ConstantsSharing.DEBUG_MODE) {
|
||||||
|
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
|
||||||
token=ConstantsSharing.DEBUG_TOKEN;
|
token=ConstantsSharing.DEBUG_TOKEN;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
ScopeProvider.instance.set(context);
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
//String scope=SessionUtil.getASLSession(session).getScope();
|
|
||||||
for (PolicyAuth policy: policiesAuth){
|
for (PolicyAuth policy: policiesAuth){
|
||||||
ServiceAccess service=new ServiceAccess(policy.getService().getServiceName(), policy.getService().getServiceClass(), policy.getService().getServiceId());
|
ServiceAccess service=new ServiceAccess(policy.getService().getServiceName(), policy.getService().getServiceClass(), policy.getService().getServiceId());
|
||||||
Action access =Action.valueOf(policy.getAccessString());
|
Action access =Action.valueOf(policy.getAccessString());
|
||||||
|
@ -505,31 +489,29 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public void updatePolicy(String context,PolicyAuth policy) throws ServiceException{
|
public void updatePolicy(String context,PolicyAuth policy) throws ServiceException{
|
||||||
try {
|
try {
|
||||||
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
if (context==null){
|
||||||
if (context==null)
|
//context=aslSession.getScope();
|
||||||
context=aslSession.getScope();
|
context = pContext.getCurrentScope(httpServletRequest);
|
||||||
String username = aslSession.getUsername();
|
logger.debug("Context void,addPolicies init with context:"+context);
|
||||||
|
}
|
||||||
|
String username = pContext.getCurrentUser(httpServletRequest).getUsername();
|
||||||
String token;
|
String token;
|
||||||
try{
|
try{
|
||||||
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
token= authorizationService().resolveTokenByUserAndContext(username, context);
|
||||||
}catch (ObjectNotFound e){
|
}catch (ObjectNotFound e){
|
||||||
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
||||||
}
|
}
|
||||||
//String token = authorizationService().generateUserToken(new UserInfo(username, new ArrayList<String>()), context);
|
|
||||||
|
|
||||||
|
|
||||||
//String token =aslSession.getSecurityToken();
|
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
if (ConstantsSharing.DEBUG_MODE) {
|
||||||
token=ConstantsSharing.DEBUG_TOKEN;
|
token=ConstantsSharing.DEBUG_TOKEN;
|
||||||
}
|
}
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
|
ScopeProvider.instance.set(context);
|
||||||
//remove old policy
|
//remove old policy
|
||||||
authorizationService().removePolicies(policy.getIdpolicy());
|
authorizationService().removePolicies(policy.getIdpolicy());
|
||||||
//add a new policy
|
//add a new policy
|
||||||
List<Policy> policies = new ArrayList<Policy>();
|
List<Policy> policies = new ArrayList<Policy>();
|
||||||
//String scope=SessionUtil.getASLSession(session).getScope();
|
|
||||||
ServiceAccess service=new ServiceAccess(policy.getService().getServiceName(), policy.getService().getServiceClass(), policy.getService().getServiceId());
|
ServiceAccess service=new ServiceAccess(policy.getService().getServiceName(), policy.getService().getServiceClass(), policy.getService().getServiceId());
|
||||||
logger.info("updatePolicy -policy.getCallerAsString()"+policy.getCallerAsString());
|
logger.info("updatePolicy -policy.getCallerAsString()"+policy.getCallerAsString());
|
||||||
Action access =Action.valueOf(policy.getAccessString());
|
Action access =Action.valueOf(policy.getAccessString());
|
||||||
|
@ -552,13 +534,18 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public List<Long> deletePolicies(List<Long> identifiers)throws ServiceException {
|
public List<Long> deletePolicies(List<Long> identifiers)throws ServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
|
|
||||||
ArrayList<PolicyAuth> policy =new ArrayList<PolicyAuth>();
|
ArrayList<PolicyAuth> policy =new ArrayList<PolicyAuth>();
|
||||||
String token =aslSession.getSecurityToken();
|
String token = pContext.getCurrentUserToken(httpServletRequest);
|
||||||
|
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
if (ConstantsSharing.DEBUG_MODE) {
|
||||||
token=ConstantsSharing.DEBUG_TOKEN;
|
token=ConstantsSharing.DEBUG_TOKEN;
|
||||||
}
|
}
|
||||||
|
String context = pContext.getCurrentScope(httpServletRequest);
|
||||||
|
ScopeProvider.instance.set(context);
|
||||||
|
|
||||||
SecurityTokenProvider.instance.set(token);
|
SecurityTokenProvider.instance.set(token);
|
||||||
for (Long identifier:identifiers){
|
for (Long identifier:identifiers){
|
||||||
logger.info("Remove policy idpolicy "+identifier);
|
logger.info("Remove policy idpolicy "+identifier);
|
||||||
|
@ -584,8 +571,9 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<Quote> loadListQuota() throws ServiceException {
|
public ArrayList<Quote> loadListQuota() throws ServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
SessionUtil.getASLSession(session);
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
|
|
||||||
ArrayList<Quote> quote =new ArrayList<Quote>();
|
ArrayList<Quote> quote =new ArrayList<Quote>();
|
||||||
if (ConstantsSharing.MOCK_UP) {
|
if (ConstantsSharing.MOCK_UP) {
|
||||||
logger.info("loadListQuota");
|
logger.info("loadListQuota");
|
||||||
|
@ -601,10 +589,6 @@ implements AuthManagerService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return quote;
|
return quote;
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
throw e;
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("loadListQuota error: " + e.getLocalizedMessage(), e);
|
logger.error("loadListQuota error: " + e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -616,9 +600,9 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public List<Long> deleteQuote(List<Long> identifiers)throws ServiceException {
|
public List<Long> deleteQuote(List<Long> identifiers)throws ServiceException {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
if (ConstantsSharing.MOCK_UP) {
|
if (ConstantsSharing.MOCK_UP) {
|
||||||
for (Long identifier:identifiers){
|
for (Long identifier:identifiers){
|
||||||
logger.info("Remove quote idquote "+identifier);
|
logger.info("Remove quote idquote "+identifier);
|
||||||
|
@ -633,10 +617,6 @@ implements AuthManagerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
return identifiers;
|
return identifiers;
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
throw e;
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("deleteQuote error: " + e.getLocalizedMessage(), e);
|
logger.error("deleteQuote error: " + e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -648,8 +628,8 @@ implements AuthManagerService {
|
||||||
public List<Quote> addQuote(List<Quote> quote) throws ServiceException {
|
public List<Quote> addQuote(List<Quote> quote) throws ServiceException {
|
||||||
try {
|
try {
|
||||||
Long identifier;
|
Long identifier;
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
if (ConstantsSharing.MOCK_UP) {
|
if (ConstantsSharing.MOCK_UP) {
|
||||||
for (Quote quota: quote){
|
for (Quote quota: quote){
|
||||||
identifier =(long)(Math.random()*1000000000);
|
identifier =(long)(Math.random()*1000000000);
|
||||||
|
@ -673,10 +653,6 @@ implements AuthManagerService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return quote;
|
return quote;
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
throw e;
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("addQuote error: " + e.getLocalizedMessage(), e);
|
logger.error("addQuote error: " + e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -691,10 +667,8 @@ implements AuthManagerService {
|
||||||
@Override
|
@Override
|
||||||
public Quote updateQuote(Quote quote) throws ServiceException{
|
public Quote updateQuote(Quote quote) throws ServiceException{
|
||||||
try {
|
try {
|
||||||
|
HttpServletRequest httpServletRequest=this.getThreadLocalRequest();
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
PortalContext pContext = PortalContext.getConfiguration();
|
||||||
ASLSession aslSession = SessionUtil.getASLSession(session);
|
|
||||||
|
|
||||||
if (ConstantsSharing.MOCK_UP) {
|
if (ConstantsSharing.MOCK_UP) {
|
||||||
//TableUtils.SERVICES.
|
//TableUtils.SERVICES.
|
||||||
TableUtils.SERVICESQUOTE.remove(quote.getIdQuote());
|
TableUtils.SERVICESQUOTE.remove(quote.getIdQuote());
|
||||||
|
@ -716,10 +690,6 @@ implements AuthManagerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
return quote;
|
return quote;
|
||||||
} catch (ServiceException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
throw e;
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("updateQuote error: " + e.getLocalizedMessage(), e);
|
logger.error("updateQuote error: " + e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
package org.gcube.portlets.admin.authportletmanager.server;
|
|
||||||
|
|
||||||
public class ExpiredSessionServiceException extends Exception {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.gcube.portlets.admin.authportletmanager.server;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
|
|
||||||
import org.gcube.application.framework.core.session.ASLSession;
|
|
||||||
import org.gcube.application.framework.core.session.SessionManager;
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|
||||||
import org.gcube.portlets.admin.authportletmanager.shared.ConstantsSharing;
|
|
||||||
import org.gcube.portlets.admin.authportletmanager.shared.exceptions.ExpiredSessionServiceException;
|
|
||||||
import org.gcube.portlets.admin.authportletmanager.shared.exceptions.ServiceException;
|
|
||||||
|
|
||||||
import com.liferay.portal.kernel.log.Log;
|
|
||||||
import com.liferay.portal.kernel.log.LogFactoryUtil;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author "Alessandro Pieve " <a
|
|
||||||
* href="mailto:alessandro.pieve@isti.cnr.it">alessandro.pieve@isti.cnr.it</a>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class SessionUtil {
|
|
||||||
|
|
||||||
private static final Log logger = LogFactoryUtil.getLog(AuthServiceImpl.class);
|
|
||||||
|
|
||||||
public static ASLSession getASLSession(HttpSession httpSession)
|
|
||||||
throws ServiceException {
|
|
||||||
String username = (String) httpSession
|
|
||||||
.getAttribute(ScopeHelper.USERNAME_ATTRIBUTE);
|
|
||||||
ASLSession aslSession;
|
|
||||||
if (username == null) {
|
|
||||||
if (ConstantsSharing.DEBUG_MODE) {
|
|
||||||
logger.info("no user found in session, use test user");
|
|
||||||
username = ConstantsSharing.DEFAULT_USER;
|
|
||||||
String scope = ConstantsSharing.DEFAULT_SCOPE;
|
|
||||||
httpSession.setAttribute(ScopeHelper.USERNAME_ATTRIBUTE,
|
|
||||||
username);
|
|
||||||
aslSession = SessionManager.getInstance().getASLSession(
|
|
||||||
httpSession.getId(), username);
|
|
||||||
aslSession.setScope(scope);
|
|
||||||
} else {
|
|
||||||
logger.info("no user found in session!");
|
|
||||||
throw new ExpiredSessionServiceException("Session Expired!");
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
aslSession = SessionManager.getInstance().getASLSession(
|
|
||||||
httpSession.getId(), username);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("SessionUtil: aslSession " + aslSession.getUsername() + " "
|
|
||||||
+ aslSession.getScope());
|
|
||||||
|
|
||||||
return aslSession;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -11,8 +11,6 @@ import javax.portlet.PortletRequestDispatcher;
|
||||||
import javax.portlet.RenderRequest;
|
import javax.portlet.RenderRequest;
|
||||||
import javax.portlet.RenderResponse;
|
import javax.portlet.RenderResponse;
|
||||||
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Alessandro Pieve " <a
|
* @author "Alessandro Pieve " <a
|
||||||
|
@ -37,9 +35,10 @@ public class AccountingManagerPortlet extends GenericPortlet {
|
||||||
* @throws IOException .
|
* @throws IOException .
|
||||||
* @throws PortletException .
|
* @throws PortletException .
|
||||||
*/
|
*/
|
||||||
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
|
||||||
ScopeHelper.setContext(request);
|
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||||
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(VIEW_JSP);
|
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(VIEW_JSP);
|
||||||
rd.include(request,response);
|
dispatcher.include(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import javax.portlet.PortletRequestDispatcher;
|
||||||
import javax.portlet.RenderRequest;
|
import javax.portlet.RenderRequest;
|
||||||
import javax.portlet.RenderResponse;
|
import javax.portlet.RenderResponse;
|
||||||
|
|
||||||
import org.gcube.portal.custom.scopemanager.scopehelper.ScopeHelper;
|
|
||||||
import org.gcube.portlets.admin.authportletmanager.server.AuthServiceImpl;
|
import org.gcube.portlets.admin.authportletmanager.server.AuthServiceImpl;
|
||||||
|
|
||||||
import com.liferay.portal.kernel.log.Log;
|
import com.liferay.portal.kernel.log.Log;
|
||||||
|
@ -41,15 +40,9 @@ public class AuthManagerPortlet extends GenericPortlet {
|
||||||
* @throws IOException .
|
* @throws IOException .
|
||||||
* @throws PortletException .
|
* @throws PortletException .
|
||||||
*/
|
*/
|
||||||
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
|
||||||
|
|
||||||
|
public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
|
||||||
logger.trace("AuthPortletManager loading from JSP: "+VIEW_JSP);
|
PortletRequestDispatcher dispatcher = getPortletContext().getRequestDispatcher(VIEW_JSP);
|
||||||
logger.trace("setting context using ScopeHelper");
|
dispatcher.include(request, response);
|
||||||
ScopeHelper.setContext(request);
|
|
||||||
|
|
||||||
logger.trace("passing to the render");
|
|
||||||
PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(VIEW_JSP);
|
|
||||||
rd.include(request,response);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,14 +4,6 @@
|
||||||
<servlet-name>jUnitHostImpl</servlet-name>
|
<servlet-name>jUnitHostImpl</servlet-name>
|
||||||
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
<servlet-class>com.google.gwt.junit.server.JUnitHostImpl</servlet-class>
|
||||||
</servlet>
|
</servlet>
|
||||||
<servlet>
|
|
||||||
<servlet-name>checkServlet</servlet-name>
|
|
||||||
<servlet-class>org.gcube.portlets.widgets.sessionchecker.server.SessionCheckerServiceImpl</servlet-class>
|
|
||||||
</servlet>
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>scopeService</servlet-name>
|
|
||||||
<servlet-class>org.gcube.portlets.user.gcubewidgets.server.ScopeServiceImpl</servlet-class>
|
|
||||||
</servlet>
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>authService</servlet-name>
|
<servlet-name>authService</servlet-name>
|
||||||
<servlet-class>org.gcube.portlets.admin.authportletmanager.server.AuthServiceImpl</servlet-class>
|
<servlet-class>org.gcube.portlets.admin.authportletmanager.server.AuthServiceImpl</servlet-class>
|
||||||
|
@ -20,14 +12,6 @@
|
||||||
<servlet-name>jUnitHostImpl</servlet-name>
|
<servlet-name>jUnitHostImpl</servlet-name>
|
||||||
<url-pattern>/authman/junithost/*</url-pattern>
|
<url-pattern>/authman/junithost/*</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>checkServlet</servlet-name>
|
|
||||||
<url-pattern>/authman/checksession</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>scopeService</servlet-name>
|
|
||||||
<url-pattern>/authman/scopeService</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
<servlet-mapping>
|
<servlet-mapping>
|
||||||
<servlet-name>authService</servlet-name>
|
<servlet-name>authService</servlet-name>
|
||||||
<url-pattern>/authman/authm</url-pattern>
|
<url-pattern>/authman/authm</url-pattern>
|
||||||
|
|
Loading…
Reference in New Issue