Passed to the new KC-client [#27398]
This commit is contained in:
parent
7d3e9544f5
commit
ee4524139e
|
@ -677,9 +677,6 @@
|
||||||
|
|
||||||
|
|
||||||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
|
||||||
<dependent-module archiveName="geoportal-data-mapper-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-mapper/geoportal-data-mapper">
|
|
||||||
<dependency-type>uses</dependency-type>
|
|
||||||
</dependent-module>
|
|
||||||
<dependent-module archiveName="geoportal-data-common-2.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
<dependent-module archiveName="geoportal-data-common-2.4.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/geoportal-data-common/geoportal-data-common">
|
||||||
<dependency-type>uses</dependency-type>
|
<dependency-type>uses</dependency-type>
|
||||||
</dependent-module>
|
</dependent-module>
|
||||||
|
|
|
@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
- Provided the "Export as PDF" facility [#26026]
|
- Provided the "Export as PDF" facility [#26026]
|
||||||
- Integrated the GeoportalExporter as service [#27321]
|
- Integrated the GeoportalExporter as service [#27321]
|
||||||
|
- Passed to the new KC-client [#27398]
|
||||||
|
|
||||||
## [v3.6.0]
|
## [v3.6.0]
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,17 @@ public class GeoportalExporterActionServlet extends HttpServlet {
|
||||||
* @throws ServletException the servlet exception
|
* @throws ServletException the servlet exception
|
||||||
*/
|
*/
|
||||||
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
|
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
|
||||||
|
serveRequest(req, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serve request.
|
||||||
|
*
|
||||||
|
* @param req the req
|
||||||
|
* @param resp the resp
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
public void serveRequest(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
// setSecretManager();
|
// setSecretManager();
|
||||||
String projectID = req.getParameter(GeoportalDataViewerConstants.PROIECT_ID_PARAMETER);
|
String projectID = req.getParameter(GeoportalDataViewerConstants.PROIECT_ID_PARAMETER);
|
||||||
String ucdID = req.getParameter(GeoportalDataViewerConstants.UCD_ID_PARAMETER);
|
String ucdID = req.getParameter(GeoportalDataViewerConstants.UCD_ID_PARAMETER);
|
||||||
|
@ -73,7 +84,7 @@ public class GeoportalExporterActionServlet extends HttpServlet {
|
||||||
logger.info("The scope is {}", scope);
|
logger.info("The scope is {}", scope);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//Setting header required to {@PortalContext}
|
// Setting header required to {@PortalContext}
|
||||||
MutableHttpServletRequest mutableRequest = new MutableHttpServletRequest(req);
|
MutableHttpServletRequest mutableRequest = new MutableHttpServletRequest(req);
|
||||||
mutableRequest.putHeader(PortalContext.VRE_ID_ATTR_NAME, contextID);
|
mutableRequest.putHeader(PortalContext.VRE_ID_ATTR_NAME, contextID);
|
||||||
mutableRequest.putHeader(PortalContext.USER_ID_ATTR_NAME, userID);
|
mutableRequest.putHeader(PortalContext.USER_ID_ATTR_NAME, userID);
|
||||||
|
@ -86,7 +97,7 @@ public class GeoportalExporterActionServlet extends HttpServlet {
|
||||||
GeoportalExporterAPI geoportalExporterAPI = new GeoportalExporterAPI();
|
GeoportalExporterAPI geoportalExporterAPI = new GeoportalExporterAPI();
|
||||||
URL urlRequest = geoportalExporterAPI.exportProject("pdf", ucdID, projectID, false);
|
URL urlRequest = geoportalExporterAPI.exportProject("pdf", ucdID, projectID, false);
|
||||||
String urlToRedirect = urlRequest.toString();
|
String urlToRedirect = urlRequest.toString();
|
||||||
logger.info("Performing request to {} with identity {}", urlToRedirect, identity.getDescription());
|
logger.info("Performing request to {} with identity description {}", urlToRedirect, identity.getDescription());
|
||||||
logger.info("Token is {}", theToken.substring(0, 20) + "_MASKED_TOKEN");
|
logger.info("Token is {}", theToken.substring(0, 20) + "_MASKED_TOKEN");
|
||||||
|
|
||||||
InputStream is = performHttpRequestToSGService(urlToRedirect, theIdentity, theToken);
|
InputStream is = performHttpRequestToSGService(urlToRedirect, theIdentity, theToken);
|
||||||
|
@ -99,9 +110,17 @@ public class GeoportalExporterActionServlet extends HttpServlet {
|
||||||
sendError(resp, "Error occurred when exporting the Project. Error is: " + e.getMessage());
|
sendError(resp, "Error occurred when exporting the Project. Error is: " + e.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform http request to SG service.
|
||||||
|
*
|
||||||
|
* @param urlToService the url to service
|
||||||
|
* @param identity the identity
|
||||||
|
* @param token the token
|
||||||
|
* @return the input stream
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
public static InputStream performHttpRequestToSGService(String urlToService, String identity, String token)
|
public static InputStream performHttpRequestToSGService(String urlToService, String identity, String token)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
logger.debug("performHttpRequestToSGService called");
|
logger.debug("performHttpRequestToSGService called");
|
||||||
|
|
|
@ -46,8 +46,9 @@ public class IAMClientIdentity implements GcubeIdentity {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
LOG.info("Querying KeycloakClientFactory to get UMA token..");
|
LOG.info("Querying KeycloakClientFactory to get UMA token..");
|
||||||
TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(clientId, clientSecret, currentScope,
|
TokenResponse tr = KeycloakClientFactory.newInstance().queryUMAToken(currentScope, clientId, clientSecret, currentScope,
|
||||||
null);
|
null);
|
||||||
|
|
||||||
umaAcessToken = tr.getAccessToken();
|
umaAcessToken = tr.getAccessToken();
|
||||||
if (umaAcessToken != null && !umaAcessToken.isEmpty()) {
|
if (umaAcessToken != null && !umaAcessToken.isEmpty()) {
|
||||||
LOG.info("UMA Access Token read correctly");
|
LOG.info("UMA Access Token read correctly");
|
||||||
|
|
Loading…
Reference in New Issue