Managed USERNAME parameter to perform the request to exporter service on
behalf of the user.
This commit is contained in:
parent
3aa7f6462f
commit
3e568b58b4
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -131,7 +132,8 @@
|
|||
|
||||
|
||||
<wb-module deploy-name="geoportal-data-viewer-app-3.7.0-SNAPSHOT">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -263,7 +265,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -395,7 +398,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -527,7 +531,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/gwt"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -659,7 +664,8 @@
|
|||
|
||||
|
||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -683,10 +689,8 @@
|
|||
<dependent-module archiveName="geoportal-client-1.2.2-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-client/geoportal-client">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="uri-resolver-manager-1.8.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/uri-resolver-manager/uri-resolver-manager">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -818,7 +822,8 @@
|
|||
|
||||
|
||||
<property name="java-output-path" value="/geoportal-data-viewer-app/target/geoportal-data-viewer-app-0.0.1-SNAPSHOT/WEB-INF/classes"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -950,7 +955,8 @@
|
|||
|
||||
|
||||
<property name="context-root" value="geoportal-data-viewer-app"/>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1082,7 +1088,8 @@
|
|||
|
||||
|
||||
</wb-module>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ public class GeoportalDataViewerConstants {
|
|||
public static final String PROIECT_ID_PARAMETER = "projectID";
|
||||
public static final String CONTEXT_ID_PARAMETER = "c_id";
|
||||
public static final String USER_ID_PARAMETER = "u_id";
|
||||
public static final String USERNAME_PARAMETER = "usn";
|
||||
public static final String GEOPORTAL_EXPORT_ACTION_SERVLET = GWT.getModuleBaseURL()
|
||||
+ "geoportalexporterservice";
|
||||
|
||||
|
|
|
@ -256,6 +256,10 @@ public class ProjectViewer extends Composite {
|
|||
panel.add(new Hidden(GeoportalDataViewerConstants.CONTEXT_ID_PARAMETER, currentContextId));
|
||||
panel.add(new Hidden(GeoportalDataViewerConstants.USER_ID_PARAMETER, currentUserId));
|
||||
|
||||
if(myLogin!=null) {
|
||||
panel.add(new Hidden(GeoportalDataViewerConstants.USERNAME_PARAMETER, myLogin));
|
||||
}
|
||||
|
||||
final Modal contactinServiceModal = new Modal(true, true);
|
||||
contactinServiceModal.setCloseVisible(false);
|
||||
contactinServiceModal.setTitle("Export");
|
||||
|
@ -341,14 +345,6 @@ public class ProjectViewer extends Composite {
|
|||
public void onClick(ClickEvent event) {
|
||||
boolean visible = toc_list_container.isVisible();
|
||||
setTocContentVisible(!visible);
|
||||
|
||||
// if (visible) {
|
||||
// toc_list_container.setVisible(false);
|
||||
// reduceToc.setIcon(IconType.PLUS_SIGN_ALT);
|
||||
// } else {
|
||||
// toc_list_container.setVisible(true);
|
||||
// reduceToc.setIcon(IconType.MINUS_SIGN_ALT);
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -82,9 +82,10 @@ public class GeoportalExporterActionServlet extends HttpServlet {
|
|||
String ucdID = req.getParameter(GeoportalDataViewerConstants.UCD_ID_PARAMETER);
|
||||
String contextID = req.getParameter(GeoportalDataViewerConstants.CONTEXT_ID_PARAMETER);
|
||||
String userID = req.getParameter(GeoportalDataViewerConstants.USER_ID_PARAMETER);
|
||||
String username = req.getParameter(GeoportalDataViewerConstants.USERNAME_PARAMETER);
|
||||
// logger.info("serveRequest called with [projectID: " + projectID + ", ucdID: " + ucdID + ", contextID: " + contextID+"]");
|
||||
logger.info("serveRequest called with [projectID: " + projectID + ", ucdID: " + ucdID + ", contextID: "
|
||||
+ contextID + ", userID: " + userID + "]");
|
||||
+ contextID + ", userID: " + userID + ", username: " + username + "]");
|
||||
|
||||
if (contextID == null || contextID.isEmpty())
|
||||
sendError(resp, "Bad Request. No context found!");
|
||||
|
@ -97,10 +98,19 @@ public class GeoportalExporterActionServlet extends HttpServlet {
|
|||
// Setting header required to {@PortalContext}
|
||||
MutableHttpServletRequest mutableRequest = new MutableHttpServletRequest(req);
|
||||
mutableRequest.putHeader(PortalContext.VRE_ID_ATTR_NAME, contextID);
|
||||
// DEV MODE
|
||||
if (!SessionUtil.isIntoPortal()) {
|
||||
logger.info("DEBUG MODE, putting header "+PortalContext.USER_ID_ATTR_NAME);
|
||||
logger.info("DEBUG MODE, putting header " + PortalContext.USER_ID_ATTR_NAME);
|
||||
mutableRequest.putHeader(PortalContext.USER_ID_ATTR_NAME, userID);
|
||||
}
|
||||
|
||||
// IF USERNAME exists, add the userID to request. So performing the request to
|
||||
// exporter service on behalf of the user.
|
||||
if (username != null) {
|
||||
logger.info("Username found, putting header " + PortalContext.USER_ID_ATTR_NAME);
|
||||
mutableRequest.putHeader(PortalContext.USER_ID_ATTR_NAME, userID);
|
||||
}
|
||||
|
||||
ScopeProvider.instance.set(scope);
|
||||
GeoportalServiceIdentityProxy identity = new GeoportalServiceIdentityProxy(mutableRequest);
|
||||
String theToken = identity.getToken();
|
||||
|
|
Loading…
Reference in New Issue