working app

This commit is contained in:
Alfredo Oliviero 2024-02-16 15:52:58 +01:00
parent 5ca788b801
commit 4bd8a871b4
6 changed files with 5 additions and 54 deletions

View File

@ -1,29 +1,7 @@
#FROM d4science/smartgears-distribution:4.0.0-SNAPSHOT-java11-tomcat9
FROM smartgears-distribution:4.0.0-java11-tomcat9-devel
ARG REPOUSER=admin
ARG REPOPWD=admin
# COPY ./target/identity-manager.war /tomcat/webapps/
ARG REPOPWD=admin
#COPY ./tomcat/webapps/sample.war /tomcat/webapps/
#COPY ./target/identity-manager.war /usr/local/tomcat/webapps/
# COPY ./docker/storagehub.xml /tomcat/conf/Catalina/localhost/
COPY ./docker/logback.xml /etc/
COPY ./docker/container.ini /etc/
# RUN cp -a /usr/local/tomcat/webapps.dist/docs /usr/local/tomcat/webapps
# RUN cp -a /usr/local/tomcat/webapps.dist/examples /usr/local/tomcat/webapps
# RUN cp -a /usr/local/tomcat/webapps.dist/host-manager /usr/local/tomcat/webapps
# RUN cp -a /usr/local/tomcat/webapps.dist/manager /usr/local/tomcat/webapps
# RUN cp -a /usr/local/tomcat/webapps.dist/ROOT /usr/local/tomcat/webapps
RUN cp -a /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps
# RUN unzip /tomcat/webapps/identity-manager.war -d /tomcat/webapps/identity-manager
# RUN unzip /usr/local/tomcat/webapps/identity-manager.war -d /usr/local/tomcat/webapps/identity-manager
# RUN rm /usr/local/tomcat/webapps/identity-manager.war
EXPOSE 8080
# COPY ./docker/storage-settings.properties /tomcat/webapps/identity-manager/WEB-INF/classes/
# RUN sed -i "s/{{adminId}}/$REPOUSER/g; s/{{adminPwd}}/$REPOPWD/g" /tomcat/webapps/storagehub/WEB-INF/web.xml
# EXPOSE 8080

View File

@ -1,5 +1,5 @@
[node]
mode = offline
mode = online
hostname = alfredo-idm-service-dev
protocol= http
port = 8080
@ -19,8 +19,8 @@ location = pisa
factory = org.gcube.smartgears.security.defaults.DefaultAuthorizationProviderFactory
factory.endpoint = https://accounts.dev.d4science.org/auth/realms/d4science/protocol/openid-connect/token
credentials.class = org.gcube.smartgears.security.SimpleCredentials
credentials.client_id = alfredo-idm-service-dev
credentials.client_secret = 979bd3bc-5cc4-11ec-bf63-0242ac130002
credentials.clientID = alfredo-idm-service-dev
credentials.secret = 979bd3bc-5cc4-11ec-bf63-0242ac130002
; credentials.clientID = node-whn-test-uno-d-d4s.d4science.org
; credentials.secret = 979bd3bc-5cc4-11ec-bf63-0242ac130002

10
pom.xml
View File

@ -81,16 +81,6 @@
<artifactId>common-scope-maps</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>keycloak-client</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>21.0.1</version>
</dependency>
<dependency>
<groupId>org.gcube.core</groupId>
<artifactId>common-encryption</artifactId>

View File

@ -21,7 +21,7 @@ public class TestRest {
@Path("/prova")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public String prova(){
return "{}";
return "{'aaa':bbb'}";
}
}

View File

@ -4,16 +4,11 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response.Status;
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
import org.gcube.keycloak.KeycloakClientParams_UNUSED;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -36,18 +31,6 @@ public class HTTPUtility {
return result;
}
public static GXHTTPStringRequest createGXHTTPStringRequest(String url, String path, boolean post)
throws UnsupportedEncodingException {
GXHTTPStringRequest gxhttpStringRequest = GXHTTPStringRequest.newRequest(url);
gxhttpStringRequest.from(KeycloakClientParams_UNUSED.CATALOGUE_NAME);
if(post) {
gxhttpStringRequest.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
}
gxhttpStringRequest.header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
gxhttpStringRequest.path(path);
return gxhttpStringRequest;
}
public static String getResultAsString(HttpURLConnection httpURLConnection) throws IOException {
int responseCode = httpURLConnection.getResponseCode();
if(responseCode >= Status.BAD_REQUEST.getStatusCode()) {