aligned to hello-world-sg4-service

This commit is contained in:
Alfredo Oliviero 2024-02-26 18:02:00 +01:00
parent d6257cf520
commit c016637b38
10 changed files with 109 additions and 34 deletions

4
.vscode/launch.json vendored
View File

@ -10,7 +10,7 @@
"projectName": "identity-manager", "projectName": "identity-manager",
"request": "attach", "request": "attach",
"hostName": "localhost", "hostName": "localhost",
"port": 4954 "port": 5005
} }
] ]
} }

View File

@ -3,7 +3,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for Identity Manager Service # Changelog for Identity Manager Service
## [v1.0.0-SNAPSHOT] ## [v0.0.1-SNAPSHOT]
- First Version - First Prototype

View File

@ -1,7 +1,8 @@
#FROM d4science/smartgears-distribution:4.0.0-SNAPSHOT-java11-tomcat9 FROM d4science/smartgears-distribution:4.0.0-SNAPSHOT-java11-tomcat9
FROM smartgears-distribution:4.0.0-java11-tomcat9-devel #FROM smartgears-distribution:4.0.0-java11-tomcat9-devel
COPY ./docker/logback.xml /etc/ COPY ./docker/logback.xml /etc/
COPY ./docker/container.ini /etc/ COPY ./docker/container.ini /etc/
COPY ./target/idm.war /tomcat/webapps/
# EXPOSE 8080 EXPOSE 8080

5
buildImageAndStart.sh Executable file
View File

@ -0,0 +1,5 @@
mvn clean package
NAME=idm
docker build -t $NAME .
docker run -p 8080:8080 $NAME

8
buildImageAndStartWithDebug.sh Executable file
View File

@ -0,0 +1,8 @@
mvn clean package
NAME=idm
PORT=8080
DEBUG_PORT=5005
docker build -t $NAME .
docker run -p $PORT:8080 -p $DEBUG_PORT:5005 -e JAVA_TOOL_OPTIONS="-agentlib:jdwp=transport=dt_socket,address=*:5005,server=y,suspend=y" $NAME

View File

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

View File

@ -5,6 +5,11 @@
</encoder> </encoder>
</appender> </appender>
<logger name="org.gcube.service.idm" level="DEBUG" />
<logger name="org.gcube.service.rest" level="DEBUG" />
<logger name="org.gcube.smartgears" level="DEBUG" />
<!--
<logger name="org.gcube" level="DEBUG" /> <logger name="org.gcube" level="DEBUG" />
<logger name="org.gcube.smartgears" level="TRACE" /> <logger name="org.gcube.smartgears" level="TRACE" />
<logger name="org.gcube.smartgears.handlers" level="TRACE" /> <logger name="org.gcube.smartgears.handlers" level="TRACE" />
@ -14,6 +19,7 @@
<logger name="org.gcube.common.core.publisher.is.legacy" level="TRACE" /> <logger name="org.gcube.common.core.publisher.is.legacy" level="TRACE" />
<logger name="org.gcube.data.access" level="TRACE" /> <logger name="org.gcube.data.access" level="TRACE" />
<logger name="org.gcube.data.access.storagehub.handlers" level="DEBUG" /> <logger name="org.gcube.data.access.storagehub.handlers" level="DEBUG" />
-->
<root level="WARN"> <root level="WARN">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />

View File

@ -1,6 +1,8 @@
name: idm name: idm
group: DataAccess group: org.gcube.service
version: 1.0.0 version: 1.0.0
description: Identity Manager Service description: Identity Manager Service
excludes: excludes:
- path: /excluded
- path: /guest
- path: /api-docs/* - path: /api-docs/*

View File

@ -9,10 +9,10 @@
A gcube service - smartgears 4 A gcube service - smartgears 4
</description> </description>
<servlet> <servlet>
<servlet-name>org.gcube.idm.IdentityManagerResourceInitializer</servlet-name> <servlet-name>org.gcube.service.idm.IdM</servlet-name>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>org.gcube.idm.IdentityManagerResourceInitializer</servlet-name> <servlet-name>org.gcube.service.idm.IdM</servlet-name>
<url-pattern>/idm/*</url-pattern> <url-pattern>/*</url-pattern>
</servlet-mapping> </servlet-mapping>
</web-app> </web-app>

88
pom.xml
View File

@ -2,24 +2,33 @@
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.idm</groupId>
<artifactId>idm</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Identity Manager Smargears</name>
<description>Identity Manager Smargears Service</description>
<parent> <parent>
<groupId>org.gcube.tools</groupId> <groupId>org.gcube.tools</groupId>
<artifactId>maven-parent</artifactId> <artifactId>maven-parent</artifactId>
<version>1.2.0</version> <version>1.2.0</version>
</parent> </parent>
<groupId>org.gcube.idm</groupId>
<artifactId>identity-manager</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>identity-manager</name>
<description>Identity Manager Smargears Service</description>
<properties> <properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>${java.version}</maven.compiler.target>
<webappDirectory>
${project.basedir}${file.separator}gcube${file.separator}extra-resources${file.separator}WEB-INF</webappDirectory> <!-- OPTIONAL. for authorization-control-library -->
<aspectj-plugin.version>1.14.0</aspectj-plugin.version>
<!-- OPTIONAL. for enunciate -->
<enunciate.version>2.14.0</enunciate.version> <enunciate.version>2.14.0</enunciate.version>
</properties> </properties>
@ -43,17 +52,25 @@
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<!-- smartgears --> <!-- smartgears -->
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-smartgears</artifactId> <artifactId>common-smartgears</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-security</artifactId>
</dependency>
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-control-library</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.core</groupId> <groupId>org.gcube.core</groupId>
<artifactId>common-smartgears-app</artifactId> <artifactId>common-smartgears-app</artifactId>
</dependency> </dependency>
<!-- jersey --> <!-- jersey -->
<dependency> <dependency>
<groupId>javax.ws.rs</groupId> <groupId>javax.ws.rs</groupId>
@ -63,11 +80,18 @@
<groupId>org.glassfish.jersey.containers</groupId> <groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId> <artifactId>jersey-container-servlet</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.inject/jersey-cdi2-se -->
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-cdi2-se</artifactId>
</dependency>
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version> <version>3.0.1</version>
</dependency> </dependency>
<!-- add jackson as json provider --> <!-- add jackson as json provider -->
<dependency> <dependency>
<groupId>org.glassfish.jersey.media</groupId> <groupId>org.glassfish.jersey.media</groupId>
@ -110,7 +134,10 @@
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<plugins> <plugins>
<plugin>
<!-- OPTIONAL generate the war in a different folder, to mount deploy on docker
container -->
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>2.3</version> <version>2.3</version>
@ -118,6 +145,32 @@
<warName>identity-manager</warName> <warName>identity-manager</warName>
<outputDirectory>tomcat/webapps</outputDirectory> <outputDirectory>tomcat/webapps</outputDirectory>
</configuration> </configuration>
</plugin> -->
<!-- OPTIONAL. authorization-control-library: add this plugin if you want to use gcube
authorization control funzionalities -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${aspectj-plugin.version}</version>
<configuration>
<complianceLevel>11</complianceLevel>
<source>11</source>
<target>11</target>
<aspectLibraries>
<aspectLibrary>
<groupId>org.gcube.common</groupId>
<artifactId>authorization-control-library</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
<!-- Sphinx plugin' <!-- Sphinx plugin'
@ -142,9 +195,8 @@
</executions> </executions>
</plugin> --> </plugin> -->
<!-- Enunciate Maven plugin --> <!-- Enunciate Maven plugin -->
<plugin> <!-- <plugin>
<groupId>com.webcohesion.enunciate</groupId> <groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-maven-plugin</artifactId> <artifactId>enunciate-maven-plugin</artifactId>
<version>${enunciate.version}</version> <version>${enunciate.version}</version>
@ -156,10 +208,11 @@
</goals> </goals>
</execution> </execution>
</executions> </executions>
</plugin> </plugin> -->
<!-- Copy Enunciate Documentation from your-application/api-docs <!-- Copy Enunciate Documentation from your-application/api-docs
into your war --> into your war -->
<plugin> <!-- <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<executions> <executions>
@ -183,7 +236,8 @@
</configuration> </configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin> -->
</plugins> </plugins>
</build> </build>