Add client rest
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-access/gcube-geoserver-connector@148923 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
fb1cc1ecd3
commit
556cc4bbb3
|
@ -3,6 +3,8 @@ package org.gcube.data.access.connector;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.xml.bind.annotation.XmlRootElement;
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
import org.gcube.data.access.connector.rest.GCubeRestClient;
|
||||||
|
import org.gcube.data.access.connector.rest.entity.AccessibleCredentialsEntity;
|
||||||
import org.gcube.smartgears.handlers.application.RequestEvent;
|
import org.gcube.smartgears.handlers.application.RequestEvent;
|
||||||
import org.gcube.smartgears.handlers.application.RequestHandler;
|
import org.gcube.smartgears.handlers.application.RequestHandler;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -31,9 +33,27 @@ public class GeoServerConnectorRequestHandler extends RequestHandler {
|
||||||
System.out.println("Handling request");
|
System.out.println("Handling request");
|
||||||
HttpServletRequest httpServletRequest = e.request();
|
HttpServletRequest httpServletRequest = e.request();
|
||||||
|
|
||||||
//TODO get credentials from IS
|
//TODO get these info from IS
|
||||||
|
System.out.println("Call to REST client");
|
||||||
|
this.logger.info("Call to REST client");
|
||||||
|
String endpoint = "https://sdi-d-d4s.d4science.org/sdi-service/gcube/service/GeoServer/credentials/";
|
||||||
|
String host = "geoserver1-d-d4s.d4science.org";
|
||||||
|
// String host = "http://geoserver1-d-d4s.d4science.org";
|
||||||
|
// String host = httpServletRequest.getServerName();
|
||||||
|
String token = "feda0617-cd9d-4841-b6f0-e047da5d32ed-98187548";
|
||||||
|
//https://geoserver1-d-d4s.d4science.org/geoserver
|
||||||
|
//https://sdi-d-d4s.d4science.org/sdi-service/gcube/service/GeoServer/credentials/geoserver1-d-d4s.d4science.org?gcube-token=feda0617-cd9d-4841-b6f0-e047da5d32ed-98187548
|
||||||
|
System.out.println( "Remote Host: " + httpServletRequest.getRemoteHost());
|
||||||
|
System.out.println("Server Name: " +httpServletRequest.getServerName());
|
||||||
|
System.out.println("Local Name: " +httpServletRequest.getLocalName());
|
||||||
|
|
||||||
|
GCubeRestClient client = new GCubeRestClient();
|
||||||
|
AccessibleCredentialsEntity accessibleCredentials = client.getAccessibleCredentials(endpoint, host, token);
|
||||||
|
System.out.println("accessibleCredentials: " + accessibleCredentials.getUsername() + " " + accessibleCredentials.getPassword());
|
||||||
httpServletRequest.setAttribute(AuthenticationUtils.USERNAME, "admin");
|
httpServletRequest.setAttribute(AuthenticationUtils.USERNAME, "admin");
|
||||||
httpServletRequest.setAttribute(AuthenticationUtils.PASSWORD, "geoserver");
|
httpServletRequest.setAttribute(AuthenticationUtils.PASSWORD, "geoserver");
|
||||||
|
// httpServletRequest.setAttribute(AuthenticationUtils.USERNAME, accessibleCredentials.getUsername());
|
||||||
|
// httpServletRequest.setAttribute(AuthenticationUtils.PASSWORD, accessibleCredentials.getPassword());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue